Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit35e6a00

Browse files
dsymelatkin
authored andcommitted
Fixdotnet#123 - Union types without sub-classes should be sealed
fixesdotnet#123closesdotnet#143commit 5566c99ebc936ad16081dda5f9a6c9754d4e095dAuthor: latkin <latkin@microsoft.com>Date: Fri Feb 13 12:55:07 2015 -0800 Workaround for lack of Type.IsSealed in some portable profilescommit7bf077fAuthor: Don Syme <dsyme@microsoft.com>Date: Fri Feb 13 10:53:42 2015 +0000 fix codegen testscommitcec8adaMerge:95cc10dac85db7Author: Don Syme <dsyme@microsoft.com>Date: Fri Feb 13 09:57:44 2015 +0000 Merge branch 'fsharp4' ofhttp://github.com/Microsoft/visualfsharp into fix-123commit95cc10dAuthor: Don Syme <dsyme@microsoft.com>Date: Fri Jan 30 08:30:24 2015 +0000 update baselinescommit3050f4fAuthor: Don Syme <dsyme@microsoft.com>Date: Thu Jan 29 16:27:55 2015 +0000 fix test mistakecommit5be64f6Author: Don Syme <dsyme@microsoft.com>Date: Thu Jan 29 12:50:07 2015 +0000 update baselines of testscommit99a552cMerge:d91cb38d17d429Author: Don Syme <dsyme@microsoft.com>Date: Thu Jan 29 12:22:05 2015 +0000 Merge branch 'fsharp4' ofhttp://github.com/Microsoft/visualfsharp into fix-123commitd91cb38Author: Don Syme <dsyme@microsoft.com>Date: Thu Jan 29 10:18:54 2015 +0000 NOP commit to run appveyorcommit426f2a2Author: Don Syme <dsyme@microsoft.com>Date: Tue Jan 27 16:43:43 2015 +0000 add extra tests for IsSealedcommit8dc04abAuthor: Don Syme <dsyme@microsoft.com>Date: Tue Jan 27 16:36:41 2015 +0000Fixdotnet#123 - Union types without sub-classes should be sealed
1 parent36e0ec8 commit35e6a00

File tree

35 files changed

+94
-67
lines changed

35 files changed

+94
-67
lines changed

‎TESTGUIDE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,4 @@ You can execute and re-run these tests using any standard NUnit approach - via g
129129
* Making the tests run faster
130130
* NGen-ing the F# bits (fsc, fsi, FSharp.Core, etc) will result in tests executing much faster. Make sure you run`src\update.cmd` with the`-ngen` flag before running tests.
131131
* The Fsharp and FsharpQA suites will run test cases in parallel by default. You can comment out the relevant line in`RunTests.cmd` (look for`PARALLEL_ARG`) to disable this.
132-
* By default, tests from the FSharpQA suite are run using a persistent, hosted version of the compiler. This speeds up test execution, as there is no need for the`fsc.exe` process to spin up repeatedly. To disable this, uncomment the relevant line in`RunTests.cmd` (look for`HOSTED_COMPILER`).
132+
* By default, tests from the FSharpQA suite are run using a persistent, hosted version of the compiler. This speeds up test execution, as there is no need for the`fsc.exe` process to spin up repeatedly. To disable this, uncomment the relevant line in`RunTests.cmd` (look for`HOSTED_COMPILER`).

‎src/ilx/cu_erase.fs‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,9 +1059,6 @@ let rec convClassUnionDef cenv enc td cud =
10591059
|> List.filter(fun pd->not(cud.cudHasHelpers= SpecialFSharpListHelpers&&(pd.Name="Empty"|| pd.Name="IsEmpty"))&&
10601060
not(cud.cudHasHelpers= SpecialFSharpOptionHelpers&&(pd.Name="Value"|| pd.Name="None")))
10611061

1062-
letcasesTypeDef=
1063-
None
1064-
10651062
letenumTypeDef=
10661063
// The nested Tags type is elided if there is only one tag
10671064
// The Tag property is NOT elided if there is only one tag
@@ -1095,15 +1092,14 @@ let rec convClassUnionDef cenv enc td cud =
10951092

10961093
letbaseTypeDef=
10971094
{ Name= td.Name;
1098-
NestedTypes= mkILTypeDefs(Option.toList casesTypeDef@
1099-
Option.toList enumTypeDef@
1095+
NestedTypes= mkILTypeDefs(Option.toList enumTypeDef@
11001096
altTypeDefs@
11011097
altDebugTypeDefs@
11021098
(convTypeDefs cenv(enc@[td]) td.NestedTypes).AsList);
11031099
GenericParams= td.GenericParams;
11041100
Access= td.Access;
11051101
IsAbstract= isAbstract;
1106-
IsSealed=false;
1102+
IsSealed=altTypeDefs.IsEmpty;
11071103
IsSerializable=td.IsSerializable;
11081104
IsComInterop=false;
11091105
Layout=td.Layout;

‎tests/fsharp/core/array/test.fsx‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,6 +1419,37 @@ module bug872632 =
14191419

14201420
do check"bug872632" Foo.x.Length8
14211421

1422+
moduleCheckUnionTypesAreSealed=
1423+
openSystem
1424+
#if NetCore
1425+
openSystem.Reflection
1426+
typeSystem.Typewith
1427+
memberthis.IsSealed
1428+
with get()= this.GetTypeInfo().IsSealed
1429+
#endif
1430+
1431+
do check"vwllfewlkefw1"(typedefof<list<int>>.IsSealed)true
1432+
do check"vwllfewlkefw2"(typedefof<option<int>>.IsSealed)true
1433+
typeX1= A| B
1434+
do check"vwllfewlkefw3"(typedefof<X1>.IsSealed)true
1435+
typeX2= A| Bofstring
1436+
do check"vwllfewlkefw4"(typedefof<X2>.IsSealed)false
1437+
typeX3= A| B| C
1438+
do check"vwllfewlkefw5"(typedefof<X3>.IsSealed)true
1439+
typeX4= A| B| C| D| E| F| G| H| I
1440+
do check"vwllfewlkefw5"(typedefof<X4>.IsSealed)true
1441+
1442+
[<CompilationRepresentation(CompilationRepresentationFlags.UseNullAsTrueValue)>]
1443+
typeSetTree<'T>=
1444+
| SetEmpty
1445+
| SetNodeof'T*SetTree<'T>*SetTree<'T>
1446+
do check"vwllfewlkefw6"(typedefof<SetTree<int>>.IsSealed)true
1447+
1448+
typeSetTree2<'T>=
1449+
| SetEmpty
1450+
| SetNodeof'T*SetTree2<'T>*SetTree2<'T>
1451+
do check"vwllfewlkefw6"(typedefof<SetTree2<int>>.IsSealed)false
1452+
14221453
modulemanyIndexes=
14231454
openSystem
14241455

‎tests/fsharpqa/Source/CodeGen/EmittedIL/CCtorDUWithMember/cctorduwithmember01.il.netfx4.bsl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
extends [mscorlib]System.Object
103103
{
104104
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags)= (0100070000000000 )
105-
.class auto autochar serializable nested public beforefieldinit C
105+
.class auto autochar serializablesealednested public beforefieldinit C
106106
extends [mscorlib]System.Object
107107
implements class [mscorlib]System.IEquatable`1<class CCtorDUWithMember01a/C>,
108108
[mscorlib]System.Collections.IStructuralEquatable,

‎tests/fsharpqa/Source/CodeGen/EmittedIL/Misc/GeneralizationOnUnions01.il.bsl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
extends [mscorlib]System.Object
5252
{
5353
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags)= (0100070000000000 )
54-
.class auto autochar serializable nested public beforefieldinit Weirdo
54+
.class auto autochar serializablesealednested public beforefieldinit Weirdo
5555
extends [mscorlib]System.Object
5656
implements class [mscorlib]System.IEquatable`1<class GeneralizationOnUnions01/Weirdo>,
5757
[mscorlib]System.Collections.IStructuralEquatable,

‎tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/ToplevelModule.il.bsl‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
extends [mscorlib]System.Object
5252
{
5353
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags)= (0100070000000000 )
54-
.class auto autochar serializable nested public beforefieldinit Expr
54+
.class auto autochar serializablesealednested public beforefieldinit Expr
5555
extends [mscorlib]System.Object
5656
implements class [mscorlib]System.IEquatable`1<class ABC/Expr>,
5757
[mscorlib]System.Collections.IStructuralEquatable,
@@ -850,7 +850,7 @@
850850
extends [mscorlib]System.Object
851851
{
852852
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags)= (0100070000000000 )
853-
.class auto autochar serializable nested public beforefieldinit Expr
853+
.class auto autochar serializablesealednested public beforefieldinit Expr
854854
extends [mscorlib]System.Object
855855
implements class [mscorlib]System.IEquatable`1<class ABC/ABC/Expr>,
856856
[mscorlib]System.Collections.IStructuralEquatable,

‎tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/ToplevelModuleP.il.bsl‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
extends [mscorlib]System.Object
5252
{
5353
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags)= (0100070000000000 )
54-
.class auto autochar nested public beforefieldinit Expr
54+
.class auto autocharsealednested public beforefieldinit Expr
5555
extends [mscorlib]System.Object
5656
implements class [mscorlib]System.IEquatable`1<class ABC/Expr>,
5757
[mscorlib]System.Collections.IStructuralEquatable,
@@ -836,7 +836,7 @@
836836
extends [mscorlib]System.Object
837837
{
838838
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags)= (0100070000000000 )
839-
.class auto autochar nested public beforefieldinit Expr
839+
.class auto autocharsealednested public beforefieldinit Expr
840840
extends [mscorlib]System.Object
841841
implements class [mscorlib]System.IEquatable`1<class ABC/ABC/Expr>,
842842
[mscorlib]System.Collections.IStructuralEquatable,

‎tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/ToplevelNamespace.il.bsl‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
// =============== CLASS MEMBERS DECLARATION ===================
4949

50-
.class public auto autochar serializable beforefieldinit XYZ.Expr
50+
.class public auto autochar serializablesealedbeforefieldinit XYZ.Expr
5151
extends [mscorlib]System.Object
5252
implements class [mscorlib]System.IEquatable`1<class XYZ.Expr>,
5353
[mscorlib]System.Collections.IStructuralEquatable,
@@ -845,7 +845,7 @@
845845
extends [mscorlib]System.Object
846846
{
847847
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags)= (0100070000000000 )
848-
.class auto autochar serializable nested public beforefieldinit Expr
848+
.class auto autochar serializablesealednested public beforefieldinit Expr
849849
extends [mscorlib]System.Object
850850
implements class [mscorlib]System.IEquatable`1<class XYZ.ABC/Expr>,
851851
[mscorlib]System.Collections.IStructuralEquatable,
@@ -1643,7 +1643,7 @@
16431643
extends [mscorlib]System.Object
16441644
{
16451645
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags)= (0100070000000000 )
1646-
.class auto autochar serializable nested public beforefieldinit Expr
1646+
.class auto autochar serializablesealednested public beforefieldinit Expr
16471647
extends [mscorlib]System.Object
16481648
implements class [mscorlib]System.IEquatable`1<class XYZ.ABC/ABC/Expr>,
16491649
[mscorlib]System.Collections.IStructuralEquatable,

‎tests/fsharpqa/Source/CodeGen/EmittedIL/SerializableAttribute/ToplevelNamespaceP.il.bsl‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
// =============== CLASS MEMBERS DECLARATION ===================
4949

50-
.class public auto autochar beforefieldinit XYZ.Expr
50+
.class public auto autocharsealedbeforefieldinit XYZ.Expr
5151
extends [mscorlib]System.Object
5252
implements class [mscorlib]System.IEquatable`1<class XYZ.Expr>,
5353
[mscorlib]System.Collections.IStructuralEquatable,
@@ -831,7 +831,7 @@
831831
extends [mscorlib]System.Object
832832
{
833833
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags)= (0100070000000000 )
834-
.class auto autochar nested public beforefieldinit Expr
834+
.class auto autocharsealednested public beforefieldinit Expr
835835
extends [mscorlib]System.Object
836836
implements class [mscorlib]System.IEquatable`1<class XYZ.ABC/Expr>,
837837
[mscorlib]System.Collections.IStructuralEquatable,
@@ -1615,7 +1615,7 @@
16151615
extends [mscorlib]System.Object
16161616
{
16171617
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags)= (0100070000000000 )
1618-
.class auto autochar nested public beforefieldinit Expr
1618+
.class auto autocharsealednested public beforefieldinit Expr
16191619
extends [mscorlib]System.Object
16201620
implements class [mscorlib]System.IEquatable`1<class XYZ.ABC/ABC/Expr>,
16211621
[mscorlib]System.Collections.IStructuralEquatable,

‎tests/fsharpqa/Source/CodeGen/EmittedIL/SteppingMatch/steppingmatch06.il.netfx4.bsl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
extends [mscorlib]System.Object
5252
{
5353
.custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags)= (0100070000000000 )
54-
.class auto autochar serializable nested public beforefieldinit Discr
54+
.class auto autochar serializablesealednested public beforefieldinit Discr
5555
extends [mscorlib]System.Object
5656
implements class [mscorlib]System.IEquatable`1<class SteppingMatch06/Discr>,
5757
[mscorlib]System.Collections.IStructuralEquatable,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp