From 8dc04aba54c982cfd86e0e3a064f4312674c9a3d Mon Sep 17 00:00:00 2001 From: Don Syme Date: Tue, 27 Jan 2015 16:36:41 +0000 Subject: [PATCH] Fix #123 - Union types without sub-classes should be sealed --- src/ilx/cu_erase.fs | 8 ++------ tests/fsharp/core/array/test.fsx | 2 ++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/ilx/cu_erase.fs b/src/ilx/cu_erase.fs index 84877a9c897..a4ed3fd7ee2 100644 --- a/src/ilx/cu_erase.fs +++ b/src/ilx/cu_erase.fs @@ -1059,9 +1059,6 @@ let rec convClassUnionDef cenv enc td cud = |> List.filter (fun pd -> not (cud.cudHasHelpers = SpecialFSharpListHelpers && (pd.Name = "Empty" || pd.Name = "IsEmpty" )) && not (cud.cudHasHelpers = SpecialFSharpOptionHelpers && (pd.Name = "Value" || pd.Name = "None"))) - let casesTypeDef = - None - let enumTypeDef = // The nested Tags type is elided if there is only one tag // The Tag property is NOT elided if there is only one tag @@ -1095,15 +1092,14 @@ let rec convClassUnionDef cenv enc td cud = let baseTypeDef = { Name = td.Name; - NestedTypes = mkILTypeDefs (Option.toList casesTypeDef @ - Option.toList enumTypeDef @ + NestedTypes = mkILTypeDefs (Option.toList enumTypeDef @ altTypeDefs @ altDebugTypeDefs @ (convTypeDefs cenv (enc@[td]) td.NestedTypes).AsList); GenericParams= td.GenericParams; Access = td.Access; IsAbstract = isAbstract; - IsSealed = false; + IsSealed = altTypeDefs.IsEmpty; IsSerializable=td.IsSerializable; IsComInterop=false; Layout=td.Layout; diff --git a/tests/fsharp/core/array/test.fsx b/tests/fsharp/core/array/test.fsx index 34212522242..97cd14e8a66 100644 --- a/tests/fsharp/core/array/test.fsx +++ b/tests/fsharp/core/array/test.fsx @@ -1368,6 +1368,8 @@ module bug872632 = do check "bug872632" Foo.x.Length 8 + do check "vwllfewlkefwl" (typedefof>.IsSealed) true + module manyIndexes = open System