From a28c4c8662d6b241393dc1209be13e407490e0cb Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Tue, 19 Nov 2024 17:17:15 -0800 Subject: [PATCH 1/8] tests --- .gitignore | 4 +- DEVGUIDE.md | 27 + .../LexicalAnalysis/SymbolicOperators.fs | 40 +- .../IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs | 523 ++++++++----- .../ComputedCollections.fs | 27 +- .../ForXInArray_ToArray.fs.il.bsl | 10 - .../ForXInList_ToList.fs.il.bsl | 20 +- .../DoNotBoxStruct/DoNotBoxStruct.fs | 37 +- ...nList01.fs.RealInternalSignatureOff.il.bsl | 10 - ...OnList01.fs.RealInternalSignatureOn.il.bsl | 10 - ...tring01.fs.RealInternalSignatureOff.il.bsl | 10 - ...String01.fs.RealInternalSignatureOn.il.bsl | 10 - ...able01.fsx.RealInternalSignatureOff.il.bsl | 10 - ...rable01.fsx.RealInternalSignatureOn.il.bsl | 10 - ...able02.fsx.RealInternalSignatureOff.il.bsl | 10 - ...able03.fsx.RealInternalSignatureOff.il.bsl | 10 - ...rable03.fsx.RealInternalSignatureOn.il.bsl | 10 - ...InternalSignatureOn.fs.il.net472.debug.bsl | 704 +++++++---------- ...ternalSignatureOn.fs.il.net472.release.bsl | 728 ++++++++---------- .../ClassTypeInitialization.fs | 332 +++++++- .../TestFunction23.fs.il.net472.bsl | 31 +- .../EmittedIL/TestFunctions/TestFunctions.fs | 9 +- .../Signatures/SigGenerationRoundTripTests.fs | 16 +- .../E_LessThanDotOpenParen001.fs | 31 - tests/FSharp.Test.Utilities/XunitHelpers.fs | 6 +- 25 files changed, 1400 insertions(+), 1235 deletions(-) delete mode 100644 tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_LessThanDotOpenParen001.fs diff --git a/.gitignore b/.gitignore index f0dbae4d2f3..b8072b11e90 100644 --- a/.gitignore +++ b/.gitignore @@ -129,4 +129,6 @@ tests/FSharp.Compiler.Service.Tests/FSharp.CompilerService.SurfaceArea.netstanda /tests/AheadOfTime/Trimming/output.txt *.svclog micro.exe -positive.exe \ No newline at end of file +positive.exe +/tests/FSharp.Compiler.ComponentTests/FSharpChecker/StandardError.txt +/tests/FSharp.Compiler.ComponentTests/FSharpChecker/StandardOutput.txt diff --git a/DEVGUIDE.md b/DEVGUIDE.md index b3ed65611c4..2cf2e52fcc3 100644 --- a/DEVGUIDE.md +++ b/DEVGUIDE.md @@ -204,6 +204,33 @@ Linux/macOS: export TEST_UPDATE_BSL=1 ``` +## Retain Test run built artifacts + +When investigating tests issues it is sometimes usefull to examine the artifacts built whe running tests. Those built using the newer test framework are usually, +built in the %TEMP%\FSharp.Test.Utilities subdirectory. + +To tell the test framework to not cleanup these files use the: FSHARP_RETAIN_TESTBUILDS environment variable + +Windows: + +CMD: + +```shell +set FSHARP_RETAIN_TESTBUILDS=1 +``` + +PowerShell: + +```shell +$env:FSHARP_RETAIN_TESTBUILDS=1 +``` + +Linux/macOS: + +```shell +export FSHARP_RETAIN_TESTBUILDS=1 +``` + Next, run a build script build (debug or release, desktop or coreclr, depending which baselines you need to update), and test as described [above](#Testing-from-the-command-line). For example: `./Build.cmd -c Release -testCoreClr` to update Release CoreCLR baselines. diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/SymbolicOperators.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/SymbolicOperators.fs index 331086d940a..49951b50bc0 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/SymbolicOperators.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/SymbolicOperators.fs @@ -31,11 +31,43 @@ module SymbolicOperators = // This test was automatically generated (moved from FSharpQA suite - Conformance/LexicalAnalysis/SymbolicOperators) //This code is not sufficiently generic\. The type variable \^T when \^T : \(static member \( \+ \) : \^T \* \^T -> \^a\) could not be generalized because it would escape its scope - [] - let ``SymbolicOperators - E_LessThanDotOpenParen001_fs - --flaterrors`` compilation = - compilation - |> asFsx + [] // RealSig + [] // Regular + [] + let ``SymbolicOperators_E_LessThanDotOpenParen001_fs`` (realsig) = + Fsx """// #Regression #Conformance #LexicalAnalysis #Operators +// Regression test for FSHARP1.0:4805 +// We are not really after the actual error messages here (some of them have been omitted), rather we +// want to verify we do not crash! +//This construct causes code to be less generic than indicated by the type annotations\. The type variable 'S has been constrained to be type 'int' +//This code is not sufficiently generic\. The type variable \^T when \^T : \(static member \( \+ \) : \^T \* \^T -> \^a\) could not be generalized because it would escape its scope + +type public TestType<'T,'S>() = + + member public s.Value with get() = Unchecked.defaultof<'T> + static member public (+++) (a : TestType<'T,'S>, b : TestType<'T,'S>) = a.Value + static member public (+++) (a : TestType<'T,'S>, b : 'T) = b + static member public (+++) (a : 'T, b : TestType<'T,'S>) = a + static member public (+++) (a : TestType<'T,'S>, b : 'T -> 'S) = a.Value + static member public (+++) (a : 'S -> 'T, b : TestType<'T,'S>) = (a 17) + b.Value + +let inline (+++) (a : ^a) (b : ^b) = ((^a or ^b): (static member (+++): ^a * ^b -> ^c) (a,b) ) + +let tt0 = TestType() +let tt1 = TestType() + +let f (x : string) = 18 + +let a0 = tt0 +++ tt1 +let a1 = tt0 +++ 11 +let a2 = 12 +++ tt1 +let a3 = tt0 +++ (fun x -> "18") +let a4 = f +++ tt0 + +let a5 = TestType.(+++)(f, tt0) +let a6 = TestType.(+++)((fun (x : string) -> 18), tt0)""" |> withOptions ["--flaterrors"] + |> withRealInternalSignature realsig |> compile |> shouldFail |> withErrorCode 0670 diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs index 942219ba172..f22a18f26c9 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/Types/TypeConstraints/IWSAMsAndSRTPs/IWSAMsAndSRTPsTests.fs @@ -8,18 +8,20 @@ open FSharp.Test.Compiler module TypesAndTypeConstraints_IWSAMsAndSRTPs = - let typesModule = + let typesModule realsig = FSharp (loadSourceFromFile (Path.Combine(__SOURCE_DIRECTORY__, "Types.fs"))) |> withName "Types" |> withLangVersion70 + |> withRealInternalSignature realsig |> withOptions ["--nowarn:3535"] - let setupCompilation compilation = + let setupCompilation realsig compilation = compilation |> asExe |> withLangVersion70 - |> withReferences [typesModule] - + |> withRealInternalSignature realsig + |> withReferences [typesModule realsig] + let verifyCompile compilation = compilation |> asExe @@ -71,7 +73,7 @@ let main _ = #endif let ``IWSAM test files`` compilation = compilation - |> setupCompilation + |> setupCompilation false |> withLangVersionPreview |> compileAndRun |> shouldSucceed @@ -380,43 +382,57 @@ let main _ = |> withDiagnosticMessage errorMessage |> ignore - [] - let ``IWSAM warning`` () = - Fsx "let fExpectAWarning(x: Types.ISinOperator<'T>) = ()" - |> withReferences [typesModule] + [] // RealSig + [] // Regular + [] + let ``IWSAM warning`` (realsig) = + Fsx "let fExpectAWarning(x: Types.ISinOperator<'T>) = (realsig)" + |> withReferences [typesModule realsig] + |> withRealInternalSignature realsig |> compile |> shouldFail |> withWarningCode 3536 |> withDiagnosticMessage """'ISinOperator<_>' is normally used as a type constraint in generic code, e.g. "'T when ISomeInterface<'T>" or "let f (x: #ISomeInterface<_>)". See https://aka.ms/fsharp-iwsams for guidance. You can disable this warning by using '#nowarn "3536"' or '--nowarn:3536'.""" |> ignore - [] - let ``Multiple support types trait error`` () = + [] // RealSig + [] // Regular + [] + let ``Multiple support types trait error`` (realsig) = Fsx "let inline f5 (x: 'T when ('T or int) : (static member A: int) ) = 'T.A" + |> withRealInternalSignature realsig |> compile |> shouldFail |> withErrorCode 3537 |> withDiagnosticMessage "The trait 'A' invoked by this call has multiple support types. This invocation syntax is not permitted for such traits. See https://aka.ms/fsharp-srtp for guidance." |> ignore - [] - let ``SRTP Delegate conversion not supported`` () = + [] // RealSig + [] // Regular + [] + let ``SRTP Delegate conversion not supported`` (realsig) = Fsx "let inline f_TraitWithDelegate<'T when 'T : (static member StaticMethod: x: System.Func -> int) >() = 'T.StaticMethod(fun x -> x + 1)" + |> withRealInternalSignature realsig |> compile |> shouldFail |> withErrorMessage "This function takes too many arguments, or is used in a context where a function is not expected" - [] - let ``SRTP Expression conversion not supported`` () = + [] // RealSig + [] // Regular + [] + let ``SRTP Expression conversion not supported`` (realsig) = Fsx "let inline f_TraitWithExpression<'T when 'T : (static member StaticMethod: x: System.Linq.Expressions.Expression> -> int) >() = 'T.StaticMethod(fun x -> x + 1)" + |> withRealInternalSignature realsig |> compile |> shouldFail |> withErrorMessage "This function takes too many arguments, or is used in a context where a function is not expected" - [] - let ``IWSAM Delegate conversion works`` () = + [] // RealSig + [] // Regular + [] + let ``IWSAM Delegate conversion works`` (realsig) = Fsx """ open Types @@ -428,12 +444,14 @@ let main _ = failwith "Unexpected result" """ - |> setupCompilation + |> setupCompilation realsig |> compileAndRun |> shouldSucceed - [] - let ``IWSAM Expression conversion works`` () = + [] // RealSig + [] // Regular + [] + let ``IWSAM Expression conversion works`` (realsig) = Fsx """ open Types @@ -445,28 +463,36 @@ let main _ = failwith "Unexpected result" """ - |> setupCompilation + |> setupCompilation realsig |> compileAndRun |> shouldSucceed - [] - let ``SRTP Byref can be passed with old syntax`` () = + [] // RealSig + [] // Regular + [] + let ``SRTP Byref can be passed with old syntax`` (realsig) = Fsx "let inline f_TraitWithByref<'T when 'T : ( static member TryParse: string * byref -> bool) >() = let mutable result = 0 (^T : ( static member TryParse: x: string * byref -> bool) (\"42\", &result))" + |> withRealInternalSignature realsig |> compile |> shouldSucceed - [] - let ``SRTP Byref can be passed with new syntax`` () = + [] // RealSig + [] // Regular + [] + let ``SRTP Byref can be passed with new syntax`` (realsig) = Fsx "let inline f_TraitWithByref<'T when 'T : ( static member TryParse: string * byref -> bool) >() = let mutable result = 0 'T.TryParse(\"42\", &result)" + |> withRealInternalSignature realsig |> compile |> shouldSucceed - [] - let ``Call with old syntax`` () = + [] // RealSig + [] // Regular + [] + let ``Call with old syntax`` (realsig) = Fsx """ type C1() = static member X(p: C1 byref) = p @@ -479,11 +505,14 @@ let main _ = if g1 <> c1 then failwith "Unexpected result" """ + |> withRealInternalSignature realsig |> compileExeAndRun |> shouldSucceed - [] - let ``Call with new syntax`` () = + [] // RealSig + [] // Regular + [] + let ``Call with new syntax`` (realsig) = Fsx """ type C2() = static member X(p: C2 byref) = p @@ -495,11 +524,14 @@ let main _ = if g2 <> c2 then failwith "Unexpected result" """ + |> withRealInternalSignature realsig |> compileExeAndRun |> shouldSucceed - [] - let ``Call with tuple`` () = + [] // RealSig + [] // Regular + [] + let ``Call with tuple`` (realsig) = Fsx """ type C3() = @@ -512,11 +544,14 @@ let main _ = if g3 <> c3 then failwith "Unexpected result" """ + |> withRealInternalSignature realsig |> compileExeAndRun |> shouldSucceed - [] - let test4 () = + [] // RealSig + [] // Regular + [] + let test4 (realsig) = Fsx """ type C4() = static member X() = C4() @@ -527,14 +562,17 @@ let main _ = if g4.GetType() <> typeof then failwith "Unexpected result" """ + |> withRealInternalSignature realsig |> compileExeAndRun |> shouldSucceed // NOTE: Trait constraints that involve byref returns currently can never be satisfied by any method. No other warning is given. // This is a bug that may be fixed in the future. // These tests are pinning down current behavior. - [] - let ``Byref returns not allowed`` () = + [] // RealSig + [] // Regular + [] + let ``Byref returns not allowed`` (realsig) = Fsx """ type C5() = static member X(p: C5 byref) = &p @@ -543,12 +581,15 @@ let main _ = let mutable c5 = C5() let g5 () = callX5 &c5 """ + |> withRealInternalSignature realsig |> compile |> shouldFail |> withDiagnosticMessageMatches "This expression was expected to have type\\s+'byref'\\s+but here has type\\s+'C5'" - [] - let ``Byref returns not allowed pt 2`` () = + [] // RealSig + [] // Regular + [] + let ``Byref returns not allowed pt 2`` (realsig) = Fsx """ type C6() = static member X(p: C6 byref) = &p @@ -558,11 +599,12 @@ let main _ = let mutable c6 = C6() let g6 () = callX6 &c6 """ + |> withRealInternalSignature realsig |> compile |> shouldFail |> withDiagnosticMessageMatches "This expression was expected to have type\\s+'byref'\\s+but here has type\\s+'C6'" - let library = + let library realsig= FSharp """ module Lib @@ -580,65 +622,79 @@ let main _ = let add1 (x: int) = x + 1 """ + |> withRealInternalSignature realsig |> withLangVersion70 |> withOptions ["--nowarn:3535"] - [] - let ``Function implicit conversion not supported on constrained type`` () = + [] // RealSig + [] // Regular + [] + let ``Function implicit conversion not supported on constrained type`` (realsig) = Fsx """ open Lib let f_function_implicit_conversion<'T when ICanBeInt<'T>>(a: 'T) : int = add1(a) """ - |> withReferences [library] + |> withReferences [library realsig] |> withLangVersion70 + |> withRealInternalSignature realsig |> compile |> shouldFail |> withDiagnosticMessageMatches "This expression was expected to have type\\s+'int'\\s+but here has type\\s+''T'" - [] - let ``Method implicit conversion not supported on constrained type`` () = + [] // RealSig + [] // Regular + [] + let ``Method implicit conversion not supported on constrained type`` (realsig) = Fsx """ open Lib let f_method_implicit_conversion<'T when ICanBeInt<'T>>(a: 'T) : int = C.TakeInt(a) """ - |> withReferences [library] + |> withRealInternalSignature realsig + |> withReferences [library realsig] |> withLangVersion70 |> compile |> shouldFail |> withDiagnosticMessageMatches "This expression was expected to have type\\s+'int'\\s+but here has type\\s+''T'" - [] - let ``Function explicit conversion works on constrained type`` () = + [] // RealSig + [] // Regular + [] + let ``Function explicit conversion works on constrained type`` (realsig) = Fsx """ open Lib let f_function_explicit_conversion<'T when ICanBeInt<'T>>(a: 'T) : int = add1(int(a)) """ - |> withReferences [library] + |> withReferences [library realsig] |> withLangVersion70 |> compile |> shouldSucceed - [] - let ``Method explicit conversion works on constrained type`` () = + [] // RealSig + [] // Regular + [] + let ``Method explicit conversion works on constrained type`` (realsig) = Fsx """ open Lib let f_method_explicit_conversion<'T when ICanBeInt<'T>>(a: 'T) : int = C.TakeInt(int(a)) """ - |> withReferences [library] + |> withRealInternalSignature realsig + |> withReferences [library realsig] |> withLangVersion70 |> compile |> shouldSucceed - [] - let ``Nominal type can be used after or`` () = + [] // RealSig + [] // Regular + [] + let ``Nominal type can be used after or`` (realsig) = Fsx """ type C() = @@ -652,13 +708,16 @@ let main _ = if not (callX "A" (C()) = "A OK") then failwith "Unexpected result" """ + |> withRealInternalSignature realsig |> withLangVersion70 |> asExe |> compileAndRun |> shouldSucceed - [] - let ``Nominal type can't be used before or`` () = + [] // RealSig + [] // Regular + [] + let ``Nominal type can't be used before or`` (realsig) = Fsx """ type C() = @@ -666,13 +725,16 @@ let main _ = let inline callX (x: 'T) (y: C) = ((C or ^T): (static member X : 'T * C -> string) (x, y));; """ + |> withRealInternalSignature realsig |> withLangVersion70 |> compile |> shouldFail |> withDiagnosticMessageMatches "Unexpected keyword 'static' in binding" - [] - let ``Nominal type is preferred`` () = + [] // RealSig + [] // Regular + [] + let ``Nominal type is preferred`` (realsig) = Fsx """ type C() = @@ -691,12 +753,13 @@ let main _ = if not (callX2 (C()) (D()) = "C") then failwith "Unexpected result" """ + |> withRealInternalSignature realsig |> withLangVersion70 |> asExe |> compileAndRun |> shouldSucceed - let library2 = + let library2 realsig = FSharp """ module Potato.Lib type IPotato<'T when 'T :> IPotato<'T>> = @@ -713,12 +776,15 @@ let main _ = static member IsGood c = false static member op_Equality (a, b) = false """ + |> withRealInternalSignature realsig |> withLangVersion70 |> withName "Potato" |> withOptions ["--nowarn:3535"] - [] - let ``Active patterns- Using IWSAM in active pattern`` () = + [] // RealSig + [] // Regular + [] + let ``Active patterns- Using IWSAM in active pattern`` (realsig) = FSharp """ module Potato.Test @@ -729,7 +795,8 @@ let main _ = match Potato() with GoodPotato -> () | _ -> failwith "Unexpected result" match Rock() with GoodPotato -> failwith "Unexpected result" | _ -> () """ - |> withReferences [library2] + |> withReferences [library2 realsig] + |> withRealInternalSignature realsig |> withLangVersion70 |> compileExeAndRun |> shouldSucceed @@ -746,8 +813,10 @@ let main _ = """ ] - [] - let ``Active patterns - Using IWSAM equality in active pattern uses generic equality intrinsic`` () = + [] // RealSig + [] // Regular + [] + let ``Active patterns - Using IWSAM equality in active pattern uses generic equality intrinsic`` (realsig) = FSharp """ module Potato.Test @@ -762,7 +831,8 @@ let main _ = | IsEqual -> failwith "Unexpected result" | IsNonEqual -> () """ - |> withReferences [library2] + |> withReferences [library2 realsig] + |> withRealInternalSignature realsig |> withLangVersion70 |> asExe |> compileAndRun @@ -780,12 +850,15 @@ let main _ = """ ] - [] - let ``Suppression of System Numerics interfaces on unitized types`` () = + [] // RealSig + [] // Regular + [] + let ``Suppression of System Numerics interfaces on unitized types`` (realsig) = Fsx """ open System.Numerics let f (x: 'T when 'T :> IMultiplyOperators<'T,'T,'T>) = x;; f 3.0 |> ignore""" + |> withRealInternalSignature realsig |> withLangVersion70 |> compile |> shouldSucceed @@ -840,8 +913,10 @@ let main _ = |> shouldFail |> withErrorMessage $"The type 'float' is not compatible with the type '{potatoType}'" - [] - let ``Interface A with static abstracts can be inherited in interface B and then implemented in type C which inherits B in lang version70`` () = + [] // RealSig + [] // Regular + [] + let ``Interface A with static abstracts can be inherited in interface B and then implemented in type C which inherits B in lang version70`` (realsig) = Fsx """ type IParsable<'T when 'T :> IParsable<'T>> = static abstract member Parse : string -> 'T @@ -863,12 +938,15 @@ let main _ = failwith "failed" """ |> withNoWarn 3535 + |> withRealInternalSignature realsig |> withLangVersion70 |> compile |> shouldSucceed - [] - let ``Static abstracts can be inherited through multiple levels in lang version70`` () = + [] // RealSig + [] // Regular + [] + let ``Static abstracts can be inherited through multiple levels in lang version70`` (realsig) = Fsx """ type IParsable<'T when 'T :> IParsable<'T>> = static abstract member Parse : string -> 'T @@ -902,12 +980,15 @@ let main _ = failwith "failed" """ |> withNoWarn 3535 + |> withRealInternalSignature realsig |> withLangVersion70 |> compile |> shouldSucceed - [] - let ``Static abstracts from BCL can be inherited through multiple levels in lang version70`` () = + [] // RealSig + [] // Regular + [] + let ``Static abstracts from BCL can be inherited through multiple levels in lang version70`` (realsig) = Fsx """ open System open System.Globalization @@ -927,12 +1008,15 @@ let main _ = failwith "failed" """ |> withNoWarn 3535 + |> withRealInternalSignature realsig |> withLangVersion70 |> compile |> shouldSucceed - - [] - let ``Produce an error when one leaves out keyword "static" in an implementation of IWSAM`` () = + + [] // RealSig + [] // Regular + [] + let ``Produce an error when one leaves out keyword "static" in an implementation of IWSAM`` (realsig) = Fsx """ module StaticAbstractBug = type IOperation = @@ -951,19 +1035,22 @@ module StaticAbstractBug = member this.Property3 = 0 member this.Property3 with set value = () """ - |> withOptions [ "--nowarn:3535" ] - |> withLangVersion80 - |> compile - |> shouldFail - |> withDiagnostics [ + |> withOptions [ "--nowarn:3535" ] + |> withRealInternalSignature realsig + |> withLangVersion80 + |> compile + |> shouldFail + |> withDiagnostics [ (Error 855, Line 12, Col 22, Line 12, Col 29, "No abstract or interface member was found that corresponds to this override") (Error 859, Line 14, Col 25, Line 14, Col 33, "No abstract property was found that corresponds to this override") (Error 859, Line 16, Col 25, Line 16, Col 34, "No abstract property was found that corresponds to this override") (Error 859, Line 17, Col 25, Line 17, Col 34, "No abstract property was found that corresponds to this override") - ] - - [] - let ``Produce an error when one leaves out keyword "static" in an implementation of IWSAM with multiple overloads`` () = + ] + + [] // RealSig + [] // Regular + [] + let ``Produce an error when one leaves out keyword "static" in an implementation of IWSAM with multiple overloads`` (realsig) = Fsx """ module StaticAbstractBug = type IOperation = @@ -979,11 +1066,12 @@ module StaticAbstractBug = member this.Property = 0 member this.Property = false """ - |> withOptions [ "--nowarn:3535" ] - |> withLangVersion80 - |> compile - |> shouldFail - |> withDiagnostics [ + |> withOptions [ "--nowarn:3535" ] + |> withRealInternalSignature realsig + |> withLangVersion80 + |> compile + |> shouldFail + |> withDiagnostics [ (Error 1, Line 11, Col 34, Line 11, Col 36, "This expression was expected to have type 'bool' but here has type @@ -992,10 +1080,12 @@ but here has type 'int' but here has type 'bool' ") - ] - - [] - let ``Produce an error for interface with static abstract member that is implemented as instance member`` () = + ] + + [] // RealSig + [] // Regular + [] + let ``Produce an error for interface with static abstract member that is implemented as instance member`` (realsig) = Fsx """ module StaticAbstractBug = type IFoo<'T> = @@ -1015,19 +1105,22 @@ module StaticAbstractBug = member this.Property3 = 0 member this.Property3 with set value = () """ - |> withOptions [ "--nowarn:3535" ] - |> withLangVersion80 - |> compile - |> shouldFail - |> withDiagnostics [ + |> withOptions [ "--nowarn:3535" ] + |> withRealInternalSignature realsig + |> withLangVersion80 + |> compile + |> shouldFail + |> withDiagnostics [ (Error 855, Line 14, Col 18, Line 14, Col 23, "No abstract or interface member was found that corresponds to this override"); (Error 859, Line 15, Col 21, Line 15, Col 29, "No abstract property was found that corresponds to this override"); (Error 859, Line 17, Col 21, Line 17, Col 30, "No abstract property was found that corresponds to this override"); (Error 859, Line 18, Col 21, Line 18, Col 30, "No abstract property was found that corresponds to this override") - ] + ] - [] - let ``Produce an error for interface with static abstract member that is implemented as instance member with multiple overloads`` () = + [] // RealSig + [] // Regular + [] + let ``Produce an error for interface with static abstract member that is implemented as instance member with multiple overloads`` (realsig) = Fsx """ module StaticAbstractBug = type IFoo<'T> = @@ -1046,11 +1139,12 @@ module StaticAbstractBug = member this.Property = 0 member this.Property = false """ - |> withOptions [ "--nowarn:3535" ] - |> withLangVersion80 - |> compile - |> shouldFail - |> withDiagnostics [ + |> withOptions [ "--nowarn:3535" ] + |> withRealInternalSignature realsig + |> withLangVersion80 + |> compile + |> shouldFail + |> withDiagnostics [ (Error 1, Line 14, Col 41, Line 14, Col 42, "The type 'bool' does not match the type 'int'") (Error 1, Line 16, Col 32, Line 16, Col 33, "This expression was expected to have type 'bool' @@ -1058,8 +1152,10 @@ but here has type 'int' ") ] - [] - let ``Produce an error when one leaves out keyword "static" in multiple IWSAM implementations`` () = + [] // RealSig + [] // Regular + [] + let ``Produce an error when one leaves out keyword "static" in multiple IWSAM implementations`` (realsig) = Fsx """ module StaticAbstractBug = type IOperation = @@ -1079,17 +1175,20 @@ module StaticAbstractBug = member this.Execute() = 0 member this.Execute2() = () """ - |> withOptions [ "--nowarn:3535" ] - |> withLangVersion80 - |> compile - |> shouldFail - |> withDiagnostics [ + |> withOptions [ "--nowarn:3535" ] + |> withLangVersion80 + |> withRealInternalSignature realsig + |> compile + |> shouldFail + |> withDiagnostics [ (Error 855, Line 13, Col 25, Line 13, Col 32, "No abstract or interface member was found that corresponds to this override") (Error 855, Line 17, Col 25, Line 17, Col 32, "No abstract or interface member was found that corresponds to this override") - ] + ] - [] - let ``Produces errors when includes keyword "static" when implementing a generic interface in a type`` () = + [] // RealSig + [] // Regular + [] + let ``Produces errors when includes keyword "static" when implementing a generic interface in a type`` (realsig) = Fsx """ module StaticAbstractBug = type IFoo<'T> = @@ -1109,21 +1208,24 @@ module StaticAbstractBug = static member Property3 = 0 static member Property3 with set value = () """ - |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] - |> withLangVersion80 - |> typecheck - |> shouldFail - |> withDiagnostics [ + |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] + |> withRealInternalSignature realsig + |> withLangVersion80 + |> typecheck + |> shouldFail + |> withDiagnostics [ (Error 3855, Line 13, Col 23, Line 13, Col 27, "No static abstract member was found that corresponds to this override") (Error 3855, Line 14, Col 23, Line 14, Col 28, "No static abstract member was found that corresponds to this override") (Error 3859, Line 15, Col 23, Line 15, Col 31, "No static abstract property was found that corresponds to this override") (Error 3859, Line 16, Col 23, Line 16, Col 32, "No static abstract property was found that corresponds to this override") (Error 3859, Line 17, Col 23, Line 17, Col 32, "No static abstract property was found that corresponds to this override") (Error 3859, Line 18, Col 23, Line 18, Col 32, "No static abstract property was found that corresponds to this override") - ] - - [] - let ``Produces errors when includes keyword "static" when implementing an interface in a type`` () = + ] + + [] // RealSig + [] // Regular + [] + let ``Produces errors when includes keyword "static" when implementing an interface in a type`` (realsig) = Fsx """ module StaticAbstractBug = type IOperation = @@ -1139,19 +1241,22 @@ module StaticAbstractBug = static member Property = 0 static member Property = false """ - |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] - |> withLangVersion80 - |> typecheck - |> shouldFail - |> withDiagnostics [ + |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] + |> withRealInternalSignature realsig + |> withLangVersion80 + |> typecheck + |> shouldFail + |> withDiagnostics [ (Error 3855, Line 11, Col 27, Line 11, Col 34, "No static abstract member was found that corresponds to this override") (Error 3855, Line 12, Col 27, Line 12, Col 34, "No static abstract member was found that corresponds to this override") (Error 3859, Line 13, Col 27, Line 13, Col 35, "No static abstract property was found that corresponds to this override") (Error 3859, Line 14, Col 27, Line 14, Col 35, "No static abstract property was found that corresponds to this override") - ] - - [] - let ``No error when implementing interfaces with static members by using class types`` () = + ] + + [] // RealSig + [] // Regular + [] + let ``No error when implementing interfaces with static members by using class types`` (realsig) = Fsx """ type IPrintable = abstract member Print: unit -> unit @@ -1170,13 +1275,16 @@ let someClass1 = SomeClass1(1, 2.0) someClass.Print() someClass1.GetPrint() """ - |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] - |> withLangVersion80 - |> typecheck - |> shouldSucceed - - [] - let ``No error when implementing interfaces with static members and IWSAM by using class types`` () = + |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] + |> withRealInternalSignature realsig + |> withLangVersion80 + |> typecheck + |> shouldSucceed + + [] // RealSig + [] // Regular + [] + let ``No error when implementing interfaces with static members and IWSAM by using class types`` (realsig) = Fsx """ [] type IPrintable = @@ -1190,39 +1298,46 @@ type SomeClass1() = let someClass1 = SomeClass1() let execute = IPrintable.Say("hello") """ - |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] - |> withLangVersion80 - |> typecheck - |> shouldSucceed + |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] + |> withRealInternalSignature realsig + |> withLangVersion80 + |> typecheck + |> shouldSucceed - [] - let ``Accessing to IWSAM(System.Numerics non virtual) produces a compilation error`` () = + [] // RealSig + [] // Regular + [] + let ``Accessing to IWSAM(System.Numerics non virtual) produces a compilation error`` (realsig) = Fsx """ open System.Numerics IAdditionOperators.op_Addition (3, 6) - """ - |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] - |> withLangVersion80 - |> compile - |> shouldFail - |> withSingleDiagnostic (Error 3866, Line 4, Col 1, Line 4, Col 38, "A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.op_Addition).") - - [] - let ``Accessing to IWSAM(System.Numerics virtual member) compiles and runs`` () = + """ + |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] + |> withRealInternalSignature realsig + |> withLangVersion80 + |> compile + |> shouldFail + |> withSingleDiagnostic (Error 3866, Line 4, Col 1, Line 4, Col 38, "A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.op_Addition).") + + [] // RealSig + [] // Regular + [] + let ``Accessing to IWSAM(System.Numerics virtual member) compiles and runs`` (realsig) = Fsx """ open System.Numerics let res = IAdditionOperators.op_CheckedAddition (3, 6) printf "%A" res""" - |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] - |> withLangVersion80 - |> asExe - |> compile - |> shouldSucceed - |> run - |> verifyOutput "9" + |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] + |> withRealInternalSignature realsig + |> withLangVersion80 + |> asExe + |> compile + |> shouldSucceed + |> run + |> verifyOutput "9" #if !NETCOREAPP [] @@ -1241,35 +1356,43 @@ printf "%A" res""" (Error 3866, Line 15, Col 82, Line 15, Col 129, "A static abstract non-virtual interface member should only be called via type parameter (for example: 'T.Parse).") ] - [] - let ``Error message that explicitly disallows static abstract methods in abstract classes.`` () = + [] // RealSig + [] // Regular + [] + let ``Error message that explicitly disallows static abstract methods in abstract classes.`` (realsig) = Fsx """ [] type A () = static abstract M : unit -> unit """ |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] + |> withRealInternalSignature realsig |> typecheck |> shouldFail |> withDiagnostics [ (Error 3867, Line 4, Col 21, Line 4, Col 22, "Classes cannot contain static abstract members.") ] - [] - let ``Error message that explicitly disallows static abstract methods in classes.`` () = + [] // RealSig + [] // Regular + [] + let ``Error message that explicitly disallows static abstract methods in classes.`` (realsig) = Fsx """ type A () = static abstract M : unit -> unit """ |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] + |> withRealInternalSignature realsig |> typecheck |> shouldFail |> withDiagnostics [ (Error 3867, Line 3, Col 21, Line 3, Col 22, "Classes cannot contain static abstract members.") ] - - [] - let ``Access modifiers cannot be applied to an SRTP constraint in preview`` () = + + [] // RealSig + [] // Regular + [] + let ``Access modifiers cannot be applied to an SRTP constraint in preview`` (realsig) = FSharp """ let inline length (x: ^a when ^a: (member public Length: int)) = x.Length let inline length2 (x: ^a when ^a: (member Length: int with public get)) = x.Length @@ -1277,6 +1400,7 @@ let inline length3 (x: ^a when ^a: (member Length: int with public set)) = x.set let inline length4 (x: ^a when ^a: (member public get_Length: unit -> int)) = x.get_Length() """ |> withLangVersionPreview + |> withRealInternalSignature realsig |> typecheck |> shouldFail |> withDiagnostics [ @@ -1285,9 +1409,11 @@ let inline length4 (x: ^a when ^a: (member public get_Length: unit -> int)) = x. (Error 3871, Line 4, Col 61, Line 4, Col 67, "Access modifiers cannot be applied to an SRTP constraint.") (Error 3871, Line 5, Col 44, Line 5, Col 50, "Access modifiers cannot be applied to an SRTP constraint.") ] - - [] - let ``Access modifiers in an SRTP constraint generate warning in F# 8.0`` () = + + [] // RealSig + [] // Regular + [] + let ``Access modifiers in an SRTP constraint generate warning in F# 8.0`` (realsig) = FSharp """ let inline length (x: ^a when ^a: (member public Length: int)) = x.Length let inline length2 (x: ^a when ^a: (member Length: int with public get)) = x.Length @@ -1295,6 +1421,7 @@ let inline length3 (x: ^a when ^a: (member Length: int with public set)) = x.set let inline length4 (x: ^a when ^a: (member public get_Length: unit -> int)) = x.get_Length() """ |> withLangVersion80 + |> withRealInternalSignature realsig |> typecheck |> shouldFail |> withDiagnostics [ @@ -1304,8 +1431,10 @@ let inline length4 (x: ^a when ^a: (member public get_Length: unit -> int)) = x. (Warning 3871, Line 5, Col 44, Line 5, Col 50, "Access modifiers cannot be applied to an SRTP constraint.") ] - [] - let ``Error for partial implementation of interface with static abstract members`` () = + [] // RealSig + [] // Regular + [] + let ``Error for partial implementation of interface with static abstract members`` (realsig) = Fsx """ type IFace = static abstract P1 : int @@ -1317,14 +1446,17 @@ type T = """ |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] + |> withRealInternalSignature realsig |> typecheck |> shouldFail |> withDiagnostics [ (Error 366, Line 7, Col 15, Line 7, Col 20, "No implementation was given for 'static abstract IFace.P2: int'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") ] - - [] - let ``Error for no implementation of interface with static abstract members`` () = + + [] // RealSig + [] // Regular + [] + let ``Error for no implementation of interface with static abstract members`` (realsig) = Fsx """ type IFace = static abstract P1 : int @@ -1334,6 +1466,7 @@ type T = interface IFace with """ |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] + |> withRealInternalSignature realsig |> typecheck |> shouldFail |> withDiagnostics [ @@ -1343,8 +1476,10 @@ type T = Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") ] - [] - let ``Error for partial implementation of interface with static and non static abstract members`` () = + [] // RealSig + [] // Regular + [] + let ``Error for partial implementation of interface with static and non static abstract members`` (realsig) = Fsx """ type IFace = static abstract P1 : int @@ -1359,6 +1494,7 @@ type T = """ |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] + |> withRealInternalSignature realsig |> typecheck |> shouldFail |> withDiagnostics [ @@ -1367,9 +1503,11 @@ type T = 'abstract IFace.P4: int' Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") ] - - [] - let ``Error for no implementation of interface with static and non static abstract members`` () = + + [] // RealSig + [] // Regular + [] + let ``Error for no implementation of interface with static and non static abstract members`` (realsig) = Fsx """ type IFace = static abstract P1 : int @@ -1379,9 +1517,10 @@ type IFace = type T = interface IFace with - + """ |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] + |> withRealInternalSignature realsig |> typecheck |> shouldFail |> withDiagnostics [ @@ -1393,8 +1532,10 @@ type T = Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") ] - [] - let ``Error for partial implementation of interface with non static abstract members`` () = + [] // RealSig + [] // Regular + [] + let ``Error for partial implementation of interface with non static abstract members`` (realsig) = Fsx """ type IFace = abstract member P3 : int @@ -1403,17 +1544,20 @@ type IFace = type T = interface IFace with member this.P3 = 3 - + """ |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] + |> withRealInternalSignature realsig |> typecheck |> shouldFail |> withDiagnostics [ (Error 366, Line 7, Col 15, Line 7, Col 20, "No implementation was given for 'abstract IFace.P4: int'. Note that all interface members must be implemented and listed under an appropriate 'interface' declaration, e.g. 'interface ... with member ...'.") ] - - [] - let ``Error for no implementation of interface with non static abstract members`` () = + + [] // RealSig + [] // Regular + [] + let ``Error for no implementation of interface with non static abstract members`` (realsig) = Fsx """ type IFace = abstract member P3 : int @@ -1424,6 +1568,7 @@ type T = """ |> withOptions [ "--nowarn:3536" ; "--nowarn:3535" ] + |> withRealInternalSignature realsig |> typecheck |> shouldFail |> withDiagnostics [ diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ComputedCollections.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ComputedCollections.fs index 6b4788a5103..53ef5aa0054 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ComputedCollections.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ComputedCollections.fs @@ -5,9 +5,10 @@ open FSharp.Test.Compiler open Xunit module ComputedCollections = - let verifyCompilation compilation = + let verifyCompilation realsig compilation = compilation |> asExe + |> withRealInternalSignature realsig |> withOptimize |> withEmbeddedPdb |> withEmbedAllSource @@ -17,59 +18,59 @@ module ComputedCollections = [] let ``Int32RangeArrays_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false [] let ``Int32RangeLists_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false [] let ``UInt64RangeArrays_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false [] let ``UInt64RangeLists_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false [] let ``ForNInRangeArrays_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false [] let ``ForNInRangeLists_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false [] let ``ForXInArray_ToArray_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false [] let ``ForXInArray_ToList_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false [] let ``ForXInList_ToArray_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false [] let ``ForXInList_ToList_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false [] let ``ForXInSeq_ToArray_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false [] let ``ForXInSeq_ToList_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInArray_ToArray.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInArray_ToArray.fs.il.bsl index 2e1eeb67e45..802df7abe52 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInArray_ToArray.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInArray_ToArray.fs.il.bsl @@ -16,16 +16,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureCompressedData.assembly -{ - - -} -.mresource public FSharpOptimizationCompressedData.assembly -{ - - } .module assembly.exe diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInList_ToList.fs.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInList_ToList.fs.il.bsl index 32f34802bd5..1c4d00cee7e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInList_ToList.fs.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ComputedCollections/ForXInList_ToList.fs.il.bsl @@ -16,16 +16,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureCompressedData.assembly -{ - - -} -.mresource public FSharpOptimizationCompressedData.assembly -{ - - } .module assembly.exe @@ -1284,7 +1274,7 @@ IL_0001: ldsfld class assembly/'for _ in List-groupBy id -- do ---@28' assembly/'for _ in List-groupBy id -- do ---@28'::@_instance IL_0006: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() IL_000b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>> [FSharp.Core]Microsoft.FSharp.Collections.ListModule::GroupBy(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) IL_0010: stloc.1 IL_0011: ldloc.1 IL_0012: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::get_TailOrNull() @@ -1323,7 +1313,7 @@ IL_0001: ldsfld class assembly/'for _ | _ in List-groupBy id -- do ---@29' assembly/'for _ | _ in List-groupBy id -- do ---@29'::@_instance IL_0006: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() IL_000b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>> [FSharp.Core]Microsoft.FSharp.Collections.ListModule::GroupBy(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) IL_0010: stloc.1 IL_0011: ldloc.1 IL_0012: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::get_TailOrNull() @@ -1362,7 +1352,7 @@ IL_0001: ldsfld class assembly/'for _ - _ in List-groupBy id -- do ---@30' assembly/'for _ - _ in List-groupBy id -- do ---@30'::@_instance IL_0006: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() IL_000b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>> [FSharp.Core]Microsoft.FSharp.Collections.ListModule::GroupBy(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) IL_0010: stloc.1 IL_0011: ldloc.1 IL_0012: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::get_TailOrNull() @@ -1401,7 +1391,7 @@ IL_0001: ldsfld class assembly/'for _, _group in List-groupBy id -- do ---@31' assembly/'for _, _group in List-groupBy id -- do ---@31'::@_instance IL_0006: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() IL_000b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>> [FSharp.Core]Microsoft.FSharp.Collections.ListModule::GroupBy(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) IL_0010: stloc.1 IL_0011: ldloc.1 IL_0012: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::get_TailOrNull() @@ -1441,7 +1431,7 @@ IL_0001: ldsfld class assembly/'for _, group in List-groupBy id -- do ---@32' assembly/'for _, group in List-groupBy id -- do ---@32'::@_instance IL_0006: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1::get_Empty() IL_000b: call class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>> [FSharp.Core]Microsoft.FSharp.Collections.ListModule::GroupBy(class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2, - class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) + class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1) IL_0010: stloc.1 IL_0011: ldloc.1 IL_0012: call instance class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1 class [FSharp.Core]Microsoft.FSharp.Collections.FSharpList`1>>::get_TailOrNull() diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct.fs index 883490978dc..d6aea77a5e2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/DoNotBoxStruct/DoNotBoxStruct.fs @@ -7,13 +7,16 @@ open FSharp.Test.Compiler module DoNotBoxStruct = - let computationExprLibrary = - FsxFromPath (Path.Combine(__SOURCE_DIRECTORY__, "DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth.fs")) - |> withName "DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth_fs" + let verifyCompilation realsig compilation = + + let computationExprLibrary = + FsxFromPath (Path.Combine(__SOURCE_DIRECTORY__, "DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth.fs")) + |> withRealInternalSignature realsig + |> withName "DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth_fs" - let verifyCompilation compilation = compilation |> asFs + |> withRealInternalSignature realsig |> withOptions ["--test:EmitFeeFeeAs100001"] |> asExe |> withReferences [computationExprLibrary] @@ -27,76 +30,76 @@ module DoNotBoxStruct = [] let ``DoNotBoxStruct_ArrayOfArray_FSInterface_NoExtMeth_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false //SOURCE=DoNotBoxStruct_Array_FSInterface_NoExtMeth.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd DoNotBoxStruct_Array_FSInterface_NoExtMeth.exe" # DoNotBoxStruct_Array_FSInterface_NoExtMeth.fs [] let ``DoNotBoxStruct_Array_FSInterface_NoExtMeth_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false //SOURCE=DoNotBoxStruct_MDArray_FSInterface_NoExtMeth.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd DoNotBoxStruct_MDArray_FSInterface_NoExtMeth.exe" # DoNotBoxStruct_MDArray_FSInterface_NoExtMeth.fs - [] let ``DoNotBoxStruct_MDArray_FSInterface_NoExtMeth_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false //SOURCE=DoNotBoxStruct_NoArray_FSInterface_NoExtMeth.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd DoNotBoxStruct_NoArray_FSInterface_NoExtMeth.exe" # DoNotBoxStruct_NoArray_FSInterface_NoExtMeth.fs - [] let ``DoNotBoxStruct_NoArray_FSInterface_NoExtMeth_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false //SOURCE=DoNotBoxStruct_ArrayOfArray_CSInterface.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd DoNotBoxStruct_ArrayOfArray_CSInterface.exe" # DoNotBoxStruct_ArrayOfArray_CSInterface.fs [] let ``DoNotBoxStruct_ArrayOfArray_CSInterface_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false //SOURCE=DoNotBoxStruct_ArrayOfArray_CSInterface.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd DoNotBoxStruct_ArrayOfArray_CSInterface.exe" # DoNotBoxStruct_ArrayOfArray_CSInterface.fs [] let ``DoNotBoxStruct_ArrayOfArray_FSInterface_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false //SOURCE=DoNotBoxStruct_Array_CSInterface.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd DoNotBoxStruct_Array_CSInterface.exe" # DoNotBoxStruct_Array_CSInterface.fs [] let ``DoNotBoxStruct_Array_CSInterface_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false //SOURCE=DoNotBoxStruct_Array_FSInterface.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd DoNotBoxStruct_Array_FSInterface.exe" # DoNotBoxStruct_Array_FSInterface.fs - [] let ``DoNotBoxStruct_Array_FSInterface_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false //SOURCE=DoNotBoxStruct_MDArray_CSInterface.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd DoNotBoxStruct_MDArray_CSInterface.exe" # DoNotBoxStruct_MDArray_CSInterface.fs - [] let ``DoNotBoxStruct_MDArray_CSInterface_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false //SOURCE=DoNotBoxStruct_MDArray_FSInterface.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd DoNotBoxStruct_MDArray_FSInterface.exe" # DoNotBoxStruct_MDArray_FSInterface.fs - [] let ``DoNotBoxStruct_MDArray_FSInterface_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false //SOURCE=DoNotBoxStruct_NoArray_CSInterface.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd DoNotBoxStruct_NoArray_CSInterface.exe" # DoNotBoxStruct_NoArray_CSInterface.fs [] let ``DoNotBoxStruct_NoArray_CSInterface_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false //SOURCE=DoNotBoxStruct_NoArray_FSInterface.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd DoNotBoxStruct_NoArray_FSInterface.exe" # DoNotBoxStruct_NoArray_FSInterface.fs - [] let ``DoNotBoxStruct_NoArray_FSInterface_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false //SOURCE=DoNotBoxStruct_ToString.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd DoNotBoxStruct_ToString.exe" # DoNotBoxStruct_ToString.fs [] let ``DoNotBoxStruct_ToString_fs`` compilation = compilation - |> verifyCompilation + |> verifyCompilation false diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnList01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnList01.fs.RealInternalSignatureOff.il.bsl index 1464a253823..d305143ead3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnList01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnList01.fs.RealInternalSignatureOff.il.bsl @@ -21,16 +21,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureCompressedData.assembly -{ - - -} -.mresource public FSharpOptimizationCompressedData.assembly -{ - - } .module assembly.exe diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnList01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnList01.fs.RealInternalSignatureOn.il.bsl index 1464a253823..d305143ead3 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnList01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnList01.fs.RealInternalSignatureOn.il.bsl @@ -21,16 +21,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureCompressedData.assembly -{ - - -} -.mresource public FSharpOptimizationCompressedData.assembly -{ - - } .module assembly.exe diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnString01.fs.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnString01.fs.RealInternalSignatureOff.il.bsl index 0051f80eb41..9aefdb86bc9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnString01.fs.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnString01.fs.RealInternalSignatureOff.il.bsl @@ -21,16 +21,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureCompressedData.assembly -{ - - -} -.mresource public FSharpOptimizationCompressedData.assembly -{ - - } .module assembly.exe diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnString01.fs.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnString01.fs.RealInternalSignatureOn.il.bsl index 0051f80eb41..9aefdb86bc9 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnString01.fs.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/ForEachOnString01.fs.RealInternalSignatureOn.il.bsl @@ -21,16 +21,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureCompressedData.assembly -{ - - -} -.mresource public FSharpOptimizationCompressedData.assembly -{ - - } .module assembly.exe diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable01.fsx.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable01.fsx.RealInternalSignatureOff.il.bsl index b7e3725bbda..a891fb04e9b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable01.fsx.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable01.fsx.RealInternalSignatureOff.il.bsl @@ -21,16 +21,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureCompressedData.assembly -{ - - -} -.mresource public FSharpOptimizationCompressedData.assembly -{ - - } .module assembly.exe diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable01.fsx.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable01.fsx.RealInternalSignatureOn.il.bsl index b7e3725bbda..a891fb04e9b 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable01.fsx.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable01.fsx.RealInternalSignatureOn.il.bsl @@ -21,16 +21,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureCompressedData.assembly -{ - - -} -.mresource public FSharpOptimizationCompressedData.assembly -{ - - } .module assembly.exe diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable02.fsx.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable02.fsx.RealInternalSignatureOff.il.bsl index fb9f5d63c43..52c48d19452 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable02.fsx.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable02.fsx.RealInternalSignatureOff.il.bsl @@ -21,16 +21,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureCompressedData.assembly -{ - - -} -.mresource public FSharpOptimizationCompressedData.assembly -{ - - } .module assembly.exe diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable03.fsx.RealInternalSignatureOff.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable03.fsx.RealInternalSignatureOff.il.bsl index 2e9e4cb2509..d0fcd55029a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable03.fsx.RealInternalSignatureOff.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable03.fsx.RealInternalSignatureOff.il.bsl @@ -21,16 +21,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureCompressedData.assembly -{ - - -} -.mresource public FSharpOptimizationCompressedData.assembly -{ - - } .module assembly.exe diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable03.fsx.RealInternalSignatureOn.il.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable03.fsx.RealInternalSignatureOn.il.bsl index 2e9e4cb2509..d0fcd55029a 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable03.fsx.RealInternalSignatureOn.il.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop/NoIEnumerable03.fsx.RealInternalSignatureOn.il.bsl @@ -21,16 +21,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureCompressedData.assembly -{ - - -} -.mresource public FSharpOptimizationCompressedData.assembly -{ - - } .module assembly.exe diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.debug.bsl index 71ae86abc63..fed4b270874 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.debug.bsl @@ -16,16 +16,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureCompressedData.assembly -{ - - -} -.mresource public FSharpOptimizationCompressedData.assembly -{ - - } .module assembly.exe @@ -459,347 +449,6 @@ } } - .class auto ansi serializable sealed nested assembly beforefieldinit clo@4 - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - { - .field public class Match01/Test1 this - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .field public class Match01/Test1 obj - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class Match01/Test1 this, - class Match01/Test1 obj) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class Match01/Test1 Match01/Test1/clo@4::this - IL_000d: ldarg.0 - IL_000e: ldarg.2 - IL_000f: stfld class Match01/Test1 Match01/Test1/clo@4::obj - IL_0014: ret - } - - .method public strict virtual instance int32 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed - { - - .maxstack 7 - .locals init (int32 V_0, - int32 V_1, - class Match01/Test1/X11 V_2, - class Match01/Test1/X11 V_3, - class [runtime]System.Collections.IComparer V_4, - int32 V_5, - int32 V_6, - class Match01/Test1/X12 V_7, - class Match01/Test1/X12 V_8, - class Match01/Test1/X13 V_9, - class Match01/Test1/X13 V_10, - class Match01/Test1/X14 V_11, - class Match01/Test1/X14 V_12) - IL_0000: ldarg.0 - IL_0001: ldfld class Match01/Test1 Match01/Test1/clo@4::this - IL_0006: ldfld int32 Match01/Test1::_tag - IL_000b: stloc.0 - IL_000c: ldarg.0 - IL_000d: ldfld class Match01/Test1 Match01/Test1/clo@4::obj - IL_0012: ldfld int32 Match01/Test1::_tag - IL_0017: stloc.1 - IL_0018: ldloc.0 - IL_0019: ldloc.1 - IL_001a: bne.un IL_013f - - IL_001f: ldarg.0 - IL_0020: ldfld class Match01/Test1 Match01/Test1/clo@4::this - IL_0025: call instance int32 Match01/Test1::get_Tag() - IL_002a: switch ( - IL_003f, - IL_007c, - IL_00bd, - IL_00fe) - IL_003f: ldarg.0 - IL_0040: ldfld class Match01/Test1 Match01/Test1/clo@4::this - IL_0045: castclass Match01/Test1/X11 - IL_004a: stloc.2 - IL_004b: ldarg.0 - IL_004c: ldfld class Match01/Test1 Match01/Test1/clo@4::obj - IL_0051: castclass Match01/Test1/X11 - IL_0056: stloc.3 - IL_0057: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() - IL_005c: stloc.s V_4 - IL_005e: ldloc.2 - IL_005f: ldfld int32 Match01/Test1/X11::item - IL_0064: stloc.s V_5 - IL_0066: ldloc.3 - IL_0067: ldfld int32 Match01/Test1/X11::item - IL_006c: stloc.s V_6 - IL_006e: ldloc.s V_5 - IL_0070: ldloc.s V_6 - IL_0072: cgt - IL_0074: ldloc.s V_5 - IL_0076: ldloc.s V_6 - IL_0078: clt - IL_007a: sub - IL_007b: ret - - IL_007c: ldarg.0 - IL_007d: ldfld class Match01/Test1 Match01/Test1/clo@4::this - IL_0082: castclass Match01/Test1/X12 - IL_0087: stloc.s V_7 - IL_0089: ldarg.0 - IL_008a: ldfld class Match01/Test1 Match01/Test1/clo@4::obj - IL_008f: castclass Match01/Test1/X12 - IL_0094: stloc.s V_8 - IL_0096: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() - IL_009b: stloc.s V_4 - IL_009d: ldloc.s V_7 - IL_009f: ldfld int32 Match01/Test1/X12::item - IL_00a4: stloc.s V_5 - IL_00a6: ldloc.s V_8 - IL_00a8: ldfld int32 Match01/Test1/X12::item - IL_00ad: stloc.s V_6 - IL_00af: ldloc.s V_5 - IL_00b1: ldloc.s V_6 - IL_00b3: cgt - IL_00b5: ldloc.s V_5 - IL_00b7: ldloc.s V_6 - IL_00b9: clt - IL_00bb: sub - IL_00bc: ret - - IL_00bd: ldarg.0 - IL_00be: ldfld class Match01/Test1 Match01/Test1/clo@4::this - IL_00c3: castclass Match01/Test1/X13 - IL_00c8: stloc.s V_9 - IL_00ca: ldarg.0 - IL_00cb: ldfld class Match01/Test1 Match01/Test1/clo@4::obj - IL_00d0: castclass Match01/Test1/X13 - IL_00d5: stloc.s V_10 - IL_00d7: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() - IL_00dc: stloc.s V_4 - IL_00de: ldloc.s V_9 - IL_00e0: ldfld int32 Match01/Test1/X13::item - IL_00e5: stloc.s V_5 - IL_00e7: ldloc.s V_10 - IL_00e9: ldfld int32 Match01/Test1/X13::item - IL_00ee: stloc.s V_6 - IL_00f0: ldloc.s V_5 - IL_00f2: ldloc.s V_6 - IL_00f4: cgt - IL_00f6: ldloc.s V_5 - IL_00f8: ldloc.s V_6 - IL_00fa: clt - IL_00fc: sub - IL_00fd: ret - - IL_00fe: ldarg.0 - IL_00ff: ldfld class Match01/Test1 Match01/Test1/clo@4::this - IL_0104: castclass Match01/Test1/X14 - IL_0109: stloc.s V_11 - IL_010b: ldarg.0 - IL_010c: ldfld class Match01/Test1 Match01/Test1/clo@4::obj - IL_0111: castclass Match01/Test1/X14 - IL_0116: stloc.s V_12 - IL_0118: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() - IL_011d: stloc.s V_4 - IL_011f: ldloc.s V_11 - IL_0121: ldfld int32 Match01/Test1/X14::item - IL_0126: stloc.s V_5 - IL_0128: ldloc.s V_12 - IL_012a: ldfld int32 Match01/Test1/X14::item - IL_012f: stloc.s V_6 - IL_0131: ldloc.s V_5 - IL_0133: ldloc.s V_6 - IL_0135: cgt - IL_0137: ldloc.s V_5 - IL_0139: ldloc.s V_6 - IL_013b: clt - IL_013d: sub - IL_013e: ret - - IL_013f: ldloc.0 - IL_0140: ldloc.1 - IL_0141: sub - IL_0142: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit 'clo@4-1' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - { - .field public class Match01/Test1 this - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .field public class Match01/Test1 objTemp - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class Match01/Test1 this, - class Match01/Test1 objTemp) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class Match01/Test1 Match01/Test1/'clo@4-1'::this - IL_000d: ldarg.0 - IL_000e: ldarg.2 - IL_000f: stfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp - IL_0014: ret - } - - .method public strict virtual instance int32 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed - { - - .maxstack 7 - .locals init (int32 V_0, - int32 V_1, - class Match01/Test1/X11 V_2, - class Match01/Test1/X11 V_3, - int32 V_4, - int32 V_5, - class Match01/Test1/X12 V_6, - class Match01/Test1/X12 V_7, - class Match01/Test1/X13 V_8, - class Match01/Test1/X13 V_9, - class Match01/Test1/X14 V_10, - class Match01/Test1/X14 V_11) - IL_0000: ldarg.0 - IL_0001: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this - IL_0006: ldfld int32 Match01/Test1::_tag - IL_000b: stloc.0 - IL_000c: ldarg.0 - IL_000d: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp - IL_0012: ldfld int32 Match01/Test1::_tag - IL_0017: stloc.1 - IL_0018: ldloc.0 - IL_0019: ldloc.1 - IL_001a: bne.un IL_0123 - - IL_001f: ldarg.0 - IL_0020: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this - IL_0025: call instance int32 Match01/Test1::get_Tag() - IL_002a: switch ( - IL_003f, - IL_0075, - IL_00af, - IL_00e9) - IL_003f: ldarg.0 - IL_0040: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this - IL_0045: castclass Match01/Test1/X11 - IL_004a: stloc.2 - IL_004b: ldarg.0 - IL_004c: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp - IL_0051: castclass Match01/Test1/X11 - IL_0056: stloc.3 - IL_0057: ldloc.2 - IL_0058: ldfld int32 Match01/Test1/X11::item - IL_005d: stloc.s V_4 - IL_005f: ldloc.3 - IL_0060: ldfld int32 Match01/Test1/X11::item - IL_0065: stloc.s V_5 - IL_0067: ldloc.s V_4 - IL_0069: ldloc.s V_5 - IL_006b: cgt - IL_006d: ldloc.s V_4 - IL_006f: ldloc.s V_5 - IL_0071: clt - IL_0073: sub - IL_0074: ret - - IL_0075: ldarg.0 - IL_0076: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this - IL_007b: castclass Match01/Test1/X12 - IL_0080: stloc.s V_6 - IL_0082: ldarg.0 - IL_0083: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp - IL_0088: castclass Match01/Test1/X12 - IL_008d: stloc.s V_7 - IL_008f: ldloc.s V_6 - IL_0091: ldfld int32 Match01/Test1/X12::item - IL_0096: stloc.s V_4 - IL_0098: ldloc.s V_7 - IL_009a: ldfld int32 Match01/Test1/X12::item - IL_009f: stloc.s V_5 - IL_00a1: ldloc.s V_4 - IL_00a3: ldloc.s V_5 - IL_00a5: cgt - IL_00a7: ldloc.s V_4 - IL_00a9: ldloc.s V_5 - IL_00ab: clt - IL_00ad: sub - IL_00ae: ret - - IL_00af: ldarg.0 - IL_00b0: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this - IL_00b5: castclass Match01/Test1/X13 - IL_00ba: stloc.s V_8 - IL_00bc: ldarg.0 - IL_00bd: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp - IL_00c2: castclass Match01/Test1/X13 - IL_00c7: stloc.s V_9 - IL_00c9: ldloc.s V_8 - IL_00cb: ldfld int32 Match01/Test1/X13::item - IL_00d0: stloc.s V_4 - IL_00d2: ldloc.s V_9 - IL_00d4: ldfld int32 Match01/Test1/X13::item - IL_00d9: stloc.s V_5 - IL_00db: ldloc.s V_4 - IL_00dd: ldloc.s V_5 - IL_00df: cgt - IL_00e1: ldloc.s V_4 - IL_00e3: ldloc.s V_5 - IL_00e5: clt - IL_00e7: sub - IL_00e8: ret - - IL_00e9: ldarg.0 - IL_00ea: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this - IL_00ef: castclass Match01/Test1/X14 - IL_00f4: stloc.s V_10 - IL_00f6: ldarg.0 - IL_00f7: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp - IL_00fc: castclass Match01/Test1/X14 - IL_0101: stloc.s V_11 - IL_0103: ldloc.s V_10 - IL_0105: ldfld int32 Match01/Test1/X14::item - IL_010a: stloc.s V_4 - IL_010c: ldloc.s V_11 - IL_010e: ldfld int32 Match01/Test1/X14::item - IL_0113: stloc.s V_5 - IL_0115: ldloc.s V_4 - IL_0117: ldloc.s V_5 - IL_0119: cgt - IL_011b: ldloc.s V_4 - IL_011d: ldloc.s V_5 - IL_011f: clt - IL_0121: sub - IL_0122: ret - - IL_0123: ldloc.0 - IL_0124: ldloc.1 - IL_0125: sub - IL_0126: ret - } - - } - .field assembly initonly int32 _tag .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -955,40 +604,171 @@ IL_0015: ret } + .method assembly static int32 CompareTo$cont@4(class Match01/Test1 this, + class Match01/Test1 obj, + class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (int32 V_0, + int32 V_1, + class Match01/Test1/X11 V_2, + class Match01/Test1/X11 V_3, + class [runtime]System.Collections.IComparer V_4, + int32 V_5, + int32 V_6, + class Match01/Test1/X12 V_7, + class Match01/Test1/X12 V_8, + class Match01/Test1/X13 V_9, + class Match01/Test1/X13 V_10, + class Match01/Test1/X14 V_11, + class Match01/Test1/X14 V_12) + IL_0000: ldarg.0 + IL_0001: ldfld int32 Match01/Test1::_tag + IL_0006: stloc.0 + IL_0007: ldarg.1 + IL_0008: ldfld int32 Match01/Test1::_tag + IL_000d: stloc.1 + IL_000e: ldloc.0 + IL_000f: ldloc.1 + IL_0010: bne.un IL_0108 + + IL_0015: ldarg.0 + IL_0016: call instance int32 Match01/Test1::get_Tag() + IL_001b: switch ( + IL_0030, + IL_0063, + IL_009a, + IL_00d1) + IL_0030: ldarg.0 + IL_0031: castclass Match01/Test1/X11 + IL_0036: stloc.2 + IL_0037: ldarg.1 + IL_0038: castclass Match01/Test1/X11 + IL_003d: stloc.3 + IL_003e: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_0043: stloc.s V_4 + IL_0045: ldloc.2 + IL_0046: ldfld int32 Match01/Test1/X11::item + IL_004b: stloc.s V_5 + IL_004d: ldloc.3 + IL_004e: ldfld int32 Match01/Test1/X11::item + IL_0053: stloc.s V_6 + IL_0055: ldloc.s V_5 + IL_0057: ldloc.s V_6 + IL_0059: cgt + IL_005b: ldloc.s V_5 + IL_005d: ldloc.s V_6 + IL_005f: clt + IL_0061: sub + IL_0062: ret + + IL_0063: ldarg.0 + IL_0064: castclass Match01/Test1/X12 + IL_0069: stloc.s V_7 + IL_006b: ldarg.1 + IL_006c: castclass Match01/Test1/X12 + IL_0071: stloc.s V_8 + IL_0073: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_0078: stloc.s V_4 + IL_007a: ldloc.s V_7 + IL_007c: ldfld int32 Match01/Test1/X12::item + IL_0081: stloc.s V_5 + IL_0083: ldloc.s V_8 + IL_0085: ldfld int32 Match01/Test1/X12::item + IL_008a: stloc.s V_6 + IL_008c: ldloc.s V_5 + IL_008e: ldloc.s V_6 + IL_0090: cgt + IL_0092: ldloc.s V_5 + IL_0094: ldloc.s V_6 + IL_0096: clt + IL_0098: sub + IL_0099: ret + + IL_009a: ldarg.0 + IL_009b: castclass Match01/Test1/X13 + IL_00a0: stloc.s V_9 + IL_00a2: ldarg.1 + IL_00a3: castclass Match01/Test1/X13 + IL_00a8: stloc.s V_10 + IL_00aa: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_00af: stloc.s V_4 + IL_00b1: ldloc.s V_9 + IL_00b3: ldfld int32 Match01/Test1/X13::item + IL_00b8: stloc.s V_5 + IL_00ba: ldloc.s V_10 + IL_00bc: ldfld int32 Match01/Test1/X13::item + IL_00c1: stloc.s V_6 + IL_00c3: ldloc.s V_5 + IL_00c5: ldloc.s V_6 + IL_00c7: cgt + IL_00c9: ldloc.s V_5 + IL_00cb: ldloc.s V_6 + IL_00cd: clt + IL_00cf: sub + IL_00d0: ret + + IL_00d1: ldarg.0 + IL_00d2: castclass Match01/Test1/X14 + IL_00d7: stloc.s V_11 + IL_00d9: ldarg.1 + IL_00da: castclass Match01/Test1/X14 + IL_00df: stloc.s V_12 + IL_00e1: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_00e6: stloc.s V_4 + IL_00e8: ldloc.s V_11 + IL_00ea: ldfld int32 Match01/Test1/X14::item + IL_00ef: stloc.s V_5 + IL_00f1: ldloc.s V_12 + IL_00f3: ldfld int32 Match01/Test1/X14::item + IL_00f8: stloc.s V_6 + IL_00fa: ldloc.s V_5 + IL_00fc: ldloc.s V_6 + IL_00fe: cgt + IL_0100: ldloc.s V_5 + IL_0102: ldloc.s V_6 + IL_0104: clt + IL_0106: sub + IL_0107: ret + + IL_0108: ldloc.0 + IL_0109: ldloc.1 + IL_010a: sub + IL_010b: ret + } + .method public hidebysig virtual final instance int32 CompareTo(class Match01/Test1 obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .maxstack 4 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_0) + .maxstack 8 IL_0000: ldarg.0 - IL_0001: brfalse.s IL_001a + IL_0001: brfalse.s IL_0011 IL_0003: ldarg.1 - IL_0004: brfalse.s IL_0018 + IL_0004: brfalse.s IL_000f IL_0006: ldarg.0 IL_0007: ldarg.1 - IL_0008: newobj instance void Match01/Test1/clo@4::.ctor(class Match01/Test1, - class Match01/Test1) - IL_000d: stloc.0 - IL_000e: ldloc.0 - IL_000f: ldnull - IL_0010: tail. - IL_0012: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0017: ret + IL_0008: ldnull + IL_0009: call int32 Match01/Test1::CompareTo$cont@4(class Match01/Test1, + class Match01/Test1, + class [FSharp.Core]Microsoft.FSharp.Core.Unit) + IL_000e: ret - IL_0018: ldc.i4.1 - IL_0019: ret + IL_000f: ldc.i4.1 + IL_0010: ret - IL_001a: ldarg.1 - IL_001b: brfalse.s IL_001f + IL_0011: ldarg.1 + IL_0012: brfalse.s IL_0016 - IL_001d: ldc.i4.m1 - IL_001e: ret + IL_0014: ldc.i4.m1 + IL_0015: ret - IL_001f: ldc.i4.0 - IL_0020: ret + IL_0016: ldc.i4.0 + IL_0017: ret } .method public hidebysig virtual final instance int32 CompareTo(object obj) cil managed @@ -1003,48 +783,168 @@ IL_000c: ret } - .method public hidebysig virtual final - instance int32 CompareTo(object obj, - class [runtime]System.Collections.IComparer comp) cil managed + .method assembly static int32 'CompareTo$cont@4-1'(class Match01/Test1 this, + class Match01/Test1 objTemp, + class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .maxstack 4 - .locals init (class Match01/Test1 V_0, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_1) + .maxstack 5 + .locals init (int32 V_0, + int32 V_1, + class Match01/Test1/X11 V_2, + class Match01/Test1/X11 V_3, + int32 V_4, + int32 V_5, + class Match01/Test1/X12 V_6, + class Match01/Test1/X12 V_7, + class Match01/Test1/X13 V_8, + class Match01/Test1/X13 V_9, + class Match01/Test1/X14 V_10, + class Match01/Test1/X14 V_11) + IL_0000: ldarg.0 + IL_0001: ldfld int32 Match01/Test1::_tag + IL_0006: stloc.0 + IL_0007: ldarg.1 + IL_0008: ldfld int32 Match01/Test1::_tag + IL_000d: stloc.1 + IL_000e: ldloc.0 + IL_000f: ldloc.1 + IL_0010: bne.un IL_00ec + + IL_0015: ldarg.0 + IL_0016: call instance int32 Match01/Test1::get_Tag() + IL_001b: switch ( + IL_0030, + IL_005c, + IL_008c, + IL_00bc) + IL_0030: ldarg.0 + IL_0031: castclass Match01/Test1/X11 + IL_0036: stloc.2 + IL_0037: ldarg.1 + IL_0038: castclass Match01/Test1/X11 + IL_003d: stloc.3 + IL_003e: ldloc.2 + IL_003f: ldfld int32 Match01/Test1/X11::item + IL_0044: stloc.s V_4 + IL_0046: ldloc.3 + IL_0047: ldfld int32 Match01/Test1/X11::item + IL_004c: stloc.s V_5 + IL_004e: ldloc.s V_4 + IL_0050: ldloc.s V_5 + IL_0052: cgt + IL_0054: ldloc.s V_4 + IL_0056: ldloc.s V_5 + IL_0058: clt + IL_005a: sub + IL_005b: ret + + IL_005c: ldarg.0 + IL_005d: castclass Match01/Test1/X12 + IL_0062: stloc.s V_6 + IL_0064: ldarg.1 + IL_0065: castclass Match01/Test1/X12 + IL_006a: stloc.s V_7 + IL_006c: ldloc.s V_6 + IL_006e: ldfld int32 Match01/Test1/X12::item + IL_0073: stloc.s V_4 + IL_0075: ldloc.s V_7 + IL_0077: ldfld int32 Match01/Test1/X12::item + IL_007c: stloc.s V_5 + IL_007e: ldloc.s V_4 + IL_0080: ldloc.s V_5 + IL_0082: cgt + IL_0084: ldloc.s V_4 + IL_0086: ldloc.s V_5 + IL_0088: clt + IL_008a: sub + IL_008b: ret + + IL_008c: ldarg.0 + IL_008d: castclass Match01/Test1/X13 + IL_0092: stloc.s V_8 + IL_0094: ldarg.1 + IL_0095: castclass Match01/Test1/X13 + IL_009a: stloc.s V_9 + IL_009c: ldloc.s V_8 + IL_009e: ldfld int32 Match01/Test1/X13::item + IL_00a3: stloc.s V_4 + IL_00a5: ldloc.s V_9 + IL_00a7: ldfld int32 Match01/Test1/X13::item + IL_00ac: stloc.s V_5 + IL_00ae: ldloc.s V_4 + IL_00b0: ldloc.s V_5 + IL_00b2: cgt + IL_00b4: ldloc.s V_4 + IL_00b6: ldloc.s V_5 + IL_00b8: clt + IL_00ba: sub + IL_00bb: ret + + IL_00bc: ldarg.0 + IL_00bd: castclass Match01/Test1/X14 + IL_00c2: stloc.s V_10 + IL_00c4: ldarg.1 + IL_00c5: castclass Match01/Test1/X14 + IL_00ca: stloc.s V_11 + IL_00cc: ldloc.s V_10 + IL_00ce: ldfld int32 Match01/Test1/X14::item + IL_00d3: stloc.s V_4 + IL_00d5: ldloc.s V_11 + IL_00d7: ldfld int32 Match01/Test1/X14::item + IL_00dc: stloc.s V_5 + IL_00de: ldloc.s V_4 + IL_00e0: ldloc.s V_5 + IL_00e2: cgt + IL_00e4: ldloc.s V_4 + IL_00e6: ldloc.s V_5 + IL_00e8: clt + IL_00ea: sub + IL_00eb: ret + + IL_00ec: ldloc.0 + IL_00ed: ldloc.1 + IL_00ee: sub + IL_00ef: ret + } + + .method public hidebysig virtual final instance int32 CompareTo(object obj, class [runtime]System.Collections.IComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (class Match01/Test1 V_0) IL_0000: ldarg.1 IL_0001: unbox.any Match01/Test1 IL_0006: stloc.0 IL_0007: ldarg.0 - IL_0008: brfalse.s IL_0026 + IL_0008: brfalse.s IL_001d IL_000a: ldarg.1 IL_000b: unbox.any Match01/Test1 - IL_0010: brfalse.s IL_0024 + IL_0010: brfalse.s IL_001b IL_0012: ldarg.0 IL_0013: ldloc.0 - IL_0014: newobj instance void Match01/Test1/'clo@4-1'::.ctor(class Match01/Test1, - class Match01/Test1) - IL_0019: stloc.1 - IL_001a: ldloc.1 - IL_001b: ldnull - IL_001c: tail. - IL_001e: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0023: ret + IL_0014: ldnull + IL_0015: call int32 Match01/Test1::'CompareTo$cont@4-1'(class Match01/Test1, + class Match01/Test1, + class [FSharp.Core]Microsoft.FSharp.Core.Unit) + IL_001a: ret - IL_0024: ldc.i4.1 - IL_0025: ret + IL_001b: ldc.i4.1 + IL_001c: ret - IL_0026: ldarg.1 - IL_0027: unbox.any Match01/Test1 - IL_002c: brfalse.s IL_0030 + IL_001d: ldarg.1 + IL_001e: unbox.any Match01/Test1 + IL_0023: brfalse.s IL_0027 - IL_002e: ldc.i4.m1 - IL_002f: ret + IL_0025: ldc.i4.m1 + IL_0026: ret - IL_0030: ldc.i4.0 - IL_0031: ret + IL_0027: ldc.i4.0 + IL_0028: ret } .method public hidebysig virtual final instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed @@ -1168,9 +1068,7 @@ IL_000b: ret } - .method public hidebysig instance bool - Equals(class Match01/Test1 obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig instance bool Equals(class Match01/Test1 obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -1274,9 +1172,7 @@ IL_00c7: ret } - .method public hidebysig virtual final - instance bool Equals(object obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig virtual final instance bool Equals(object obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -1547,9 +1443,7 @@ .field private class [runtime]System.Type Type@ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method public specialname rtspecialname - instance void .ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType, - class [runtime]System.Type Type) cil managed + .method public specialname rtspecialname instance void .ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType, class [runtime]System.Type Type) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.release.bsl index eee45015b20..21c02964c07 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.release.bsl @@ -16,16 +16,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureCompressedData.assembly -{ - - -} -.mresource public FSharpOptimizationCompressedData.assembly -{ - - } .module assembly.exe @@ -459,363 +449,6 @@ } } - .class auto ansi serializable sealed nested assembly beforefieldinit clo@4 - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - { - .field public class Match01/Test1 this - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .field public class Match01/Test1 obj - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class Match01/Test1 this, - class Match01/Test1 obj) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class Match01/Test1 Match01/Test1/clo@4::this - IL_000d: ldarg.0 - IL_000e: ldarg.2 - IL_000f: stfld class Match01/Test1 Match01/Test1/clo@4::obj - IL_0014: ret - } - - .method public strict virtual instance int32 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed - { - - .maxstack 7 - .locals init (int32 V_0, - int32 V_1, - class Match01/Test1/X11 V_2, - class Match01/Test1/X11 V_3, - class [runtime]System.Collections.IComparer V_4, - int32 V_5, - int32 V_6, - class Match01/Test1/X12 V_7, - class Match01/Test1/X12 V_8, - class Match01/Test1/X13 V_9, - class Match01/Test1/X13 V_10, - class Match01/Test1/X14 V_11, - class Match01/Test1/X14 V_12) - IL_0000: ldarg.0 - IL_0001: ldfld class Match01/Test1 Match01/Test1/clo@4::this - IL_0006: ldfld int32 Match01/Test1::_tag - IL_000b: stloc.0 - IL_000c: ldarg.0 - IL_000d: ldfld class Match01/Test1 Match01/Test1/clo@4::obj - IL_0012: ldfld int32 Match01/Test1::_tag - IL_0017: stloc.1 - IL_0018: ldloc.0 - IL_0019: ldloc.1 - IL_001a: bne.un IL_013f - - IL_001f: ldarg.0 - IL_0020: ldfld class Match01/Test1 Match01/Test1/clo@4::this - IL_0025: call instance int32 Match01/Test1::get_Tag() - IL_002a: switch ( - IL_003f, - IL_007c, - IL_00bd, - IL_00fe) - IL_003f: ldarg.0 - IL_0040: ldfld class Match01/Test1 Match01/Test1/clo@4::this - IL_0045: castclass Match01/Test1/X11 - IL_004a: stloc.2 - IL_004b: ldarg.0 - IL_004c: ldfld class Match01/Test1 Match01/Test1/clo@4::obj - IL_0051: castclass Match01/Test1/X11 - IL_0056: stloc.3 - IL_0057: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() - IL_005c: stloc.s V_4 - IL_005e: ldloc.2 - IL_005f: ldfld int32 Match01/Test1/X11::item - IL_0064: stloc.s V_5 - IL_0066: ldloc.3 - IL_0067: ldfld int32 Match01/Test1/X11::item - IL_006c: stloc.s V_6 - IL_006e: ldloc.s V_5 - IL_0070: ldloc.s V_6 - IL_0072: cgt - IL_0074: ldloc.s V_5 - IL_0076: ldloc.s V_6 - IL_0078: clt - IL_007a: sub - IL_007b: ret - - IL_007c: ldarg.0 - IL_007d: ldfld class Match01/Test1 Match01/Test1/clo@4::this - IL_0082: castclass Match01/Test1/X12 - IL_0087: stloc.s V_7 - IL_0089: ldarg.0 - IL_008a: ldfld class Match01/Test1 Match01/Test1/clo@4::obj - IL_008f: castclass Match01/Test1/X12 - IL_0094: stloc.s V_8 - IL_0096: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() - IL_009b: stloc.s V_4 - IL_009d: ldloc.s V_7 - IL_009f: ldfld int32 Match01/Test1/X12::item - IL_00a4: stloc.s V_5 - IL_00a6: ldloc.s V_8 - IL_00a8: ldfld int32 Match01/Test1/X12::item - IL_00ad: stloc.s V_6 - IL_00af: ldloc.s V_5 - IL_00b1: ldloc.s V_6 - IL_00b3: cgt - IL_00b5: ldloc.s V_5 - IL_00b7: ldloc.s V_6 - IL_00b9: clt - IL_00bb: sub - IL_00bc: ret - - IL_00bd: ldarg.0 - IL_00be: ldfld class Match01/Test1 Match01/Test1/clo@4::this - IL_00c3: castclass Match01/Test1/X13 - IL_00c8: stloc.s V_9 - IL_00ca: ldarg.0 - IL_00cb: ldfld class Match01/Test1 Match01/Test1/clo@4::obj - IL_00d0: castclass Match01/Test1/X13 - IL_00d5: stloc.s V_10 - IL_00d7: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() - IL_00dc: stloc.s V_4 - IL_00de: ldloc.s V_9 - IL_00e0: ldfld int32 Match01/Test1/X13::item - IL_00e5: stloc.s V_5 - IL_00e7: ldloc.s V_10 - IL_00e9: ldfld int32 Match01/Test1/X13::item - IL_00ee: stloc.s V_6 - IL_00f0: ldloc.s V_5 - IL_00f2: ldloc.s V_6 - IL_00f4: cgt - IL_00f6: ldloc.s V_5 - IL_00f8: ldloc.s V_6 - IL_00fa: clt - IL_00fc: sub - IL_00fd: ret - - IL_00fe: ldarg.0 - IL_00ff: ldfld class Match01/Test1 Match01/Test1/clo@4::this - IL_0104: castclass Match01/Test1/X14 - IL_0109: stloc.s V_11 - IL_010b: ldarg.0 - IL_010c: ldfld class Match01/Test1 Match01/Test1/clo@4::obj - IL_0111: castclass Match01/Test1/X14 - IL_0116: stloc.s V_12 - IL_0118: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() - IL_011d: stloc.s V_4 - IL_011f: ldloc.s V_11 - IL_0121: ldfld int32 Match01/Test1/X14::item - IL_0126: stloc.s V_5 - IL_0128: ldloc.s V_12 - IL_012a: ldfld int32 Match01/Test1/X14::item - IL_012f: stloc.s V_6 - IL_0131: ldloc.s V_5 - IL_0133: ldloc.s V_6 - IL_0135: cgt - IL_0137: ldloc.s V_5 - IL_0139: ldloc.s V_6 - IL_013b: clt - IL_013d: sub - IL_013e: ret - - IL_013f: ldloc.0 - IL_0140: ldloc.1 - IL_0141: sub - IL_0142: ret - } - - } - - .class auto ansi serializable sealed nested assembly beforefieldinit 'clo@4-1' - extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - { - .field public class Match01/Test1 this - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .field public object obj - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .field public class Match01/Test1 objTemp - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method assembly specialname rtspecialname - instance void .ctor(class Match01/Test1 this, - object obj, - class Match01/Test1 objTemp) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() - IL_0006: ldarg.0 - IL_0007: ldarg.1 - IL_0008: stfld class Match01/Test1 Match01/Test1/'clo@4-1'::this - IL_000d: ldarg.0 - IL_000e: ldarg.2 - IL_000f: stfld object Match01/Test1/'clo@4-1'::obj - IL_0014: ldarg.0 - IL_0015: ldarg.3 - IL_0016: stfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp - IL_001b: ret - } - - .method public strict virtual instance int32 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed - { - - .maxstack 7 - .locals init (int32 V_0, - int32 V_1, - class Match01/Test1/X11 V_2, - class Match01/Test1/X11 V_3, - int32 V_4, - int32 V_5, - class Match01/Test1/X12 V_6, - class Match01/Test1/X12 V_7, - class Match01/Test1/X13 V_8, - class Match01/Test1/X13 V_9, - class Match01/Test1/X14 V_10, - class Match01/Test1/X14 V_11) - IL_0000: ldarg.0 - IL_0001: ldfld object Match01/Test1/'clo@4-1'::obj - IL_0006: unbox.any Match01/Test1 - IL_000b: brfalse IL_0137 - - IL_0010: ldarg.0 - IL_0011: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this - IL_0016: ldfld int32 Match01/Test1::_tag - IL_001b: stloc.0 - IL_001c: ldarg.0 - IL_001d: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp - IL_0022: ldfld int32 Match01/Test1::_tag - IL_0027: stloc.1 - IL_0028: ldloc.0 - IL_0029: ldloc.1 - IL_002a: bne.un IL_0133 - - IL_002f: ldarg.0 - IL_0030: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this - IL_0035: call instance int32 Match01/Test1::get_Tag() - IL_003a: switch ( - IL_004f, - IL_0085, - IL_00bf, - IL_00f9) - IL_004f: ldarg.0 - IL_0050: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this - IL_0055: castclass Match01/Test1/X11 - IL_005a: stloc.2 - IL_005b: ldarg.0 - IL_005c: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp - IL_0061: castclass Match01/Test1/X11 - IL_0066: stloc.3 - IL_0067: ldloc.2 - IL_0068: ldfld int32 Match01/Test1/X11::item - IL_006d: stloc.s V_4 - IL_006f: ldloc.3 - IL_0070: ldfld int32 Match01/Test1/X11::item - IL_0075: stloc.s V_5 - IL_0077: ldloc.s V_4 - IL_0079: ldloc.s V_5 - IL_007b: cgt - IL_007d: ldloc.s V_4 - IL_007f: ldloc.s V_5 - IL_0081: clt - IL_0083: sub - IL_0084: ret - - IL_0085: ldarg.0 - IL_0086: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this - IL_008b: castclass Match01/Test1/X12 - IL_0090: stloc.s V_6 - IL_0092: ldarg.0 - IL_0093: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp - IL_0098: castclass Match01/Test1/X12 - IL_009d: stloc.s V_7 - IL_009f: ldloc.s V_6 - IL_00a1: ldfld int32 Match01/Test1/X12::item - IL_00a6: stloc.s V_4 - IL_00a8: ldloc.s V_7 - IL_00aa: ldfld int32 Match01/Test1/X12::item - IL_00af: stloc.s V_5 - IL_00b1: ldloc.s V_4 - IL_00b3: ldloc.s V_5 - IL_00b5: cgt - IL_00b7: ldloc.s V_4 - IL_00b9: ldloc.s V_5 - IL_00bb: clt - IL_00bd: sub - IL_00be: ret - - IL_00bf: ldarg.0 - IL_00c0: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this - IL_00c5: castclass Match01/Test1/X13 - IL_00ca: stloc.s V_8 - IL_00cc: ldarg.0 - IL_00cd: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp - IL_00d2: castclass Match01/Test1/X13 - IL_00d7: stloc.s V_9 - IL_00d9: ldloc.s V_8 - IL_00db: ldfld int32 Match01/Test1/X13::item - IL_00e0: stloc.s V_4 - IL_00e2: ldloc.s V_9 - IL_00e4: ldfld int32 Match01/Test1/X13::item - IL_00e9: stloc.s V_5 - IL_00eb: ldloc.s V_4 - IL_00ed: ldloc.s V_5 - IL_00ef: cgt - IL_00f1: ldloc.s V_4 - IL_00f3: ldloc.s V_5 - IL_00f5: clt - IL_00f7: sub - IL_00f8: ret - - IL_00f9: ldarg.0 - IL_00fa: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this - IL_00ff: castclass Match01/Test1/X14 - IL_0104: stloc.s V_10 - IL_0106: ldarg.0 - IL_0107: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp - IL_010c: castclass Match01/Test1/X14 - IL_0111: stloc.s V_11 - IL_0113: ldloc.s V_10 - IL_0115: ldfld int32 Match01/Test1/X14::item - IL_011a: stloc.s V_4 - IL_011c: ldloc.s V_11 - IL_011e: ldfld int32 Match01/Test1/X14::item - IL_0123: stloc.s V_5 - IL_0125: ldloc.s V_4 - IL_0127: ldloc.s V_5 - IL_0129: cgt - IL_012b: ldloc.s V_4 - IL_012d: ldloc.s V_5 - IL_012f: clt - IL_0131: sub - IL_0132: ret - - IL_0133: ldloc.0 - IL_0134: ldloc.1 - IL_0135: sub - IL_0136: ret - - IL_0137: ldc.i4.1 - IL_0138: ret - } - - } - .field assembly initonly int32 _tag .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -971,40 +604,171 @@ IL_0015: ret } + .method assembly static int32 CompareTo$cont@4(class Match01/Test1 this, + class Match01/Test1 obj, + class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (int32 V_0, + int32 V_1, + class Match01/Test1/X11 V_2, + class Match01/Test1/X11 V_3, + class [runtime]System.Collections.IComparer V_4, + int32 V_5, + int32 V_6, + class Match01/Test1/X12 V_7, + class Match01/Test1/X12 V_8, + class Match01/Test1/X13 V_9, + class Match01/Test1/X13 V_10, + class Match01/Test1/X14 V_11, + class Match01/Test1/X14 V_12) + IL_0000: ldarg.0 + IL_0001: ldfld int32 Match01/Test1::_tag + IL_0006: stloc.0 + IL_0007: ldarg.1 + IL_0008: ldfld int32 Match01/Test1::_tag + IL_000d: stloc.1 + IL_000e: ldloc.0 + IL_000f: ldloc.1 + IL_0010: bne.un IL_0108 + + IL_0015: ldarg.0 + IL_0016: call instance int32 Match01/Test1::get_Tag() + IL_001b: switch ( + IL_0030, + IL_0063, + IL_009a, + IL_00d1) + IL_0030: ldarg.0 + IL_0031: castclass Match01/Test1/X11 + IL_0036: stloc.2 + IL_0037: ldarg.1 + IL_0038: castclass Match01/Test1/X11 + IL_003d: stloc.3 + IL_003e: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_0043: stloc.s V_4 + IL_0045: ldloc.2 + IL_0046: ldfld int32 Match01/Test1/X11::item + IL_004b: stloc.s V_5 + IL_004d: ldloc.3 + IL_004e: ldfld int32 Match01/Test1/X11::item + IL_0053: stloc.s V_6 + IL_0055: ldloc.s V_5 + IL_0057: ldloc.s V_6 + IL_0059: cgt + IL_005b: ldloc.s V_5 + IL_005d: ldloc.s V_6 + IL_005f: clt + IL_0061: sub + IL_0062: ret + + IL_0063: ldarg.0 + IL_0064: castclass Match01/Test1/X12 + IL_0069: stloc.s V_7 + IL_006b: ldarg.1 + IL_006c: castclass Match01/Test1/X12 + IL_0071: stloc.s V_8 + IL_0073: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_0078: stloc.s V_4 + IL_007a: ldloc.s V_7 + IL_007c: ldfld int32 Match01/Test1/X12::item + IL_0081: stloc.s V_5 + IL_0083: ldloc.s V_8 + IL_0085: ldfld int32 Match01/Test1/X12::item + IL_008a: stloc.s V_6 + IL_008c: ldloc.s V_5 + IL_008e: ldloc.s V_6 + IL_0090: cgt + IL_0092: ldloc.s V_5 + IL_0094: ldloc.s V_6 + IL_0096: clt + IL_0098: sub + IL_0099: ret + + IL_009a: ldarg.0 + IL_009b: castclass Match01/Test1/X13 + IL_00a0: stloc.s V_9 + IL_00a2: ldarg.1 + IL_00a3: castclass Match01/Test1/X13 + IL_00a8: stloc.s V_10 + IL_00aa: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_00af: stloc.s V_4 + IL_00b1: ldloc.s V_9 + IL_00b3: ldfld int32 Match01/Test1/X13::item + IL_00b8: stloc.s V_5 + IL_00ba: ldloc.s V_10 + IL_00bc: ldfld int32 Match01/Test1/X13::item + IL_00c1: stloc.s V_6 + IL_00c3: ldloc.s V_5 + IL_00c5: ldloc.s V_6 + IL_00c7: cgt + IL_00c9: ldloc.s V_5 + IL_00cb: ldloc.s V_6 + IL_00cd: clt + IL_00cf: sub + IL_00d0: ret + + IL_00d1: ldarg.0 + IL_00d2: castclass Match01/Test1/X14 + IL_00d7: stloc.s V_11 + IL_00d9: ldarg.1 + IL_00da: castclass Match01/Test1/X14 + IL_00df: stloc.s V_12 + IL_00e1: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_00e6: stloc.s V_4 + IL_00e8: ldloc.s V_11 + IL_00ea: ldfld int32 Match01/Test1/X14::item + IL_00ef: stloc.s V_5 + IL_00f1: ldloc.s V_12 + IL_00f3: ldfld int32 Match01/Test1/X14::item + IL_00f8: stloc.s V_6 + IL_00fa: ldloc.s V_5 + IL_00fc: ldloc.s V_6 + IL_00fe: cgt + IL_0100: ldloc.s V_5 + IL_0102: ldloc.s V_6 + IL_0104: clt + IL_0106: sub + IL_0107: ret + + IL_0108: ldloc.0 + IL_0109: ldloc.1 + IL_010a: sub + IL_010b: ret + } + .method public hidebysig virtual final instance int32 CompareTo(class Match01/Test1 obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .maxstack 4 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_0) + .maxstack 8 IL_0000: ldarg.0 - IL_0001: brfalse.s IL_001a + IL_0001: brfalse.s IL_0011 IL_0003: ldarg.1 - IL_0004: brfalse.s IL_0018 + IL_0004: brfalse.s IL_000f IL_0006: ldarg.0 IL_0007: ldarg.1 - IL_0008: newobj instance void Match01/Test1/clo@4::.ctor(class Match01/Test1, - class Match01/Test1) - IL_000d: stloc.0 - IL_000e: ldloc.0 - IL_000f: ldnull - IL_0010: tail. - IL_0012: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0017: ret + IL_0008: ldnull + IL_0009: call int32 Match01/Test1::CompareTo$cont@4(class Match01/Test1, + class Match01/Test1, + class [FSharp.Core]Microsoft.FSharp.Core.Unit) + IL_000e: ret - IL_0018: ldc.i4.1 - IL_0019: ret + IL_000f: ldc.i4.1 + IL_0010: ret - IL_001a: ldarg.1 - IL_001b: brfalse.s IL_001f + IL_0011: ldarg.1 + IL_0012: brfalse.s IL_0016 - IL_001d: ldc.i4.m1 - IL_001e: ret + IL_0014: ldc.i4.m1 + IL_0015: ret - IL_001f: ldc.i4.0 - IL_0020: ret + IL_0016: ldc.i4.0 + IL_0017: ret } .method public hidebysig virtual final instance int32 CompareTo(object obj) cil managed @@ -1019,43 +783,171 @@ IL_000c: ret } - .method public hidebysig virtual final - instance int32 CompareTo(object obj, - class [runtime]System.Collections.IComparer comp) cil managed + .method assembly static int32 'CompareTo$cont@4-1'(class Match01/Test1 this, + object obj, + class Match01/Test1 objTemp, + class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 5 - .locals init (class Match01/Test1 V_0, - class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_1) + .locals init (int32 V_0, + int32 V_1, + class Match01/Test1/X11 V_2, + class Match01/Test1/X11 V_3, + int32 V_4, + int32 V_5, + class Match01/Test1/X12 V_6, + class Match01/Test1/X12 V_7, + class Match01/Test1/X13 V_8, + class Match01/Test1/X13 V_9, + class Match01/Test1/X14 V_10, + class Match01/Test1/X14 V_11) + IL_0000: ldarg.1 + IL_0001: unbox.any Match01/Test1 + IL_0006: brfalse IL_00fb + + IL_000b: ldarg.0 + IL_000c: ldfld int32 Match01/Test1::_tag + IL_0011: stloc.0 + IL_0012: ldarg.2 + IL_0013: ldfld int32 Match01/Test1::_tag + IL_0018: stloc.1 + IL_0019: ldloc.0 + IL_001a: ldloc.1 + IL_001b: bne.un IL_00f7 + + IL_0020: ldarg.0 + IL_0021: call instance int32 Match01/Test1::get_Tag() + IL_0026: switch ( + IL_003b, + IL_0067, + IL_0097, + IL_00c7) + IL_003b: ldarg.0 + IL_003c: castclass Match01/Test1/X11 + IL_0041: stloc.2 + IL_0042: ldarg.2 + IL_0043: castclass Match01/Test1/X11 + IL_0048: stloc.3 + IL_0049: ldloc.2 + IL_004a: ldfld int32 Match01/Test1/X11::item + IL_004f: stloc.s V_4 + IL_0051: ldloc.3 + IL_0052: ldfld int32 Match01/Test1/X11::item + IL_0057: stloc.s V_5 + IL_0059: ldloc.s V_4 + IL_005b: ldloc.s V_5 + IL_005d: cgt + IL_005f: ldloc.s V_4 + IL_0061: ldloc.s V_5 + IL_0063: clt + IL_0065: sub + IL_0066: ret + + IL_0067: ldarg.0 + IL_0068: castclass Match01/Test1/X12 + IL_006d: stloc.s V_6 + IL_006f: ldarg.2 + IL_0070: castclass Match01/Test1/X12 + IL_0075: stloc.s V_7 + IL_0077: ldloc.s V_6 + IL_0079: ldfld int32 Match01/Test1/X12::item + IL_007e: stloc.s V_4 + IL_0080: ldloc.s V_7 + IL_0082: ldfld int32 Match01/Test1/X12::item + IL_0087: stloc.s V_5 + IL_0089: ldloc.s V_4 + IL_008b: ldloc.s V_5 + IL_008d: cgt + IL_008f: ldloc.s V_4 + IL_0091: ldloc.s V_5 + IL_0093: clt + IL_0095: sub + IL_0096: ret + + IL_0097: ldarg.0 + IL_0098: castclass Match01/Test1/X13 + IL_009d: stloc.s V_8 + IL_009f: ldarg.2 + IL_00a0: castclass Match01/Test1/X13 + IL_00a5: stloc.s V_9 + IL_00a7: ldloc.s V_8 + IL_00a9: ldfld int32 Match01/Test1/X13::item + IL_00ae: stloc.s V_4 + IL_00b0: ldloc.s V_9 + IL_00b2: ldfld int32 Match01/Test1/X13::item + IL_00b7: stloc.s V_5 + IL_00b9: ldloc.s V_4 + IL_00bb: ldloc.s V_5 + IL_00bd: cgt + IL_00bf: ldloc.s V_4 + IL_00c1: ldloc.s V_5 + IL_00c3: clt + IL_00c5: sub + IL_00c6: ret + + IL_00c7: ldarg.0 + IL_00c8: castclass Match01/Test1/X14 + IL_00cd: stloc.s V_10 + IL_00cf: ldarg.2 + IL_00d0: castclass Match01/Test1/X14 + IL_00d5: stloc.s V_11 + IL_00d7: ldloc.s V_10 + IL_00d9: ldfld int32 Match01/Test1/X14::item + IL_00de: stloc.s V_4 + IL_00e0: ldloc.s V_11 + IL_00e2: ldfld int32 Match01/Test1/X14::item + IL_00e7: stloc.s V_5 + IL_00e9: ldloc.s V_4 + IL_00eb: ldloc.s V_5 + IL_00ed: cgt + IL_00ef: ldloc.s V_4 + IL_00f1: ldloc.s V_5 + IL_00f3: clt + IL_00f5: sub + IL_00f6: ret + + IL_00f7: ldloc.0 + IL_00f8: ldloc.1 + IL_00f9: sub + IL_00fa: ret + + IL_00fb: ldc.i4.1 + IL_00fc: ret + } + + .method public hidebysig virtual final instance int32 CompareTo(object obj, class [runtime]System.Collections.IComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 6 + .locals init (class Match01/Test1 V_0) IL_0000: ldarg.1 IL_0001: unbox.any Match01/Test1 IL_0006: stloc.0 IL_0007: ldarg.0 - IL_0008: brfalse.s IL_001d + IL_0008: brfalse.s IL_0014 IL_000a: ldarg.0 IL_000b: ldarg.1 IL_000c: ldloc.0 - IL_000d: newobj instance void Match01/Test1/'clo@4-1'::.ctor(class Match01/Test1, - object, - class Match01/Test1) - IL_0012: stloc.1 - IL_0013: ldloc.1 - IL_0014: ldnull - IL_0015: tail. - IL_0017: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_001c: ret - - IL_001d: ldarg.1 - IL_001e: unbox.any Match01/Test1 - IL_0023: brfalse.s IL_0027 - - IL_0025: ldc.i4.m1 - IL_0026: ret - - IL_0027: ldc.i4.0 - IL_0028: ret + IL_000d: ldnull + IL_000e: call int32 Match01/Test1::'CompareTo$cont@4-1'(class Match01/Test1, + object, + class Match01/Test1, + class [FSharp.Core]Microsoft.FSharp.Core.Unit) + IL_0013: ret + + IL_0014: ldarg.1 + IL_0015: unbox.any Match01/Test1 + IL_001a: brfalse.s IL_001e + + IL_001c: ldc.i4.m1 + IL_001d: ret + + IL_001e: ldc.i4.0 + IL_001f: ret } .method public hidebysig virtual final instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed @@ -1179,9 +1071,7 @@ IL_000b: ret } - .method public hidebysig instance bool - Equals(class Match01/Test1 obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig instance bool Equals(class Match01/Test1 obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -1285,9 +1175,7 @@ IL_00c7: ret } - .method public hidebysig virtual final - instance bool Equals(object obj, - class [runtime]System.Collections.IEqualityComparer comp) cil managed + .method public hidebysig virtual final instance bool Equals(object obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -1558,9 +1446,7 @@ .field private class [runtime]System.Type Type@ .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) - .method public specialname rtspecialname - instance void .ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType, - class [runtime]System.Type Type) cil managed + .method public specialname rtspecialname instance void .ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType, class [runtime]System.Type Type) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeInitialization.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeInitialization.fs index fe209b3e50e..fbf3b3ac400 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeInitialization.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeInitialization.fs @@ -484,10 +484,15 @@ printfn "%A" (MyClass.result()) ] - [] // RealSig - [] // Regular + [] // RealSig Optimize + [] // RealSig NoOptimize + [] // Regular Optimize + [] // Regular NoOptimize [] - let ``nested generic closure`` (realSig) = + let ``nested generic closure`` (realSig, optimize) = + let withOptimization compilation = + if optimize then compilation |> withOptimize + else compilation |> withNoOptimize FSharp """ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. @@ -842,6 +847,325 @@ namespace Microsoft.FSharp.Core.CompilerServices """ |> asExe |> withRealInternalSignature realSig - |> withOptimize + |> withOptimization + |> compileAndRun + |> shouldSucceed + + [] // RealSig Optimize + [] // RealSig NoOptimize + [] // Regular Optimize + [] // Regular NoOptimize + [] + let ``Generic class with closure with constraints`` (realSig, optimize) = + let withOptimization compilation = + if optimize then compilation |> withOptimize + else compilation |> withNoOptimize + + FSharp """ +namespace Test +open System + +module RuntimeHelpers = + [] + type MyType<'A,'B when 'B :> seq<'A>>(sources: seq<'B>) = + + member x.MoveNext() = + let rec takeInner c = + let rec takeOuter b = + if b.ToString () = "1" then failwith "Oops" + if sources |> Seq.length > 10 then + sources |> Seq.skip 10 + else + sources + if c.ToString() = "1" then failwith "Oops" + if sources |> Seq.length < 5 then + sources + else + takeOuter 7 + takeInner 3 + +open RuntimeHelpers +module doIt = + let x = seq { ArraySegment([|1uy; 2uy; 3uy|]); ArraySegment([|1uy; 2uy; 3uy|]); ArraySegment([|1uy; 2uy; 3uy|]); } + let enumerator = x |> MyType<_,_> + for i in enumerator.MoveNext() do + printfn "%A" i + """ + |> asExe + |> withRealInternalSignature realSig + |> withOptimization |> compileAndRun |> shouldSucceed + + [] // RealSig Optimize + [] // RealSig NoOptimize + [] // Regular Optimize + [] // Regular NoOptimize + [] + let ``AgedLookup`` (realSig, optimize) = + let withOptimization compilation = + if optimize then compilation |> withOptimize + else compilation |> withNoOptimize + + FSharp """ +namespace Internal.Utilities.Collections + +open System + +[] +type internal ValueStrength<'T when 'T: not struct> = + | Strong of 'T + | Weak of WeakReference<'T> + +type internal AgedLookup<'Token, 'Key, 'Value when 'Value: not struct>(keepStrongly: int, areSimilar, ?requiredToKeep, ?keepMax: int) = + /// The list of items stored. Youngest is at the end of the list. + /// The choice of order is somewhat arbitrary. If the other way then adding + /// items would be O(1) and removing O(N). + let mutable refs: ('Key * ValueStrength<'Value>) list = [] + + let mutable keepStrongly = keepStrongly + + // The 75 here determines how long the list should be passed the end of strongly held + // references. Some operations are O(N) and we don't want to let things get out of + // hand. + let keepMax = defaultArg keepMax 75 + let mutable keepMax = max keepStrongly keepMax + let requiredToKeep = defaultArg requiredToKeep (fun _ -> false) + + /// Look up the given key, return None if not found. + let TryPeekKeyValueImpl (data, key) = + let rec Lookup key = + function + // Treat a list of key-value pairs as a lookup collection. + // This function returns true if two keys are the same according to the predicate + // function passed in. + | [] -> None + | (similarKey, value) :: t -> + if areSimilar (key, similarKey) then + Some(similarKey, value) + else + Lookup key t + + Lookup key data + + /// Determines whether a particular key exists. + let Exists (data, key) = TryPeekKeyValueImpl(data, key).IsSome + + /// Set a particular key's value. + let Add (data, key, value) = data @ [ key, value ] + + /// Promote a particular key value. + let Promote (data, key, value) = + (data |> List.filter (fun (similarKey, _) -> not (areSimilar (key, similarKey)))) + @ [ (key, value) ] + + /// Remove a particular key value. + let RemoveImpl (data, key) = + let keep = + data |> List.filter (fun (similarKey, _) -> not (areSimilar (key, similarKey))) + + keep + + let TryGetKeyValueImpl (data, key) = + match TryPeekKeyValueImpl(data, key) with + | Some(similarKey, value) as result -> + // If the result existed, move it to the end of the list (more likely to keep it) + result, Promote(data, similarKey, value) + | None -> None, data + + /// Remove weak entries from the list that have been collected. + let FilterAndHold (tok: 'Token) = + ignore tok // reading 'refs' requires a token + + [ + for key, value in refs do + match value with + | Strong(value) -> yield (key, value) + | Weak(weakReference) -> + match weakReference.TryGetTarget() with + | false, _ -> () + | true, value -> yield key, value + ] + + let AssignWithStrength (tok, newData) = + let actualLength = List.length newData + let tossThreshold = max 0 (actualLength - keepMax) // Delete everything less than this threshold + let weakThreshold = max 0 (actualLength - keepStrongly) // Weaken everything less than this threshold + + let newData = newData |> List.mapi (fun n kv -> n, kv) // Place the index. + + let newData = + newData + |> List.filter (fun (n: int, v) -> n >= tossThreshold || requiredToKeep (snd v)) + + let newData = + newData + |> List.map (fun (n: int, (k, v)) -> + let handle = + if n < weakThreshold && not (requiredToKeep v) then + Weak(WeakReference<_>(v)) + else + Strong(v) + + k, handle) + + ignore tok // Updating refs requires tok + refs <- newData + + member al.TryPeekKeyValue(tok, key) = + // Returns the original key value as well since it may be different depending on equality test. + let data = FilterAndHold(tok) + TryPeekKeyValueImpl(data, key) + + member al.TryGetKeyValue(tok, key) = + let data = FilterAndHold(tok) + let result, newData = TryGetKeyValueImpl(data, key) + AssignWithStrength(tok, newData) + result + + member al.TryGet(tok, key) = + let data = FilterAndHold(tok) + let result, newData = TryGetKeyValueImpl(data, key) + AssignWithStrength(tok, newData) + + match result with + | Some(_, value) -> Some(value) + | None -> None + + member al.Put(tok, key, value) = + let data = FilterAndHold(tok) + + let data = if Exists(data, key) then RemoveImpl(data, key) else data + + let data = Add(data, key, value) + AssignWithStrength(tok, data) // This will remove extras + + member al.Remove(tok, key) = + let data = FilterAndHold(tok) + let newData = RemoveImpl(data, key) + AssignWithStrength(tok, newData) + + member al.Clear(tok) = + let _discards = FilterAndHold(tok) + AssignWithStrength(tok, []) + + member al.Resize(tok, newKeepStrongly, ?newKeepMax) = + let newKeepMax = defaultArg newKeepMax 75 + keepStrongly <- newKeepStrongly + keepMax <- max newKeepStrongly newKeepMax + let keep = FilterAndHold(tok) + AssignWithStrength(tok, keep) + """ + |> asLibrary + |> withRealInternalSignature realSig + |> withOptimization + |> compile + |> shouldSucceed + + [] // RealSig Optimize + [] // RealSig NoOptimize + [] // Regular Optimize + [] // Regular NoOptimize + [] + let ``BigTuples`` (realSig, optimize) = + let withOptimization compilation = + if optimize then compilation |> withOptimize + else compilation |> withNoOptimize + + FSharp """ +namespace Equality + +type BigGenericTuple<'a> = BigGenericTuple of int * 'a * byte * int * 'a * byte + """ + |> asLibrary + |> withRealInternalSignature realSig + |> withOptimization + |> compile + |> shouldSucceed + + [] // RealSig Optimize + [] // RealSig NoOptimize + [] // Regular Optimize + [] // Regular NoOptimize + [] + let ``Array groupBy id`` (realSig, optimize) = + let withOptimization compilation = + if optimize then compilation |> withOptimize + else compilation |> withNoOptimize + + FSharp """ +module GroupByTest +let ``for _ in Array groupBy id [||] do ...`` () = [|for _ in Array.groupBy id [||] do 0|] + """ + |> asLibrary + |> withRealInternalSignature realSig + |> withOptimization + |> compile + |> shouldSucceed + + + let roundTripWithInterfaceGeneration(realsig, optimize, implementationFile) = + let withOptimization compilation = + if optimize then compilation |> withOptimize + else compilation |> withNoOptimize + + let generatedSignature = + Fs implementationFile + |> withRealInternalSignature realsig + |> withOptimization + |> printSignatures + + Fsi generatedSignature + |> asLibrary + |> withAdditionalSourceFile (FsSource implementationFile) + |> withRealInternalSignature realsig + |> withOptimization + |> compile + |> shouldSucceed + + [] // RealSig Optimize + [] // RealSig NoOptimize + [] // Regular Optimize + [] // Regular NoOptimize + [] + let ``generic-parameter-order-roundtrip`` (realsig, optimize) = + + let implementationFile = """ +module OrderMatters + +type IMonad<'a> = + interface + // Hash constraint leads to another type parameter + abstract bind : #IMonad<'a> -> ('a -> #IMonad<'b>) -> IMonad<'b> + end""" + + roundTripWithInterfaceGeneration(realsig, optimize, implementationFile) + + [] // RealSig Optimize + [] // RealSig NoOptimize + [] // Regular Optimize + [] // Regular NoOptimize + [] + let ``members_basic-roundtrip`` (realsig, optimize) = + + let implementationFile = """ +namespace GenericInterfaceTest + + type Foo<'a> = + interface + abstract fun1 : 'a -> 'a + abstract fun2 : int -> int + end + + + type Bar<'b> = + class + val store : 'b + interface Foo<'b> with + member self.fun1(x) = x + member self.fun2(x) = 1 + end + new(x) = { store = x } + end""" + + roundTripWithInterfaceGeneration(realsig, optimize, implementationFile) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction23.fs.il.net472.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction23.fs.il.net472.bsl index 3f4c324d6dd..879f6b4e90f 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction23.fs.il.net472.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunction23.fs.il.net472.bsl @@ -16,16 +16,6 @@ .hash algorithm 0x00008004 .ver 0:0:0:0 -} -.mresource public FSharpSignatureCompressedData.assembly -{ - - -} -.mresource public FSharpOptimizationCompressedData.assembly -{ - - } .module assembly.exe @@ -49,8 +39,7 @@ .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) .field assembly string x .field assembly string x@8 - .method public specialname rtspecialname - instance void .ctor() cil managed + .method public specialname rtspecialname instance void .ctor() cil managed { .maxstack 8 @@ -67,8 +56,7 @@ IL_001e: ret } - .method public hidebysig instance string - M() cil managed + .method public hidebysig instance string M() cil managed { .maxstack 4 @@ -84,8 +72,7 @@ IL_0013: ret } - .method assembly hidebysig instance string - g() cil managed + .method assembly hidebysig instance string g() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -101,8 +88,7 @@ extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 { .field static assembly initonly class assembly/g@13 @_instance - .method assembly specialname rtspecialname - instance void .ctor() cil managed + .method assembly specialname rtspecialname instance void .ctor() cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) @@ -113,8 +99,7 @@ IL_0006: ret } - .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.Unit - Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar0) cil managed + .method public strict virtual instance class [FSharp.Core]Microsoft.FSharp.Core.Unit Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar0) cil managed { .maxstack 8 @@ -129,8 +114,7 @@ IL_0021: ret } - .method private specialname rtspecialname static - void .cctor() cil managed + .method private specialname rtspecialname static void .cctor() cil managed { .maxstack 10 @@ -141,8 +125,7 @@ } - .method public static class [runtime]System.Tuple`2 - f(!!a x) cil managed + .method public static class [runtime]System.Tuple`2 f(!!a x) cil managed { .maxstack 5 diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunctions.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunctions.fs index 9b2ce64194e..3cb6124d34e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunctions.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/TestFunctions/TestFunctions.fs @@ -316,8 +316,15 @@ module TestFunctions = //SOURCE=TestFunction23.fs SCFLAGS="-g --test:EmitFeeFeeAs100001 --optimize-" COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd TestFunction23.exe" # TestFunction23.fs - [] - let ``TestFunction23_fs`` compilation = + let ``TestFunction23_RealInternalSignatureOff_fs`` compilation = compilation + |> withRealInternalSignatureOff + |> verifyCompilation + + [] + let ``TestFunction23_RealInternalSignatureOn_fs`` compilation = + compilation + |> withRealInternalSignatureOn |> verifyCompilation //SOURCE=TestFunction24.fs SCFLAGS="-g --optimize-" PEVER=/Exp_Fail COMPILE_ONLY=1 POSTCMD="..\\CompareIL.cmd TestFunction24.exe" # TestFunction24.fs - diff --git a/tests/FSharp.Compiler.ComponentTests/Signatures/SigGenerationRoundTripTests.fs b/tests/FSharp.Compiler.ComponentTests/Signatures/SigGenerationRoundTripTests.fs index 469f9fda0e7..d70fb546637 100644 --- a/tests/FSharp.Compiler.ComponentTests/Signatures/SigGenerationRoundTripTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Signatures/SigGenerationRoundTripTests.fs @@ -6,24 +6,24 @@ open FSharp.Test.Compiler open System.IO let testCasesDir = Path.Combine(__SOURCE_DIRECTORY__,"TestCasesForGenerationRoundTrip") -let allTestCases = - Directory.EnumerateFiles(testCasesDir) - |> Seq.toArray +let allTestCases = + Directory.EnumerateFiles(testCasesDir) + |> Seq.toArray |> Array.map Path.GetFileName |> Array.map (fun f -> [|f :> obj|]) [] [] -let ``Generate and compile`` implFileName = +let ``Generate and compile`` implFileName = let implContents = File.ReadAllText (Path.Combine(testCasesDir,implFileName)) - let generatedSignature = - Fs implContents + let generatedSignature = + Fs implContents |> withLangVersion80 |> withDefines ["TESTS_AS_APP";"COMPILED"] - |> printSignatures + |> printSignatures - Fsi generatedSignature + Fsi generatedSignature |> withAdditionalSourceFile (FsSource implContents) |> withLangVersion80 |> withDefines ["TESTS_AS_APP";"COMPILED"] diff --git a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_LessThanDotOpenParen001.fs b/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_LessThanDotOpenParen001.fs deleted file mode 100644 index a8cf50ea24b..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/resources/tests/Conformance/LexicalAnalysis/SymbolicOperators/E_LessThanDotOpenParen001.fs +++ /dev/null @@ -1,31 +0,0 @@ -// #Regression #Conformance #LexicalAnalysis #Operators -// Regression test for FSHARP1.0:4805 -// We are not really after the actual error messages here (some of them have been omitted), rather we -// want to verify we do not crash! -//This construct causes code to be less generic than indicated by the type annotations\. The type variable 'S has been constrained to be type 'int' -//This code is not sufficiently generic\. The type variable \^T when \^T : \(static member \( \+ \) : \^T \* \^T -> \^a\) could not be generalized because it would escape its scope - -type public TestType<'T,'S>() = - - member public s.Value with get() = Unchecked.defaultof<'T> - static member public (+++) (a : TestType<'T,'S>, b : TestType<'T,'S>) = a.Value - static member public (+++) (a : TestType<'T,'S>, b : 'T) = b - static member public (+++) (a : 'T, b : TestType<'T,'S>) = a - static member public (+++) (a : TestType<'T,'S>, b : 'T -> 'S) = a.Value - static member public (+++) (a : 'S -> 'T, b : TestType<'T,'S>) = (a 17) + b.Value - -let inline (+++) (a : ^a) (b : ^b) = ((^a or ^b): (static member (+++): ^a * ^b -> ^c) (a,b) ) - -let tt0 = TestType() -let tt1 = TestType() - -let f (x : string) = 18 - -let a0 = tt0 +++ tt1 -let a1 = tt0 +++ 11 -let a2 = 12 +++ tt1 -let a3 = tt0 +++ (fun x -> "18") -let a4 = f +++ tt0 - -let a5 = TestType.(+++)(f, tt0) -let a6 = TestType.(+++)((fun (x : string) -> 18), tt0) diff --git a/tests/FSharp.Test.Utilities/XunitHelpers.fs b/tests/FSharp.Test.Utilities/XunitHelpers.fs index cda74f7867c..c98ee088fe7 100644 --- a/tests/FSharp.Test.Utilities/XunitHelpers.fs +++ b/tests/FSharp.Test.Utilities/XunitHelpers.fs @@ -18,6 +18,8 @@ type FSharpXunitFramework(sink: IMessageSink) = interface IDisposable with member _.Dispose() = - cleanUpTemporaryDirectoryOfThisTestRun () - base.Dispose() + match Environment.GetEnvironmentVariable("FSHARP_RETAIN_TESTBUILDS") with + | null -> cleanUpTemporaryDirectoryOfThisTestRun () + | _ -> () + base.Dispose() From f36e0a3c66a667b6c69d58ed9b1f7a8572c81e7e Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Tue, 19 Nov 2024 17:17:40 -0800 Subject: [PATCH 2/8] code --- src/Compiler/CodeGen/IlxGen.fs | 41 +++++++++++-------- src/Compiler/TypedTree/CompilerGlobalState.fs | 4 +- src/Compiler/TypedTree/TypedTreeOps.fsi | 3 ++ 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index 2a1c876b8f5..fb4ea5ee7ac 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -521,7 +521,7 @@ let ComputeTypeAccess (tref: ILTypeRef) hidden (accessibility: Accessibility) re /// Indicates how type parameters are mapped to IL type variables [] -type TypeReprEnv(reprs: Map, count: int, templateReplacement: (TyconRef * ILTypeRef * Typars * TyparInstantiation) option) = +type TypeReprEnv(reprs: Map, count: int, templateReplacement: (TyconRef * ILTypeRef * Typars * TyparInstantiation) option) = static let empty = TypeReprEnv(count = 0, reprs = Map.empty, templateReplacement = None) @@ -536,7 +536,7 @@ type TypeReprEnv(reprs: Map, count: int, templateReplacement: (Ty /// Lookup a type parameter member _.Item(tp: Typar, m: range) = try - reprs[tp.Stamp] + reprs[tp.Stamp] |>fst with :? KeyNotFoundException -> errorR (InternalError("Undefined or unsolved type variable: " + showL (typarL tp), m)) // Random value for post-hoc diagnostic analysis on generated tree * @@ -546,7 +546,7 @@ type TypeReprEnv(reprs: Map, count: int, templateReplacement: (Ty /// then it is ignored, since it doesn't correspond to a .NET type parameter. member tyenv.AddOne(tp: Typar) = if IsNonErasedTypar tp then - TypeReprEnv(reprs.Add(tp.Stamp, uint16 count), count + 1, templateReplacement) + TypeReprEnv(reprs.Add(tp.Stamp, (uint16 count, tp)), count + 1, templateReplacement) else tyenv @@ -573,6 +573,9 @@ type TypeReprEnv(reprs: Map, count: int, templateReplacement: (Ty /// Get the environment for generating a reference to items within a type definition member eenv.ForTyconRef(tcref: TyconRef) = eenv.ForTycon tcref.Deref + /// Get a list of the Typars in this environment + member eenv.AsUserProvidedTypars() = reprs |> Map.toList |> List.map(fun (_, (_, tp)) -> tp) |> List.filter(fun tp -> not tp.IsCompilerGenerated) |> Zset.ofList typarOrder + //-------------------------------------------------------------------------- // Generate type references //-------------------------------------------------------------------------- @@ -6892,14 +6895,6 @@ and GenFreevar cenv m eenvouter tyenvinner (fv: Val) = and GetIlxClosureFreeVars cenv m (thisVars: ValRef list) boxity eenv takenNames expr = let g = cenv.g - // Choose a base name for the closure - let basename = - let boundv = eenv.letBoundVars |> List.tryFind (fun v -> not v.IsCompilerGenerated) - - match boundv with - | Some v -> v.CompiledName cenv.g.CompilerGlobalState - | None -> "clo" - // Get a unique stamp for the closure. This must be stable for things that can be part of a let rec. let uniq = match expr with @@ -6909,18 +6904,30 @@ and GetIlxClosureFreeVars cenv m (thisVars: ValRef list) boxity eenv takenNames | _ -> newUnique () // Choose a name for the closure - let ilCloTypeRef = + let ilCloTypeRef, initialFreeTyvars = + let boundvar = + eenv.letBoundVars |> List.tryFind (fun v -> not v.IsCompilerGenerated) + + let basename = + match boundvar with + | Some v -> v.CompiledName cenv.g.CompilerGlobalState + | None -> "clo" + // FSharp 1.0 bug 3404: System.Reflection doesn't like '.' and '`' in type names let basenameSafeForUseAsTypename = CleanUpGeneratedTypeName basename - let suffixmark = expr.Range - let cloName = // Ensure that we have an g.CompilerGlobalState assert (g.CompilerGlobalState |> Option.isSome) - g.CompilerGlobalState.Value.StableNameGenerator.GetUniqueCompilerGeneratedName(basenameSafeForUseAsTypename, suffixmark, uniq) + g.CompilerGlobalState.Value.StableNameGenerator.GetUniqueCompilerGeneratedName(basenameSafeForUseAsTypename, expr.Range, uniq) + + let ilCloTypeRef = NestedTypeRefForCompLoc eenv.cloc cloName + let initialFreeTyvars = + match g.realsig with + | true -> { emptyFreeTyvars with FreeTypars = eenv.tyenv.AsUserProvidedTypars() } + | false -> emptyFreeTyvars - NestedTypeRefForCompLoc eenv.cloc cloName + ilCloTypeRef, initialFreeTyvars // Collect the free variables of the closure let cloFreeVarResults = @@ -6931,7 +6938,7 @@ and GetIlxClosureFreeVars cenv m (thisVars: ValRef list) boxity eenv takenNames | None -> opts | Some(tcref, _, typars, _) -> opts.WithTemplateReplacement(tyconRefEq g tcref, typars) - freeInExpr opts expr + accFreeInExpr opts expr { emptyFreeVars with FreeTyvars = initialFreeTyvars } // Partition the free variables when some can be accessed from places besides the immediate environment // Also filter out the current value being bound, if any, as it is available from the "this" diff --git a/src/Compiler/TypedTree/CompilerGlobalState.fs b/src/Compiler/TypedTree/CompilerGlobalState.fs index 72da3da4f58..12dda2b08d8 100644 --- a/src/Compiler/TypedTree/CompilerGlobalState.fs +++ b/src/Compiler/TypedTree/CompilerGlobalState.fs @@ -73,4 +73,6 @@ let newUnique() = System.Threading.Interlocked.Increment &uniqueCount /// Unique name generator for stamps attached to to val_specs, tycon_specs etc. //++GLOBAL MUTABLE STATE (concurrency-safe) let mutable private stampCount = 0L -let newStamp() = System.Threading.Interlocked.Increment &stampCount +let newStamp() = + let stamp = System.Threading.Interlocked.Increment &stampCount + stamp \ No newline at end of file diff --git a/src/Compiler/TypedTree/TypedTreeOps.fsi b/src/Compiler/TypedTree/TypedTreeOps.fsi index 4eafbf229dc..3924cfd2dfa 100755 --- a/src/Compiler/TypedTree/TypedTreeOps.fsi +++ b/src/Compiler/TypedTree/TypedTreeOps.fsi @@ -1184,6 +1184,9 @@ val accFreeInDecisionTree: FreeVarOptions -> DecisionTree -> FreeVars -> FreeVar /// Get the free variables in a module definition. val freeInModuleOrNamespace: FreeVarOptions -> ModuleOrNamespaceContents -> FreeVars +/// Get the free variables in an expression with accumulator +val accFreeInExpr: FreeVarOptions -> Expr -> FreeVars -> FreeVars + /// Get the free variables in an expression. val freeInExpr: FreeVarOptions -> Expr -> FreeVars From 97290fb9e9af2933f5a9f95868ea9c8f5be247a5 Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Tue, 19 Nov 2024 17:36:23 -0800 Subject: [PATCH 3/8] baseline --- ...ternalSignatureOn.fs.il.net472.release.bsl | 702 ++++++++++-------- 1 file changed, 398 insertions(+), 304 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.release.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.release.bsl index 21c02964c07..6ff084e6080 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.release.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.release.bsl @@ -449,6 +449,361 @@ } } + .class auto ansi serializable sealed nested assembly beforefieldinit clo@4 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field public class Match01/Test1 this + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public class Match01/Test1 obj + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class Match01/Test1 this, class Match01/Test1 obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class Match01/Test1 Match01/Test1/clo@4::this + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class Match01/Test1 Match01/Test1/clo@4::obj + IL_0014: ret + } + + .method public strict virtual instance int32 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed + { + + .maxstack 7 + .locals init (int32 V_0, + int32 V_1, + class Match01/Test1/X11 V_2, + class Match01/Test1/X11 V_3, + class [runtime]System.Collections.IComparer V_4, + int32 V_5, + int32 V_6, + class Match01/Test1/X12 V_7, + class Match01/Test1/X12 V_8, + class Match01/Test1/X13 V_9, + class Match01/Test1/X13 V_10, + class Match01/Test1/X14 V_11, + class Match01/Test1/X14 V_12) + IL_0000: ldarg.0 + IL_0001: ldfld class Match01/Test1 Match01/Test1/clo@4::this + IL_0006: ldfld int32 Match01/Test1::_tag + IL_000b: stloc.0 + IL_000c: ldarg.0 + IL_000d: ldfld class Match01/Test1 Match01/Test1/clo@4::obj + IL_0012: ldfld int32 Match01/Test1::_tag + IL_0017: stloc.1 + IL_0018: ldloc.0 + IL_0019: ldloc.1 + IL_001a: bne.un IL_013f + + IL_001f: ldarg.0 + IL_0020: ldfld class Match01/Test1 Match01/Test1/clo@4::this + IL_0025: call instance int32 Match01/Test1::get_Tag() + IL_002a: switch ( + IL_003f, + IL_007c, + IL_00bd, + IL_00fe) + IL_003f: ldarg.0 + IL_0040: ldfld class Match01/Test1 Match01/Test1/clo@4::this + IL_0045: castclass Match01/Test1/X11 + IL_004a: stloc.2 + IL_004b: ldarg.0 + IL_004c: ldfld class Match01/Test1 Match01/Test1/clo@4::obj + IL_0051: castclass Match01/Test1/X11 + IL_0056: stloc.3 + IL_0057: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_005c: stloc.s V_4 + IL_005e: ldloc.2 + IL_005f: ldfld int32 Match01/Test1/X11::item + IL_0064: stloc.s V_5 + IL_0066: ldloc.3 + IL_0067: ldfld int32 Match01/Test1/X11::item + IL_006c: stloc.s V_6 + IL_006e: ldloc.s V_5 + IL_0070: ldloc.s V_6 + IL_0072: cgt + IL_0074: ldloc.s V_5 + IL_0076: ldloc.s V_6 + IL_0078: clt + IL_007a: sub + IL_007b: ret + + IL_007c: ldarg.0 + IL_007d: ldfld class Match01/Test1 Match01/Test1/clo@4::this + IL_0082: castclass Match01/Test1/X12 + IL_0087: stloc.s V_7 + IL_0089: ldarg.0 + IL_008a: ldfld class Match01/Test1 Match01/Test1/clo@4::obj + IL_008f: castclass Match01/Test1/X12 + IL_0094: stloc.s V_8 + IL_0096: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_009b: stloc.s V_4 + IL_009d: ldloc.s V_7 + IL_009f: ldfld int32 Match01/Test1/X12::item + IL_00a4: stloc.s V_5 + IL_00a6: ldloc.s V_8 + IL_00a8: ldfld int32 Match01/Test1/X12::item + IL_00ad: stloc.s V_6 + IL_00af: ldloc.s V_5 + IL_00b1: ldloc.s V_6 + IL_00b3: cgt + IL_00b5: ldloc.s V_5 + IL_00b7: ldloc.s V_6 + IL_00b9: clt + IL_00bb: sub + IL_00bc: ret + + IL_00bd: ldarg.0 + IL_00be: ldfld class Match01/Test1 Match01/Test1/clo@4::this + IL_00c3: castclass Match01/Test1/X13 + IL_00c8: stloc.s V_9 + IL_00ca: ldarg.0 + IL_00cb: ldfld class Match01/Test1 Match01/Test1/clo@4::obj + IL_00d0: castclass Match01/Test1/X13 + IL_00d5: stloc.s V_10 + IL_00d7: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_00dc: stloc.s V_4 + IL_00de: ldloc.s V_9 + IL_00e0: ldfld int32 Match01/Test1/X13::item + IL_00e5: stloc.s V_5 + IL_00e7: ldloc.s V_10 + IL_00e9: ldfld int32 Match01/Test1/X13::item + IL_00ee: stloc.s V_6 + IL_00f0: ldloc.s V_5 + IL_00f2: ldloc.s V_6 + IL_00f4: cgt + IL_00f6: ldloc.s V_5 + IL_00f8: ldloc.s V_6 + IL_00fa: clt + IL_00fc: sub + IL_00fd: ret + + IL_00fe: ldarg.0 + IL_00ff: ldfld class Match01/Test1 Match01/Test1/clo@4::this + IL_0104: castclass Match01/Test1/X14 + IL_0109: stloc.s V_11 + IL_010b: ldarg.0 + IL_010c: ldfld class Match01/Test1 Match01/Test1/clo@4::obj + IL_0111: castclass Match01/Test1/X14 + IL_0116: stloc.s V_12 + IL_0118: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_011d: stloc.s V_4 + IL_011f: ldloc.s V_11 + IL_0121: ldfld int32 Match01/Test1/X14::item + IL_0126: stloc.s V_5 + IL_0128: ldloc.s V_12 + IL_012a: ldfld int32 Match01/Test1/X14::item + IL_012f: stloc.s V_6 + IL_0131: ldloc.s V_5 + IL_0133: ldloc.s V_6 + IL_0135: cgt + IL_0137: ldloc.s V_5 + IL_0139: ldloc.s V_6 + IL_013b: clt + IL_013d: sub + IL_013e: ret + + IL_013f: ldloc.0 + IL_0140: ldloc.1 + IL_0141: sub + IL_0142: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'clo@4-1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field public class Match01/Test1 this + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public object obj + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public class Match01/Test1 objTemp + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname + instance void .ctor(class Match01/Test1 this, + object obj, + class Match01/Test1 objTemp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class Match01/Test1 Match01/Test1/'clo@4-1'::this + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld object Match01/Test1/'clo@4-1'::obj + IL_0014: ldarg.0 + IL_0015: ldarg.3 + IL_0016: stfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp + IL_001b: ret + } + + .method public strict virtual instance int32 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed + { + + .maxstack 7 + .locals init (int32 V_0, + int32 V_1, + class Match01/Test1/X11 V_2, + class Match01/Test1/X11 V_3, + int32 V_4, + int32 V_5, + class Match01/Test1/X12 V_6, + class Match01/Test1/X12 V_7, + class Match01/Test1/X13 V_8, + class Match01/Test1/X13 V_9, + class Match01/Test1/X14 V_10, + class Match01/Test1/X14 V_11) + IL_0000: ldarg.0 + IL_0001: ldfld object Match01/Test1/'clo@4-1'::obj + IL_0006: unbox.any Match01/Test1 + IL_000b: brfalse IL_0137 + + IL_0010: ldarg.0 + IL_0011: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this + IL_0016: ldfld int32 Match01/Test1::_tag + IL_001b: stloc.0 + IL_001c: ldarg.0 + IL_001d: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp + IL_0022: ldfld int32 Match01/Test1::_tag + IL_0027: stloc.1 + IL_0028: ldloc.0 + IL_0029: ldloc.1 + IL_002a: bne.un IL_0133 + + IL_002f: ldarg.0 + IL_0030: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this + IL_0035: call instance int32 Match01/Test1::get_Tag() + IL_003a: switch ( + IL_004f, + IL_0085, + IL_00bf, + IL_00f9) + IL_004f: ldarg.0 + IL_0050: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this + IL_0055: castclass Match01/Test1/X11 + IL_005a: stloc.2 + IL_005b: ldarg.0 + IL_005c: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp + IL_0061: castclass Match01/Test1/X11 + IL_0066: stloc.3 + IL_0067: ldloc.2 + IL_0068: ldfld int32 Match01/Test1/X11::item + IL_006d: stloc.s V_4 + IL_006f: ldloc.3 + IL_0070: ldfld int32 Match01/Test1/X11::item + IL_0075: stloc.s V_5 + IL_0077: ldloc.s V_4 + IL_0079: ldloc.s V_5 + IL_007b: cgt + IL_007d: ldloc.s V_4 + IL_007f: ldloc.s V_5 + IL_0081: clt + IL_0083: sub + IL_0084: ret + + IL_0085: ldarg.0 + IL_0086: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this + IL_008b: castclass Match01/Test1/X12 + IL_0090: stloc.s V_6 + IL_0092: ldarg.0 + IL_0093: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp + IL_0098: castclass Match01/Test1/X12 + IL_009d: stloc.s V_7 + IL_009f: ldloc.s V_6 + IL_00a1: ldfld int32 Match01/Test1/X12::item + IL_00a6: stloc.s V_4 + IL_00a8: ldloc.s V_7 + IL_00aa: ldfld int32 Match01/Test1/X12::item + IL_00af: stloc.s V_5 + IL_00b1: ldloc.s V_4 + IL_00b3: ldloc.s V_5 + IL_00b5: cgt + IL_00b7: ldloc.s V_4 + IL_00b9: ldloc.s V_5 + IL_00bb: clt + IL_00bd: sub + IL_00be: ret + + IL_00bf: ldarg.0 + IL_00c0: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this + IL_00c5: castclass Match01/Test1/X13 + IL_00ca: stloc.s V_8 + IL_00cc: ldarg.0 + IL_00cd: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp + IL_00d2: castclass Match01/Test1/X13 + IL_00d7: stloc.s V_9 + IL_00d9: ldloc.s V_8 + IL_00db: ldfld int32 Match01/Test1/X13::item + IL_00e0: stloc.s V_4 + IL_00e2: ldloc.s V_9 + IL_00e4: ldfld int32 Match01/Test1/X13::item + IL_00e9: stloc.s V_5 + IL_00eb: ldloc.s V_4 + IL_00ed: ldloc.s V_5 + IL_00ef: cgt + IL_00f1: ldloc.s V_4 + IL_00f3: ldloc.s V_5 + IL_00f5: clt + IL_00f7: sub + IL_00f8: ret + + IL_00f9: ldarg.0 + IL_00fa: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this + IL_00ff: castclass Match01/Test1/X14 + IL_0104: stloc.s V_10 + IL_0106: ldarg.0 + IL_0107: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp + IL_010c: castclass Match01/Test1/X14 + IL_0111: stloc.s V_11 + IL_0113: ldloc.s V_10 + IL_0115: ldfld int32 Match01/Test1/X14::item + IL_011a: stloc.s V_4 + IL_011c: ldloc.s V_11 + IL_011e: ldfld int32 Match01/Test1/X14::item + IL_0123: stloc.s V_5 + IL_0125: ldloc.s V_4 + IL_0127: ldloc.s V_5 + IL_0129: cgt + IL_012b: ldloc.s V_4 + IL_012d: ldloc.s V_5 + IL_012f: clt + IL_0131: sub + IL_0132: ret + + IL_0133: ldloc.0 + IL_0134: ldloc.1 + IL_0135: sub + IL_0136: ret + + IL_0137: ldc.i4.1 + IL_0138: ret + } + + } + .field assembly initonly int32 _tag .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) @@ -604,171 +959,40 @@ IL_0015: ret } - .method assembly static int32 CompareTo$cont@4(class Match01/Test1 this, - class Match01/Test1 obj, - class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 5 - .locals init (int32 V_0, - int32 V_1, - class Match01/Test1/X11 V_2, - class Match01/Test1/X11 V_3, - class [runtime]System.Collections.IComparer V_4, - int32 V_5, - int32 V_6, - class Match01/Test1/X12 V_7, - class Match01/Test1/X12 V_8, - class Match01/Test1/X13 V_9, - class Match01/Test1/X13 V_10, - class Match01/Test1/X14 V_11, - class Match01/Test1/X14 V_12) - IL_0000: ldarg.0 - IL_0001: ldfld int32 Match01/Test1::_tag - IL_0006: stloc.0 - IL_0007: ldarg.1 - IL_0008: ldfld int32 Match01/Test1::_tag - IL_000d: stloc.1 - IL_000e: ldloc.0 - IL_000f: ldloc.1 - IL_0010: bne.un IL_0108 - - IL_0015: ldarg.0 - IL_0016: call instance int32 Match01/Test1::get_Tag() - IL_001b: switch ( - IL_0030, - IL_0063, - IL_009a, - IL_00d1) - IL_0030: ldarg.0 - IL_0031: castclass Match01/Test1/X11 - IL_0036: stloc.2 - IL_0037: ldarg.1 - IL_0038: castclass Match01/Test1/X11 - IL_003d: stloc.3 - IL_003e: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() - IL_0043: stloc.s V_4 - IL_0045: ldloc.2 - IL_0046: ldfld int32 Match01/Test1/X11::item - IL_004b: stloc.s V_5 - IL_004d: ldloc.3 - IL_004e: ldfld int32 Match01/Test1/X11::item - IL_0053: stloc.s V_6 - IL_0055: ldloc.s V_5 - IL_0057: ldloc.s V_6 - IL_0059: cgt - IL_005b: ldloc.s V_5 - IL_005d: ldloc.s V_6 - IL_005f: clt - IL_0061: sub - IL_0062: ret - - IL_0063: ldarg.0 - IL_0064: castclass Match01/Test1/X12 - IL_0069: stloc.s V_7 - IL_006b: ldarg.1 - IL_006c: castclass Match01/Test1/X12 - IL_0071: stloc.s V_8 - IL_0073: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() - IL_0078: stloc.s V_4 - IL_007a: ldloc.s V_7 - IL_007c: ldfld int32 Match01/Test1/X12::item - IL_0081: stloc.s V_5 - IL_0083: ldloc.s V_8 - IL_0085: ldfld int32 Match01/Test1/X12::item - IL_008a: stloc.s V_6 - IL_008c: ldloc.s V_5 - IL_008e: ldloc.s V_6 - IL_0090: cgt - IL_0092: ldloc.s V_5 - IL_0094: ldloc.s V_6 - IL_0096: clt - IL_0098: sub - IL_0099: ret - - IL_009a: ldarg.0 - IL_009b: castclass Match01/Test1/X13 - IL_00a0: stloc.s V_9 - IL_00a2: ldarg.1 - IL_00a3: castclass Match01/Test1/X13 - IL_00a8: stloc.s V_10 - IL_00aa: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() - IL_00af: stloc.s V_4 - IL_00b1: ldloc.s V_9 - IL_00b3: ldfld int32 Match01/Test1/X13::item - IL_00b8: stloc.s V_5 - IL_00ba: ldloc.s V_10 - IL_00bc: ldfld int32 Match01/Test1/X13::item - IL_00c1: stloc.s V_6 - IL_00c3: ldloc.s V_5 - IL_00c5: ldloc.s V_6 - IL_00c7: cgt - IL_00c9: ldloc.s V_5 - IL_00cb: ldloc.s V_6 - IL_00cd: clt - IL_00cf: sub - IL_00d0: ret - - IL_00d1: ldarg.0 - IL_00d2: castclass Match01/Test1/X14 - IL_00d7: stloc.s V_11 - IL_00d9: ldarg.1 - IL_00da: castclass Match01/Test1/X14 - IL_00df: stloc.s V_12 - IL_00e1: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() - IL_00e6: stloc.s V_4 - IL_00e8: ldloc.s V_11 - IL_00ea: ldfld int32 Match01/Test1/X14::item - IL_00ef: stloc.s V_5 - IL_00f1: ldloc.s V_12 - IL_00f3: ldfld int32 Match01/Test1/X14::item - IL_00f8: stloc.s V_6 - IL_00fa: ldloc.s V_5 - IL_00fc: ldloc.s V_6 - IL_00fe: cgt - IL_0100: ldloc.s V_5 - IL_0102: ldloc.s V_6 - IL_0104: clt - IL_0106: sub - IL_0107: ret - - IL_0108: ldloc.0 - IL_0109: ldloc.1 - IL_010a: sub - IL_010b: ret - } - .method public hidebysig virtual final instance int32 CompareTo(class Match01/Test1 obj) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .maxstack 8 + .maxstack 4 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_0) IL_0000: ldarg.0 - IL_0001: brfalse.s IL_0011 + IL_0001: brfalse.s IL_001a IL_0003: ldarg.1 - IL_0004: brfalse.s IL_000f + IL_0004: brfalse.s IL_0018 IL_0006: ldarg.0 IL_0007: ldarg.1 - IL_0008: ldnull - IL_0009: call int32 Match01/Test1::CompareTo$cont@4(class Match01/Test1, - class Match01/Test1, - class [FSharp.Core]Microsoft.FSharp.Core.Unit) - IL_000e: ret + IL_0008: newobj instance void Match01/Test1/clo@4::.ctor(class Match01/Test1, + class Match01/Test1) + IL_000d: stloc.0 + IL_000e: ldloc.0 + IL_000f: ldnull + IL_0010: tail. + IL_0012: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0017: ret - IL_000f: ldc.i4.1 - IL_0010: ret + IL_0018: ldc.i4.1 + IL_0019: ret - IL_0011: ldarg.1 - IL_0012: brfalse.s IL_0016 + IL_001a: ldarg.1 + IL_001b: brfalse.s IL_001f - IL_0014: ldc.i4.m1 - IL_0015: ret + IL_001d: ldc.i4.m1 + IL_001e: ret - IL_0016: ldc.i4.0 - IL_0017: ret + IL_001f: ldc.i4.0 + IL_0020: ret } .method public hidebysig virtual final instance int32 CompareTo(object obj) cil managed @@ -783,171 +1007,41 @@ IL_000c: ret } - .method assembly static int32 'CompareTo$cont@4-1'(class Match01/Test1 this, - object obj, - class Match01/Test1 objTemp, - class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed - { - .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - - .maxstack 5 - .locals init (int32 V_0, - int32 V_1, - class Match01/Test1/X11 V_2, - class Match01/Test1/X11 V_3, - int32 V_4, - int32 V_5, - class Match01/Test1/X12 V_6, - class Match01/Test1/X12 V_7, - class Match01/Test1/X13 V_8, - class Match01/Test1/X13 V_9, - class Match01/Test1/X14 V_10, - class Match01/Test1/X14 V_11) - IL_0000: ldarg.1 - IL_0001: unbox.any Match01/Test1 - IL_0006: brfalse IL_00fb - - IL_000b: ldarg.0 - IL_000c: ldfld int32 Match01/Test1::_tag - IL_0011: stloc.0 - IL_0012: ldarg.2 - IL_0013: ldfld int32 Match01/Test1::_tag - IL_0018: stloc.1 - IL_0019: ldloc.0 - IL_001a: ldloc.1 - IL_001b: bne.un IL_00f7 - - IL_0020: ldarg.0 - IL_0021: call instance int32 Match01/Test1::get_Tag() - IL_0026: switch ( - IL_003b, - IL_0067, - IL_0097, - IL_00c7) - IL_003b: ldarg.0 - IL_003c: castclass Match01/Test1/X11 - IL_0041: stloc.2 - IL_0042: ldarg.2 - IL_0043: castclass Match01/Test1/X11 - IL_0048: stloc.3 - IL_0049: ldloc.2 - IL_004a: ldfld int32 Match01/Test1/X11::item - IL_004f: stloc.s V_4 - IL_0051: ldloc.3 - IL_0052: ldfld int32 Match01/Test1/X11::item - IL_0057: stloc.s V_5 - IL_0059: ldloc.s V_4 - IL_005b: ldloc.s V_5 - IL_005d: cgt - IL_005f: ldloc.s V_4 - IL_0061: ldloc.s V_5 - IL_0063: clt - IL_0065: sub - IL_0066: ret - - IL_0067: ldarg.0 - IL_0068: castclass Match01/Test1/X12 - IL_006d: stloc.s V_6 - IL_006f: ldarg.2 - IL_0070: castclass Match01/Test1/X12 - IL_0075: stloc.s V_7 - IL_0077: ldloc.s V_6 - IL_0079: ldfld int32 Match01/Test1/X12::item - IL_007e: stloc.s V_4 - IL_0080: ldloc.s V_7 - IL_0082: ldfld int32 Match01/Test1/X12::item - IL_0087: stloc.s V_5 - IL_0089: ldloc.s V_4 - IL_008b: ldloc.s V_5 - IL_008d: cgt - IL_008f: ldloc.s V_4 - IL_0091: ldloc.s V_5 - IL_0093: clt - IL_0095: sub - IL_0096: ret - - IL_0097: ldarg.0 - IL_0098: castclass Match01/Test1/X13 - IL_009d: stloc.s V_8 - IL_009f: ldarg.2 - IL_00a0: castclass Match01/Test1/X13 - IL_00a5: stloc.s V_9 - IL_00a7: ldloc.s V_8 - IL_00a9: ldfld int32 Match01/Test1/X13::item - IL_00ae: stloc.s V_4 - IL_00b0: ldloc.s V_9 - IL_00b2: ldfld int32 Match01/Test1/X13::item - IL_00b7: stloc.s V_5 - IL_00b9: ldloc.s V_4 - IL_00bb: ldloc.s V_5 - IL_00bd: cgt - IL_00bf: ldloc.s V_4 - IL_00c1: ldloc.s V_5 - IL_00c3: clt - IL_00c5: sub - IL_00c6: ret - - IL_00c7: ldarg.0 - IL_00c8: castclass Match01/Test1/X14 - IL_00cd: stloc.s V_10 - IL_00cf: ldarg.2 - IL_00d0: castclass Match01/Test1/X14 - IL_00d5: stloc.s V_11 - IL_00d7: ldloc.s V_10 - IL_00d9: ldfld int32 Match01/Test1/X14::item - IL_00de: stloc.s V_4 - IL_00e0: ldloc.s V_11 - IL_00e2: ldfld int32 Match01/Test1/X14::item - IL_00e7: stloc.s V_5 - IL_00e9: ldloc.s V_4 - IL_00eb: ldloc.s V_5 - IL_00ed: cgt - IL_00ef: ldloc.s V_4 - IL_00f1: ldloc.s V_5 - IL_00f3: clt - IL_00f5: sub - IL_00f6: ret - - IL_00f7: ldloc.0 - IL_00f8: ldloc.1 - IL_00f9: sub - IL_00fa: ret - - IL_00fb: ldc.i4.1 - IL_00fc: ret - } - .method public hidebysig virtual final instance int32 CompareTo(object obj, class [runtime]System.Collections.IComparer comp) cil managed { .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) - .maxstack 6 - .locals init (class Match01/Test1 V_0) + .maxstack 5 + .locals init (class Match01/Test1 V_0, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_1) IL_0000: ldarg.1 IL_0001: unbox.any Match01/Test1 IL_0006: stloc.0 IL_0007: ldarg.0 - IL_0008: brfalse.s IL_0014 + IL_0008: brfalse.s IL_001d IL_000a: ldarg.0 IL_000b: ldarg.1 IL_000c: ldloc.0 - IL_000d: ldnull - IL_000e: call int32 Match01/Test1::'CompareTo$cont@4-1'(class Match01/Test1, - object, - class Match01/Test1, - class [FSharp.Core]Microsoft.FSharp.Core.Unit) - IL_0013: ret - - IL_0014: ldarg.1 - IL_0015: unbox.any Match01/Test1 - IL_001a: brfalse.s IL_001e - - IL_001c: ldc.i4.m1 - IL_001d: ret - - IL_001e: ldc.i4.0 - IL_001f: ret + IL_000d: newobj instance void Match01/Test1/'clo@4-1'::.ctor(class Match01/Test1, + object, + class Match01/Test1) + IL_0012: stloc.1 + IL_0013: ldloc.1 + IL_0014: ldnull + IL_0015: tail. + IL_0017: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_001c: ret + + IL_001d: ldarg.1 + IL_001e: unbox.any Match01/Test1 + IL_0023: brfalse.s IL_0027 + + IL_0025: ldc.i4.m1 + IL_0026: ret + + IL_0027: ldc.i4.0 + IL_0028: ret } .method public hidebysig virtual final instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed From e9723353a2d27a304b43916ae0a9176e8cfff81b Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Tue, 19 Nov 2024 20:49:04 -0800 Subject: [PATCH 4/8] fantomas --- src/Compiler/CodeGen/IlxGen.fs | 25 +++++++-- .../CodeGen/EmittedIL/TaskGeneratedCode.fs | 56 +++++++++---------- 2 files changed, 48 insertions(+), 33 deletions(-) diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index fb4ea5ee7ac..f126024e0ea 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -521,7 +521,8 @@ let ComputeTypeAccess (tref: ILTypeRef) hidden (accessibility: Accessibility) re /// Indicates how type parameters are mapped to IL type variables [] -type TypeReprEnv(reprs: Map, count: int, templateReplacement: (TyconRef * ILTypeRef * Typars * TyparInstantiation) option) = +type TypeReprEnv + (reprs: Map, count: int, templateReplacement: (TyconRef * ILTypeRef * Typars * TyparInstantiation) option) = static let empty = TypeReprEnv(count = 0, reprs = Map.empty, templateReplacement = None) @@ -536,7 +537,7 @@ type TypeReprEnv(reprs: Map, count: int, templateReplac /// Lookup a type parameter member _.Item(tp: Typar, m: range) = try - reprs[tp.Stamp] |>fst + reprs[tp.Stamp] |> fst with :? KeyNotFoundException -> errorR (InternalError("Undefined or unsolved type variable: " + showL (typarL tp), m)) // Random value for post-hoc diagnostic analysis on generated tree * @@ -574,7 +575,12 @@ type TypeReprEnv(reprs: Map, count: int, templateReplac member eenv.ForTyconRef(tcref: TyconRef) = eenv.ForTycon tcref.Deref /// Get a list of the Typars in this environment - member eenv.AsUserProvidedTypars() = reprs |> Map.toList |> List.map(fun (_, (_, tp)) -> tp) |> List.filter(fun tp -> not tp.IsCompilerGenerated) |> Zset.ofList typarOrder + member eenv.AsUserProvidedTypars() = + reprs + |> Map.toList + |> List.map (fun (_, (_, tp)) -> tp) + |> List.filter (fun tp -> not tp.IsCompilerGenerated) + |> Zset.ofList typarOrder //-------------------------------------------------------------------------- // Generate type references @@ -6922,9 +6928,13 @@ and GetIlxClosureFreeVars cenv m (thisVars: ValRef list) boxity eenv takenNames g.CompilerGlobalState.Value.StableNameGenerator.GetUniqueCompilerGeneratedName(basenameSafeForUseAsTypename, expr.Range, uniq) let ilCloTypeRef = NestedTypeRefForCompLoc eenv.cloc cloName + let initialFreeTyvars = match g.realsig with - | true -> { emptyFreeTyvars with FreeTypars = eenv.tyenv.AsUserProvidedTypars() } + | true -> + { emptyFreeTyvars with + FreeTypars = eenv.tyenv.AsUserProvidedTypars() + } | false -> emptyFreeTyvars ilCloTypeRef, initialFreeTyvars @@ -6938,7 +6948,12 @@ and GetIlxClosureFreeVars cenv m (thisVars: ValRef list) boxity eenv takenNames | None -> opts | Some(tcref, _, typars, _) -> opts.WithTemplateReplacement(tyconRefEq g tcref, typars) - accFreeInExpr opts expr { emptyFreeVars with FreeTyvars = initialFreeTyvars } + accFreeInExpr + opts + expr + { emptyFreeVars with + FreeTyvars = initialFreeTyvars + } // Partition the free variables when some can be accessed from places besides the immediate environment // Also filter out the current value being bound, if any, as it is available from the "this" diff --git a/tests/fsharp/Compiler/CodeGen/EmittedIL/TaskGeneratedCode.fs b/tests/fsharp/Compiler/CodeGen/EmittedIL/TaskGeneratedCode.fs index 7fe5a0db4b4..d4f5c692e05 100644 --- a/tests/fsharp/Compiler/CodeGen/EmittedIL/TaskGeneratedCode.fs +++ b/tests/fsharp/Compiler/CodeGen/EmittedIL/TaskGeneratedCode.fs @@ -1104,7 +1104,7 @@ type Generic1InGeneric1<'T>() = extends [runtime]System.Object { .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 03 00 00 00 00 00 ) - .class auto autochar sealed nested assembly beforefieldinit specialname clo@7 + .class auto autochar sealed nested assembly beforefieldinit specialname clo@7 extends [runtime]System.ValueType implements [runtime]System.Runtime.CompilerServices.IAsyncStateMachine, class [FSharp.Core]Microsoft.FSharp.Core.CompilerServices.IResumableStateMachine`1> @@ -1132,7 +1132,7 @@ type Generic1InGeneric1<'T>() = class [runtime]System.Exception V_9, class [runtime]System.Exception V_10) IL_0000: ldarg.0 - IL_0001: ldfld int32 valuetype Test/Generic1InGeneric1`1/clo@7::ResumptionPoint + IL_0001: ldfld int32 valuetype Test/Generic1InGeneric1`1/clo@7::ResumptionPoint IL_0006: stloc.0 IL_0007: ldloc.0 IL_0008: ldc.i4.1 @@ -1161,16 +1161,16 @@ type Generic1InGeneric1<'T>() = IL_002c: nop IL_002d: ldarg.0 - IL_002e: ldfld class [runtime]System.Threading.Tasks.Task`1 valuetype Test/Generic1InGeneric1`1/clo@7::computation + IL_002e: ldfld class [runtime]System.Threading.Tasks.Task`1 valuetype Test/Generic1InGeneric1`1/clo@7::computation IL_0033: stloc.3 IL_0034: ldarg.0 IL_0035: ldloc.3 IL_0036: callvirt instance valuetype [netstandard]System.Runtime.CompilerServices.TaskAwaiter`1 class [netstandard]System.Threading.Tasks.Task`1::GetAwaiter() - IL_003b: stfld valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter + IL_003b: stfld valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter IL_0040: ldc.i4.1 IL_0041: stloc.s V_4 IL_0043: ldarg.0 - IL_0044: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter + IL_0044: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter IL_0049: call instance bool valuetype [netstandard]System.Runtime.CompilerServices.TaskAwaiter`1::get_IsCompleted() IL_004e: brfalse.s IL_0052 @@ -1185,7 +1185,7 @@ type Generic1InGeneric1<'T>() = IL_0059: ldarg.0 IL_005a: ldc.i4.1 - IL_005b: stfld int32 valuetype Test/Generic1InGeneric1`1/clo@7::ResumptionPoint + IL_005b: stfld int32 valuetype Test/Generic1InGeneric1`1/clo@7::ResumptionPoint IL_0060: ldc.i4.0 IL_0061: nop IL_0062: stloc.s V_5 @@ -1199,13 +1199,13 @@ type Generic1InGeneric1<'T>() = IL_006e: brfalse.s IL_0092 IL_0070: ldarg.0 - IL_0071: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter + IL_0071: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter IL_0076: call instance !0 valuetype [netstandard]System.Runtime.CompilerServices.TaskAwaiter`1::GetResult() IL_007b: stloc.s V_6 IL_007d: ldloc.s V_6 IL_007f: stloc.s V_7 IL_0081: ldarg.0 - IL_0082: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_0082: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data IL_0087: ldloc.s V_7 IL_0089: stfld !0 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::Result IL_008e: ldc.i4.1 @@ -1213,13 +1213,13 @@ type Generic1InGeneric1<'T>() = IL_0090: br.s IL_00ab IL_0092: ldarg.0 - IL_0093: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_0093: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data IL_0098: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder IL_009d: ldarg.0 - IL_009e: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter + IL_009e: ldflda valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter IL_00a3: ldarg.0 - IL_00a4: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::AwaitUnsafeOnCompleted,valuetype Test/Generic1InGeneric1`1/clo@7>(!!0&, - !!1&) + IL_00a4: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::AwaitUnsafeOnCompleted,valuetype Test/Generic1InGeneric1`1/clo@7>(!!0&, + !!1&) IL_00a9: ldc.i4.0 IL_00aa: nop IL_00ab: brfalse.s IL_00c1 @@ -1228,7 +1228,7 @@ type Generic1InGeneric1<'T>() = IL_00ae: ldloca.s V_8 IL_00b0: initobj valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 IL_00b6: ldloc.s V_8 - IL_00b8: stfld valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter + IL_00b8: stfld valuetype [runtime]System.Runtime.CompilerServices.TaskAwaiter`1 valuetype Test/Generic1InGeneric1`1/clo@7::awaiter IL_00bd: ldc.i4.1 IL_00be: nop IL_00bf: br.s IL_00c3 @@ -1240,10 +1240,10 @@ type Generic1InGeneric1<'T>() = IL_00c5: brfalse.s IL_00e4 IL_00c7: ldarg.0 - IL_00c8: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_00c8: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data IL_00cd: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder IL_00d2: ldarg.0 - IL_00d3: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_00d3: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data IL_00d8: ldfld !0 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::Result IL_00dd: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetResult(!0) IL_00e2: leave.s IL_00f2 @@ -1268,7 +1268,7 @@ type Generic1InGeneric1<'T>() = IL_00f9: ret IL_00fa: ldarg.0 - IL_00fb: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_00fb: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data IL_0100: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder IL_0105: ldloc.s V_10 IL_0107: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetException(class [netstandard]System.Exception) @@ -1281,7 +1281,7 @@ type Generic1InGeneric1<'T>() = .maxstack 8 IL_0000: ldarg.0 - IL_0001: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_0001: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data IL_0006: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder IL_000b: ldarg.1 IL_000c: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::SetStateMachine(class [netstandard]System.Runtime.CompilerServices.IAsyncStateMachine) @@ -1294,7 +1294,7 @@ type Generic1InGeneric1<'T>() = .maxstack 8 IL_0000: ldarg.0 - IL_0001: ldfld int32 valuetype Test/Generic1InGeneric1`1/clo@7::ResumptionPoint + IL_0001: ldfld int32 valuetype Test/Generic1InGeneric1`1/clo@7::ResumptionPoint IL_0006: ret } @@ -1304,7 +1304,7 @@ type Generic1InGeneric1<'T>() = .maxstack 8 IL_0000: ldarg.0 - IL_0001: ldfld valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_0001: ldfld valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data IL_0006: ret } @@ -1315,7 +1315,7 @@ type Generic1InGeneric1<'T>() = .maxstack 8 IL_0000: ldarg.0 IL_0001: ldarg.1 - IL_0002: stfld valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_0002: stfld valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data IL_0007: ret } @@ -1348,26 +1348,26 @@ type Generic1InGeneric1<'T>() = .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) .maxstack 4 - .locals init (valuetype Test/Generic1InGeneric1`1/clo@7 V_0, - valuetype Test/Generic1InGeneric1`1/clo@7& V_1) + .locals init (valuetype Test/Generic1InGeneric1`1/clo@7 V_0, + valuetype Test/Generic1InGeneric1`1/clo@7& V_1) IL_0000: ldloca.s V_0 - IL_0002: initobj valuetype Test/Generic1InGeneric1`1/clo@7 + IL_0002: initobj valuetype Test/Generic1InGeneric1`1/clo@7 IL_0008: ldloca.s V_0 IL_000a: stloc.1 IL_000b: ldloc.1 IL_000c: ldarg.1 - IL_000d: stfld class [runtime]System.Threading.Tasks.Task`1 valuetype Test/Generic1InGeneric1`1/clo@7::computation + IL_000d: stfld class [runtime]System.Threading.Tasks.Task`1 valuetype Test/Generic1InGeneric1`1/clo@7::computation IL_0012: ldloc.1 - IL_0013: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_0013: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data IL_0018: call valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::Create() IL_001d: stfld valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder IL_0022: ldloc.1 - IL_0023: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_0023: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data IL_0028: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder IL_002d: ldloc.1 - IL_002e: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::Start>(!!0&) + IL_002e: call instance void valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::Start>(!!0&) IL_0033: ldloc.1 - IL_0034: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data + IL_0034: ldflda valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1 valuetype Test/Generic1InGeneric1`1/clo@7::Data IL_0039: ldflda valuetype [runtime]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1 valuetype [FSharp.Core]Microsoft.FSharp.Control.TaskStateMachineData`1::MethodBuilder IL_003e: call instance class [netstandard]System.Threading.Tasks.Task`1 valuetype [netstandard]System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1::get_Task() IL_0043: ret From 2b7d917f1fdef6d7237d7670bbc60c3dcc6cce86 Mon Sep 17 00:00:00 2001 From: Kevin Ransom Date: Tue, 19 Nov 2024 21:19:07 -0800 Subject: [PATCH 5/8] release notes --- docs/release-notes/.FSharp.Compiler.Service/9.0.200.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md b/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md index 232853cfea5..46e2a1bf2bd 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md +++ b/docs/release-notes/.FSharp.Compiler.Service/9.0.200.md @@ -1,5 +1,6 @@ ### Fixed +* Fix Realsig+ generates nested closures with incorrect Generic ([Issue #17797](https://github.com/dotnet/fsharp/issues/17797), [PR #17877](https://github.com/dotnet/fsharp/pull/17877)) * Fix missing TailCall warning in Sequential in use scope ([PR #17927](https://github.com/dotnet/fsharp/pull/17927)) * Fix false negatives for passing null to "obj" arguments. Only "obj | null" can now subsume any type ([PR #17757](https://github.com/dotnet/fsharp/pull/17757)) * Fix internal error when calling 'AddSingleton' and other overloads only differing in generic arity ([PR #17804](https://github.com/dotnet/fsharp/pull/17804)) From d2ff43937aaa6c6446d1622b4e0308b9bc21da5d Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Thu, 21 Nov 2024 10:56:38 -0800 Subject: [PATCH 6/8] ilverify baselines --- .gitignore | 3 +++ eng/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl | 4 ++-- ...lverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index b8072b11e90..33c9666c14b 100644 --- a/.gitignore +++ b/.gitignore @@ -132,3 +132,6 @@ micro.exe positive.exe /tests/FSharp.Compiler.ComponentTests/FSharpChecker/StandardError.txt /tests/FSharp.Compiler.ComponentTests/FSharpChecker/StandardOutput.txt + +# ilverify baseline result files +*.bsl.actual \ No newline at end of file diff --git a/eng/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl b/eng/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl index 7de0bcd6baf..4c33e3e6e6a 100644 --- a/eng/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl +++ b/eng/ilverify_FSharp.Compiler.Service_Release_net9.0.bsl @@ -43,8 +43,8 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.ParseAndCheckInputs+CheckMultipleInputsUsingGraphMode@1865::Invoke(int32)][offset 0x0000003A][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x0000059C][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x000005A5][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000011][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1850-1'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>'] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000012][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1850'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,T0>'] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000011][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1859-1'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>'] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000012][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1859'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,T0>'] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.PatternMatchCompilation::isProblematicClause([FSharp.Compiler.Service]FSharp.Compiler.PatternMatchCompilation+MatchClause)][offset 0x00000040][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.PatternMatchCompilation::.cctor()][offset 0x0000000B][found Boolean] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.TypeProviders::ValidateExpectedName([FSharp.Compiler.Service]FSharp.Compiler.Text.Range, string[], string, [FSharp.Compiler.Service]FSharp.Compiler.Tainted`1)][offset 0x000000A8][found Char] Unexpected type on the stack. diff --git a/eng/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl b/eng/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl index 21b484b426d..63ea5a4a9e0 100644 --- a/eng/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl +++ b/eng/ilverify_FSharp.Compiler.Service_Release_netstandard2.0.bsl @@ -61,8 +61,8 @@ [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerImports+TcConfig-TryResolveLibWithDirectories@558-1::Invoke([FSharp.Core]Microsoft.FSharp.Core.Unit)][offset 0x0000003B][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x0000059C][found Char] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.CompilerConfig+TcConfig::.ctor([FSharp.Compiler.Service]FSharp.Compiler.CompilerConfig+TcConfigBuilder, bool)][offset 0x000005A5][found Char] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000011][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1850-1'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>'] Unexpected type on the stack. -[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000012][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1850'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,T0>'] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000011][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1859-1'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,int32>'] Unexpected type on the stack. +[IL]: Error [StackUnexpected]: : FSharp.Compiler.IlxGen::HashRangeSorted([S.P.CoreLib]System.Collections.Generic.IDictionary`2>)][offset 0x00000012][found ref '[FSharp.Compiler.Service]FSharp.Compiler.IlxGen+HashRangeSorted@1859'][expected ref '[FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2,T0>'] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.PatternMatchCompilation::isProblematicClause([FSharp.Compiler.Service]FSharp.Compiler.PatternMatchCompilation+MatchClause)][offset 0x00000040][found Byte] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : .$FSharp.Compiler.PatternMatchCompilation::.cctor()][offset 0x0000000B][found Boolean] Unexpected type on the stack. [IL]: Error [StackUnexpected]: : FSharp.Compiler.NicePrint+TastDefinitionPrinting+meths@2092-3::Invoke([FSharp.Compiler.Service]FSharp.Compiler.Infos+MethInfo)][offset 0x000000B3][found Char] Unexpected type on the stack. From 9283bce77885d462fd2a1b7c47d1a665182a49ff Mon Sep 17 00:00:00 2001 From: "Kevin Ransom (msft)" Date: Thu, 12 Dec 2024 09:54:50 -0800 Subject: [PATCH 7/8] Update tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/SymbolicOperators.fs Yeah the comments are pointless. Co-authored-by: Tomas Grosup --- .../Conformance/LexicalAnalysis/SymbolicOperators.fs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/SymbolicOperators.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/SymbolicOperators.fs index 49951b50bc0..73a94c080ec 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/SymbolicOperators.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/LexicalAnalysis/SymbolicOperators.fs @@ -35,12 +35,7 @@ module SymbolicOperators = [] // Regular [] let ``SymbolicOperators_E_LessThanDotOpenParen001_fs`` (realsig) = - Fsx """// #Regression #Conformance #LexicalAnalysis #Operators -// Regression test for FSHARP1.0:4805 -// We are not really after the actual error messages here (some of them have been omitted), rather we -// want to verify we do not crash! -//This construct causes code to be less generic than indicated by the type annotations\. The type variable 'S has been constrained to be type 'int' -//This code is not sufficiently generic\. The type variable \^T when \^T : \(static member \( \+ \) : \^T \* \^T -> \^a\) could not be generalized because it would escape its scope + Fsx """ type public TestType<'T,'S>() = From c7f715438105bce7a1847f649605b1aebefae87b Mon Sep 17 00:00:00 2001 From: KevinRansom Date: Fri, 13 Dec 2024 07:59:56 -0800 Subject: [PATCH 8/8] Feedback pt 1 --- ...InternalSignatureOn.fs.il.net472.debug.bsl | 1598 ++++++++++++++++- .../ClassTypeInitialization.fs | 387 +--- .../nested_generic_closure.fs | 349 ++++ tests/FSharp.Test.Utilities/Compiler.fs | 4 + 4 files changed, 1961 insertions(+), 377 deletions(-) create mode 100644 tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/nested_generic_closure.fs diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.debug.bsl b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.debug.bsl index 320982a39ae..3a275700ec2 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.debug.bsl +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Inlining/Match01_RealInternalSignatureOn.fs.il.net472.debug.bsl @@ -1 +1,1597 @@ -C:\Users\kevinr\AppData\Local\Temp\FSharp.Test.Utilities\13f35c97\31dd1a04\Match01_RealInternalSignatureOn.il C:\kevinransom\fsharp\tests\FSharp.Compiler.ComponentTests\EmittedIL\Inlining\Match01_RealInternalSignatureOn.fs.il.net472.debug.bsl \ No newline at end of file + + + + + +.assembly extern runtime { } +.assembly extern FSharp.Core { } +.assembly assembly +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.FSharpInterfaceDataVersionAttribute::.ctor(int32, + int32, + int32) = ( 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + + + + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module assembly.exe + +.imagebase {value} +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 +.corflags 0x00000001 + + + + + +.class public abstract auto ansi sealed Match01 + extends [runtime]System.Object +{ + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 07 00 00 00 00 00 ) + .class abstract auto autochar serializable nested public beforefieldinit Test1 + extends [runtime]System.Object + implements class [runtime]System.IEquatable`1, + [runtime]System.Collections.IStructuralEquatable, + class [runtime]System.IComparable`1, + [runtime]System.IComparable, + [runtime]System.Collections.IStructuralComparable + { + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 01 00 00 00 00 00 ) + .class abstract auto ansi sealed nested public Tags + extends [runtime]System.Object + { + .field public static literal int32 X11 = int32(0x00000000) + .field public static literal int32 X12 = int32(0x00000001) + .field public static literal int32 X13 = int32(0x00000002) + .field public static literal int32 X14 = int32(0x00000003) + } + + .class auto ansi serializable nested public beforefieldinit specialname X11 + extends Match01/Test1 + { + .custom instance void [runtime]System.Diagnostics.DebuggerTypeProxyAttribute::.ctor(class [runtime]System.Type) = ( 01 00 20 4D 61 74 63 68 30 31 2B 54 65 73 74 31 + 2B 58 31 31 40 44 65 62 75 67 54 79 70 65 50 72 + 6F 78 79 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .field assembly initonly int32 item + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(int32 item) cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 0D 4D 61 74 63 68 30 31 2B 54 + 65 73 74 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.0 + IL_0002: call instance void Match01/Test1::.ctor(int32) + IL_0007: ldarg.0 + IL_0008: ldarg.1 + IL_0009: stfld int32 Match01/Test1/X11::item + IL_000e: ret + } + + .method public hidebysig instance int32 get_Item() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 Match01/Test1/X11::item + IL_0006: ret + } + + .property instance int32 Item() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance int32 Match01/Test1/X11::get_Item() + } + } + + .class auto ansi serializable nested public beforefieldinit specialname X12 + extends Match01/Test1 + { + .custom instance void [runtime]System.Diagnostics.DebuggerTypeProxyAttribute::.ctor(class [runtime]System.Type) = ( 01 00 20 4D 61 74 63 68 30 31 2B 54 65 73 74 31 + 2B 58 31 32 40 44 65 62 75 67 54 79 70 65 50 72 + 6F 78 79 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .field assembly initonly int32 item + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(int32 item) cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 0D 4D 61 74 63 68 30 31 2B 54 + 65 73 74 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.1 + IL_0002: call instance void Match01/Test1::.ctor(int32) + IL_0007: ldarg.0 + IL_0008: ldarg.1 + IL_0009: stfld int32 Match01/Test1/X12::item + IL_000e: ret + } + + .method public hidebysig instance int32 get_Item() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 Match01/Test1/X12::item + IL_0006: ret + } + + .property instance int32 Item() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 01 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance int32 Match01/Test1/X12::get_Item() + } + } + + .class auto ansi serializable nested public beforefieldinit specialname X13 + extends Match01/Test1 + { + .custom instance void [runtime]System.Diagnostics.DebuggerTypeProxyAttribute::.ctor(class [runtime]System.Type) = ( 01 00 20 4D 61 74 63 68 30 31 2B 54 65 73 74 31 + 2B 58 31 33 40 44 65 62 75 67 54 79 70 65 50 72 + 6F 78 79 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .field assembly initonly int32 item + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(int32 item) cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 0D 4D 61 74 63 68 30 31 2B 54 + 65 73 74 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.2 + IL_0002: call instance void Match01/Test1::.ctor(int32) + IL_0007: ldarg.0 + IL_0008: ldarg.1 + IL_0009: stfld int32 Match01/Test1/X13::item + IL_000e: ret + } + + .method public hidebysig instance int32 get_Item() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 Match01/Test1/X13::item + IL_0006: ret + } + + .property instance int32 Item() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 02 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance int32 Match01/Test1/X13::get_Item() + } + } + + .class auto ansi serializable nested public beforefieldinit specialname X14 + extends Match01/Test1 + { + .custom instance void [runtime]System.Diagnostics.DebuggerTypeProxyAttribute::.ctor(class [runtime]System.Type) = ( 01 00 20 4D 61 74 63 68 30 31 2B 54 65 73 74 31 + 2B 58 31 34 40 44 65 62 75 67 54 79 70 65 50 72 + 6F 78 79 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerDisplayAttribute::.ctor(string) = ( 01 00 15 7B 5F 5F 44 65 62 75 67 44 69 73 70 6C + 61 79 28 29 2C 6E 71 7D 00 00 ) + .field assembly initonly int32 item + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(int32 item) cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 0D 4D 61 74 63 68 30 31 2B 54 + 65 73 74 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldc.i4.3 + IL_0002: call instance void Match01/Test1::.ctor(int32) + IL_0007: ldarg.0 + IL_0008: ldarg.1 + IL_0009: stfld int32 Match01/Test1/X14::item + IL_000e: ret + } + + .method public hidebysig instance int32 get_Item() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 Match01/Test1/X14::item + IL_0006: ret + } + + .property instance int32 Item() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 03 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance int32 Match01/Test1/X14::get_Item() + } + } + + .class auto ansi nested assembly beforefieldinit specialname X11@DebugTypeProxy + extends [runtime]System.Object + { + .field assembly class Match01/Test1/X11 _obj + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(class Match01/Test1/X11 obj) cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 0D 4D 61 74 63 68 30 31 2B 54 + 65 73 74 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class Match01/Test1/X11 Match01/Test1/X11@DebugTypeProxy::_obj + IL_000d: ret + } + + .method public hidebysig instance int32 get_Item() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class Match01/Test1/X11 Match01/Test1/X11@DebugTypeProxy::_obj + IL_0006: ldfld int32 Match01/Test1/X11::item + IL_000b: ret + } + + .property instance int32 Item() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance int32 Match01/Test1/X11@DebugTypeProxy::get_Item() + } + } + + .class auto ansi nested assembly beforefieldinit specialname X12@DebugTypeProxy + extends [runtime]System.Object + { + .field assembly class Match01/Test1/X12 _obj + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(class Match01/Test1/X12 obj) cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 0D 4D 61 74 63 68 30 31 2B 54 + 65 73 74 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class Match01/Test1/X12 Match01/Test1/X12@DebugTypeProxy::_obj + IL_000d: ret + } + + .method public hidebysig instance int32 get_Item() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class Match01/Test1/X12 Match01/Test1/X12@DebugTypeProxy::_obj + IL_0006: ldfld int32 Match01/Test1/X12::item + IL_000b: ret + } + + .property instance int32 Item() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 01 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance int32 Match01/Test1/X12@DebugTypeProxy::get_Item() + } + } + + .class auto ansi nested assembly beforefieldinit specialname X13@DebugTypeProxy + extends [runtime]System.Object + { + .field assembly class Match01/Test1/X13 _obj + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(class Match01/Test1/X13 obj) cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 0D 4D 61 74 63 68 30 31 2B 54 + 65 73 74 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class Match01/Test1/X13 Match01/Test1/X13@DebugTypeProxy::_obj + IL_000d: ret + } + + .method public hidebysig instance int32 get_Item() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class Match01/Test1/X13 Match01/Test1/X13@DebugTypeProxy::_obj + IL_0006: ldfld int32 Match01/Test1/X13::item + IL_000b: ret + } + + .property instance int32 Item() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 02 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance int32 Match01/Test1/X13@DebugTypeProxy::get_Item() + } + } + + .class auto ansi nested assembly beforefieldinit specialname X14@DebugTypeProxy + extends [runtime]System.Object + { + .field assembly class Match01/Test1/X14 _obj + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(class Match01/Test1/X14 obj) cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 60 06 00 00 0D 4D 61 74 63 68 30 31 2B 54 + 65 73 74 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class Match01/Test1/X14 Match01/Test1/X14@DebugTypeProxy::_obj + IL_000d: ret + } + + .method public hidebysig instance int32 get_Item() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class Match01/Test1/X14 Match01/Test1/X14@DebugTypeProxy::_obj + IL_0006: ldfld int32 Match01/Test1/X14::item + IL_000b: ret + } + + .property instance int32 Item() + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32, + int32) = ( 01 00 04 00 00 00 03 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance int32 Match01/Test1/X14@DebugTypeProxy::get_Item() + } + } + + .class auto ansi serializable sealed nested assembly beforefieldinit clo@4 + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field public class Match01/Test1 this + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public class Match01/Test1 obj + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class Match01/Test1 this, class Match01/Test1 obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class Match01/Test1 Match01/Test1/clo@4::this + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class Match01/Test1 Match01/Test1/clo@4::obj + IL_0014: ret + } + + .method public strict virtual instance int32 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed + { + + .maxstack 7 + .locals init (int32 V_0, + int32 V_1, + class Match01/Test1/X11 V_2, + class Match01/Test1/X11 V_3, + class [runtime]System.Collections.IComparer V_4, + int32 V_5, + int32 V_6, + class Match01/Test1/X12 V_7, + class Match01/Test1/X12 V_8, + class Match01/Test1/X13 V_9, + class Match01/Test1/X13 V_10, + class Match01/Test1/X14 V_11, + class Match01/Test1/X14 V_12) + IL_0000: ldarg.0 + IL_0001: ldfld class Match01/Test1 Match01/Test1/clo@4::this + IL_0006: ldfld int32 Match01/Test1::_tag + IL_000b: stloc.0 + IL_000c: ldarg.0 + IL_000d: ldfld class Match01/Test1 Match01/Test1/clo@4::obj + IL_0012: ldfld int32 Match01/Test1::_tag + IL_0017: stloc.1 + IL_0018: ldloc.0 + IL_0019: ldloc.1 + IL_001a: bne.un IL_013f + + IL_001f: ldarg.0 + IL_0020: ldfld class Match01/Test1 Match01/Test1/clo@4::this + IL_0025: call instance int32 Match01/Test1::get_Tag() + IL_002a: switch ( + IL_003f, + IL_007c, + IL_00bd, + IL_00fe) + IL_003f: ldarg.0 + IL_0040: ldfld class Match01/Test1 Match01/Test1/clo@4::this + IL_0045: castclass Match01/Test1/X11 + IL_004a: stloc.2 + IL_004b: ldarg.0 + IL_004c: ldfld class Match01/Test1 Match01/Test1/clo@4::obj + IL_0051: castclass Match01/Test1/X11 + IL_0056: stloc.3 + IL_0057: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_005c: stloc.s V_4 + IL_005e: ldloc.2 + IL_005f: ldfld int32 Match01/Test1/X11::item + IL_0064: stloc.s V_5 + IL_0066: ldloc.3 + IL_0067: ldfld int32 Match01/Test1/X11::item + IL_006c: stloc.s V_6 + IL_006e: ldloc.s V_5 + IL_0070: ldloc.s V_6 + IL_0072: cgt + IL_0074: ldloc.s V_5 + IL_0076: ldloc.s V_6 + IL_0078: clt + IL_007a: sub + IL_007b: ret + + IL_007c: ldarg.0 + IL_007d: ldfld class Match01/Test1 Match01/Test1/clo@4::this + IL_0082: castclass Match01/Test1/X12 + IL_0087: stloc.s V_7 + IL_0089: ldarg.0 + IL_008a: ldfld class Match01/Test1 Match01/Test1/clo@4::obj + IL_008f: castclass Match01/Test1/X12 + IL_0094: stloc.s V_8 + IL_0096: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_009b: stloc.s V_4 + IL_009d: ldloc.s V_7 + IL_009f: ldfld int32 Match01/Test1/X12::item + IL_00a4: stloc.s V_5 + IL_00a6: ldloc.s V_8 + IL_00a8: ldfld int32 Match01/Test1/X12::item + IL_00ad: stloc.s V_6 + IL_00af: ldloc.s V_5 + IL_00b1: ldloc.s V_6 + IL_00b3: cgt + IL_00b5: ldloc.s V_5 + IL_00b7: ldloc.s V_6 + IL_00b9: clt + IL_00bb: sub + IL_00bc: ret + + IL_00bd: ldarg.0 + IL_00be: ldfld class Match01/Test1 Match01/Test1/clo@4::this + IL_00c3: castclass Match01/Test1/X13 + IL_00c8: stloc.s V_9 + IL_00ca: ldarg.0 + IL_00cb: ldfld class Match01/Test1 Match01/Test1/clo@4::obj + IL_00d0: castclass Match01/Test1/X13 + IL_00d5: stloc.s V_10 + IL_00d7: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_00dc: stloc.s V_4 + IL_00de: ldloc.s V_9 + IL_00e0: ldfld int32 Match01/Test1/X13::item + IL_00e5: stloc.s V_5 + IL_00e7: ldloc.s V_10 + IL_00e9: ldfld int32 Match01/Test1/X13::item + IL_00ee: stloc.s V_6 + IL_00f0: ldloc.s V_5 + IL_00f2: ldloc.s V_6 + IL_00f4: cgt + IL_00f6: ldloc.s V_5 + IL_00f8: ldloc.s V_6 + IL_00fa: clt + IL_00fc: sub + IL_00fd: ret + + IL_00fe: ldarg.0 + IL_00ff: ldfld class Match01/Test1 Match01/Test1/clo@4::this + IL_0104: castclass Match01/Test1/X14 + IL_0109: stloc.s V_11 + IL_010b: ldarg.0 + IL_010c: ldfld class Match01/Test1 Match01/Test1/clo@4::obj + IL_0111: castclass Match01/Test1/X14 + IL_0116: stloc.s V_12 + IL_0118: call class [runtime]System.Collections.IComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericComparer() + IL_011d: stloc.s V_4 + IL_011f: ldloc.s V_11 + IL_0121: ldfld int32 Match01/Test1/X14::item + IL_0126: stloc.s V_5 + IL_0128: ldloc.s V_12 + IL_012a: ldfld int32 Match01/Test1/X14::item + IL_012f: stloc.s V_6 + IL_0131: ldloc.s V_5 + IL_0133: ldloc.s V_6 + IL_0135: cgt + IL_0137: ldloc.s V_5 + IL_0139: ldloc.s V_6 + IL_013b: clt + IL_013d: sub + IL_013e: ret + + IL_013f: ldloc.0 + IL_0140: ldloc.1 + IL_0141: sub + IL_0142: ret + } + + } + + .class auto ansi serializable sealed nested assembly beforefieldinit 'clo@4-1' + extends class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 + { + .field public class Match01/Test1 this + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public class Match01/Test1 objTemp + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(class Match01/Test1 this, class Match01/Test1 objTemp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld class Match01/Test1 Match01/Test1/'clo@4-1'::this + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp + IL_0014: ret + } + + .method public strict virtual instance int32 Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar) cil managed + { + + .maxstack 7 + .locals init (int32 V_0, + int32 V_1, + class Match01/Test1/X11 V_2, + class Match01/Test1/X11 V_3, + int32 V_4, + int32 V_5, + class Match01/Test1/X12 V_6, + class Match01/Test1/X12 V_7, + class Match01/Test1/X13 V_8, + class Match01/Test1/X13 V_9, + class Match01/Test1/X14 V_10, + class Match01/Test1/X14 V_11) + IL_0000: ldarg.0 + IL_0001: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this + IL_0006: ldfld int32 Match01/Test1::_tag + IL_000b: stloc.0 + IL_000c: ldarg.0 + IL_000d: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp + IL_0012: ldfld int32 Match01/Test1::_tag + IL_0017: stloc.1 + IL_0018: ldloc.0 + IL_0019: ldloc.1 + IL_001a: bne.un IL_0123 + + IL_001f: ldarg.0 + IL_0020: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this + IL_0025: call instance int32 Match01/Test1::get_Tag() + IL_002a: switch ( + IL_003f, + IL_0075, + IL_00af, + IL_00e9) + IL_003f: ldarg.0 + IL_0040: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this + IL_0045: castclass Match01/Test1/X11 + IL_004a: stloc.2 + IL_004b: ldarg.0 + IL_004c: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp + IL_0051: castclass Match01/Test1/X11 + IL_0056: stloc.3 + IL_0057: ldloc.2 + IL_0058: ldfld int32 Match01/Test1/X11::item + IL_005d: stloc.s V_4 + IL_005f: ldloc.3 + IL_0060: ldfld int32 Match01/Test1/X11::item + IL_0065: stloc.s V_5 + IL_0067: ldloc.s V_4 + IL_0069: ldloc.s V_5 + IL_006b: cgt + IL_006d: ldloc.s V_4 + IL_006f: ldloc.s V_5 + IL_0071: clt + IL_0073: sub + IL_0074: ret + + IL_0075: ldarg.0 + IL_0076: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this + IL_007b: castclass Match01/Test1/X12 + IL_0080: stloc.s V_6 + IL_0082: ldarg.0 + IL_0083: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp + IL_0088: castclass Match01/Test1/X12 + IL_008d: stloc.s V_7 + IL_008f: ldloc.s V_6 + IL_0091: ldfld int32 Match01/Test1/X12::item + IL_0096: stloc.s V_4 + IL_0098: ldloc.s V_7 + IL_009a: ldfld int32 Match01/Test1/X12::item + IL_009f: stloc.s V_5 + IL_00a1: ldloc.s V_4 + IL_00a3: ldloc.s V_5 + IL_00a5: cgt + IL_00a7: ldloc.s V_4 + IL_00a9: ldloc.s V_5 + IL_00ab: clt + IL_00ad: sub + IL_00ae: ret + + IL_00af: ldarg.0 + IL_00b0: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this + IL_00b5: castclass Match01/Test1/X13 + IL_00ba: stloc.s V_8 + IL_00bc: ldarg.0 + IL_00bd: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp + IL_00c2: castclass Match01/Test1/X13 + IL_00c7: stloc.s V_9 + IL_00c9: ldloc.s V_8 + IL_00cb: ldfld int32 Match01/Test1/X13::item + IL_00d0: stloc.s V_4 + IL_00d2: ldloc.s V_9 + IL_00d4: ldfld int32 Match01/Test1/X13::item + IL_00d9: stloc.s V_5 + IL_00db: ldloc.s V_4 + IL_00dd: ldloc.s V_5 + IL_00df: cgt + IL_00e1: ldloc.s V_4 + IL_00e3: ldloc.s V_5 + IL_00e5: clt + IL_00e7: sub + IL_00e8: ret + + IL_00e9: ldarg.0 + IL_00ea: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::this + IL_00ef: castclass Match01/Test1/X14 + IL_00f4: stloc.s V_10 + IL_00f6: ldarg.0 + IL_00f7: ldfld class Match01/Test1 Match01/Test1/'clo@4-1'::objTemp + IL_00fc: castclass Match01/Test1/X14 + IL_0101: stloc.s V_11 + IL_0103: ldloc.s V_10 + IL_0105: ldfld int32 Match01/Test1/X14::item + IL_010a: stloc.s V_4 + IL_010c: ldloc.s V_11 + IL_010e: ldfld int32 Match01/Test1/X14::item + IL_0113: stloc.s V_5 + IL_0115: ldloc.s V_4 + IL_0117: ldloc.s V_5 + IL_0119: cgt + IL_011b: ldloc.s V_4 + IL_011d: ldloc.s V_5 + IL_011f: clt + IL_0121: sub + IL_0122: ret + + IL_0123: ldloc.0 + IL_0124: ldloc.1 + IL_0125: sub + IL_0126: ret + } + + } + + .field assembly initonly int32 _tag + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method assembly specialname rtspecialname instance void .ctor(int32 _tag) cil managed + { + .custom instance void System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::.ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes, + class [runtime]System.Type) = ( 01 00 E0 07 00 00 0D 4D 61 74 63 68 30 31 2B 54 + 65 73 74 31 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Object::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld int32 Match01/Test1::_tag + IL_000d: ret + } + + .method public static class Match01/Test1 NewX11(int32 item) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 00 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: newobj instance void Match01/Test1/X11::.ctor(int32) + IL_0006: ret + } + + .method public hidebysig instance bool get_IsX11() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance int32 Match01/Test1::get_Tag() + IL_0006: ldc.i4.0 + IL_0007: ceq + IL_0009: ret + } + + .method public static class Match01/Test1 NewX12(int32 item) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 01 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: newobj instance void Match01/Test1/X12::.ctor(int32) + IL_0006: ret + } + + .method public hidebysig instance bool get_IsX12() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance int32 Match01/Test1::get_Tag() + IL_0006: ldc.i4.1 + IL_0007: ceq + IL_0009: ret + } + + .method public static class Match01/Test1 NewX13(int32 item) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 02 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: newobj instance void Match01/Test1/X13::.ctor(int32) + IL_0006: ret + } + + .method public hidebysig instance bool get_IsX13() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance int32 Match01/Test1::get_Tag() + IL_0006: ldc.i4.2 + IL_0007: ceq + IL_0009: ret + } + + .method public static class Match01/Test1 NewX14(int32 item) cil managed + { + .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags, + int32) = ( 01 00 08 00 00 00 03 00 00 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: newobj instance void Match01/Test1/X14::.ctor(int32) + IL_0006: ret + } + + .method public hidebysig instance bool get_IsX14() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance int32 Match01/Test1::get_Tag() + IL_0006: ldc.i4.3 + IL_0007: ceq + IL_0009: ret + } + + .method public hidebysig instance int32 get_Tag() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld int32 Match01/Test1::_tag + IL_0006: ret + } + + .method assembly hidebysig specialname instance object __DebugDisplay() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+0.8A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,string>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0015: ret + } + + .method public strict virtual instance string ToString() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldstr "%+A" + IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [FSharp.Core]Microsoft.FSharp.Core.Unit,string,string,class Match01/Test1>::.ctor(string) + IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatToString>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) + IL_000f: ldarg.0 + IL_0010: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0015: ret + } + + .method public hidebysig virtual final instance int32 CompareTo(class Match01/Test1 obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + .locals init (class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_0) + IL_0000: ldarg.0 + IL_0001: brfalse.s IL_001a + + IL_0003: ldarg.1 + IL_0004: brfalse.s IL_0018 + + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: newobj instance void Match01/Test1/clo@4::.ctor(class Match01/Test1, + class Match01/Test1) + IL_000d: stloc.0 + IL_000e: ldloc.0 + IL_000f: ldnull + IL_0010: tail. + IL_0012: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0017: ret + + IL_0018: ldc.i4.1 + IL_0019: ret + + IL_001a: ldarg.1 + IL_001b: brfalse.s IL_001f + + IL_001d: ldc.i4.m1 + IL_001e: ret + + IL_001f: ldc.i4.0 + IL_0020: ret + } + + .method public hidebysig virtual final instance int32 CompareTo(object obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: unbox.any Match01/Test1 + IL_0007: callvirt instance int32 Match01/Test1::CompareTo(class Match01/Test1) + IL_000c: ret + } + + .method public hidebysig virtual final instance int32 CompareTo(object obj, class [runtime]System.Collections.IComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + .locals init (class Match01/Test1 V_0, + class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 V_1) + IL_0000: ldarg.1 + IL_0001: unbox.any Match01/Test1 + IL_0006: stloc.0 + IL_0007: ldarg.0 + IL_0008: brfalse.s IL_0026 + + IL_000a: ldarg.1 + IL_000b: unbox.any Match01/Test1 + IL_0010: brfalse.s IL_0024 + + IL_0012: ldarg.0 + IL_0013: ldloc.0 + IL_0014: newobj instance void Match01/Test1/'clo@4-1'::.ctor(class Match01/Test1, + class Match01/Test1) + IL_0019: stloc.1 + IL_001a: ldloc.1 + IL_001b: ldnull + IL_001c: tail. + IL_001e: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) + IL_0023: ret + + IL_0024: ldc.i4.1 + IL_0025: ret + + IL_0026: ldarg.1 + IL_0027: unbox.any Match01/Test1 + IL_002c: brfalse.s IL_0030 + + IL_002e: ldc.i4.m1 + IL_002f: ret + + IL_0030: ldc.i4.0 + IL_0031: ret + } + + .method public hidebysig virtual final instance int32 GetHashCode(class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 7 + .locals init (int32 V_0, + class Match01/Test1/X11 V_1, + class Match01/Test1/X12 V_2, + class Match01/Test1/X13 V_3, + class Match01/Test1/X14 V_4) + IL_0000: ldarg.0 + IL_0001: brfalse IL_00a5 + + IL_0006: ldc.i4.0 + IL_0007: stloc.0 + IL_0008: ldarg.0 + IL_0009: call instance int32 Match01/Test1::get_Tag() + IL_000e: switch ( + IL_0023, + IL_0043, + IL_0063, + IL_0083) + IL_0023: ldarg.0 + IL_0024: castclass Match01/Test1/X11 + IL_0029: stloc.1 + IL_002a: ldc.i4.0 + IL_002b: stloc.0 + IL_002c: ldc.i4 0x9e3779b9 + IL_0031: ldloc.1 + IL_0032: ldfld int32 Match01/Test1/X11::item + IL_0037: ldloc.0 + IL_0038: ldc.i4.6 + IL_0039: shl + IL_003a: ldloc.0 + IL_003b: ldc.i4.2 + IL_003c: shr + IL_003d: add + IL_003e: add + IL_003f: add + IL_0040: stloc.0 + IL_0041: ldloc.0 + IL_0042: ret + + IL_0043: ldarg.0 + IL_0044: castclass Match01/Test1/X12 + IL_0049: stloc.2 + IL_004a: ldc.i4.1 + IL_004b: stloc.0 + IL_004c: ldc.i4 0x9e3779b9 + IL_0051: ldloc.2 + IL_0052: ldfld int32 Match01/Test1/X12::item + IL_0057: ldloc.0 + IL_0058: ldc.i4.6 + IL_0059: shl + IL_005a: ldloc.0 + IL_005b: ldc.i4.2 + IL_005c: shr + IL_005d: add + IL_005e: add + IL_005f: add + IL_0060: stloc.0 + IL_0061: ldloc.0 + IL_0062: ret + + IL_0063: ldarg.0 + IL_0064: castclass Match01/Test1/X13 + IL_0069: stloc.3 + IL_006a: ldc.i4.2 + IL_006b: stloc.0 + IL_006c: ldc.i4 0x9e3779b9 + IL_0071: ldloc.3 + IL_0072: ldfld int32 Match01/Test1/X13::item + IL_0077: ldloc.0 + IL_0078: ldc.i4.6 + IL_0079: shl + IL_007a: ldloc.0 + IL_007b: ldc.i4.2 + IL_007c: shr + IL_007d: add + IL_007e: add + IL_007f: add + IL_0080: stloc.0 + IL_0081: ldloc.0 + IL_0082: ret + + IL_0083: ldarg.0 + IL_0084: castclass Match01/Test1/X14 + IL_0089: stloc.s V_4 + IL_008b: ldc.i4.3 + IL_008c: stloc.0 + IL_008d: ldc.i4 0x9e3779b9 + IL_0092: ldloc.s V_4 + IL_0094: ldfld int32 Match01/Test1/X14::item + IL_0099: ldloc.0 + IL_009a: ldc.i4.6 + IL_009b: shl + IL_009c: ldloc.0 + IL_009d: ldc.i4.2 + IL_009e: shr + IL_009f: add + IL_00a0: add + IL_00a1: add + IL_00a2: stloc.0 + IL_00a3: ldloc.0 + IL_00a4: ret + + IL_00a5: ldc.i4.0 + IL_00a6: ret + } + + .method public hidebysig virtual final instance int32 GetHashCode() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call class [runtime]System.Collections.IEqualityComparer [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives::get_GenericEqualityComparer() + IL_0006: callvirt instance int32 Match01/Test1::GetHashCode(class [runtime]System.Collections.IEqualityComparer) + IL_000b: ret + } + + .method public hidebysig instance bool Equals(class Match01/Test1 obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + .locals init (int32 V_0, + int32 V_1, + class Match01/Test1/X11 V_2, + class Match01/Test1/X11 V_3, + class Match01/Test1/X12 V_4, + class Match01/Test1/X12 V_5, + class Match01/Test1/X13 V_6, + class Match01/Test1/X13 V_7, + class Match01/Test1/X14 V_8, + class Match01/Test1/X14 V_9) + IL_0000: ldarg.0 + IL_0001: brfalse IL_00c0 + + IL_0006: ldarg.1 + IL_0007: brfalse IL_00be + + IL_000c: ldarg.0 + IL_000d: ldfld int32 Match01/Test1::_tag + IL_0012: stloc.0 + IL_0013: ldarg.1 + IL_0014: ldfld int32 Match01/Test1::_tag + IL_0019: stloc.1 + IL_001a: ldloc.0 + IL_001b: ldloc.1 + IL_001c: bne.un IL_00bc + + IL_0021: ldarg.0 + IL_0022: call instance int32 Match01/Test1::get_Tag() + IL_0027: switch ( + IL_003c, + IL_0059, + IL_007a, + IL_009b) + IL_003c: ldarg.0 + IL_003d: castclass Match01/Test1/X11 + IL_0042: stloc.2 + IL_0043: ldarg.1 + IL_0044: castclass Match01/Test1/X11 + IL_0049: stloc.3 + IL_004a: ldloc.2 + IL_004b: ldfld int32 Match01/Test1/X11::item + IL_0050: ldloc.3 + IL_0051: ldfld int32 Match01/Test1/X11::item + IL_0056: ceq + IL_0058: ret + + IL_0059: ldarg.0 + IL_005a: castclass Match01/Test1/X12 + IL_005f: stloc.s V_4 + IL_0061: ldarg.1 + IL_0062: castclass Match01/Test1/X12 + IL_0067: stloc.s V_5 + IL_0069: ldloc.s V_4 + IL_006b: ldfld int32 Match01/Test1/X12::item + IL_0070: ldloc.s V_5 + IL_0072: ldfld int32 Match01/Test1/X12::item + IL_0077: ceq + IL_0079: ret + + IL_007a: ldarg.0 + IL_007b: castclass Match01/Test1/X13 + IL_0080: stloc.s V_6 + IL_0082: ldarg.1 + IL_0083: castclass Match01/Test1/X13 + IL_0088: stloc.s V_7 + IL_008a: ldloc.s V_6 + IL_008c: ldfld int32 Match01/Test1/X13::item + IL_0091: ldloc.s V_7 + IL_0093: ldfld int32 Match01/Test1/X13::item + IL_0098: ceq + IL_009a: ret + + IL_009b: ldarg.0 + IL_009c: castclass Match01/Test1/X14 + IL_00a1: stloc.s V_8 + IL_00a3: ldarg.1 + IL_00a4: castclass Match01/Test1/X14 + IL_00a9: stloc.s V_9 + IL_00ab: ldloc.s V_8 + IL_00ad: ldfld int32 Match01/Test1/X14::item + IL_00b2: ldloc.s V_9 + IL_00b4: ldfld int32 Match01/Test1/X14::item + IL_00b9: ceq + IL_00bb: ret + + IL_00bc: ldc.i4.0 + IL_00bd: ret + + IL_00be: ldc.i4.0 + IL_00bf: ret + + IL_00c0: ldarg.1 + IL_00c1: ldnull + IL_00c2: cgt.un + IL_00c4: ldc.i4.0 + IL_00c5: ceq + IL_00c7: ret + } + + .method public hidebysig virtual final instance bool Equals(object obj, class [runtime]System.Collections.IEqualityComparer comp) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 5 + .locals init (class Match01/Test1 V_0) + IL_0000: ldarg.1 + IL_0001: isinst Match01/Test1 + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_0013 + + IL_000a: ldarg.0 + IL_000b: ldloc.0 + IL_000c: ldarg.2 + IL_000d: callvirt instance bool Match01/Test1::Equals(class Match01/Test1, + class [runtime]System.Collections.IEqualityComparer) + IL_0012: ret + + IL_0013: ldc.i4.0 + IL_0014: ret + } + + .method public hidebysig virtual final instance bool Equals(class Match01/Test1 obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + .locals init (int32 V_0, + int32 V_1, + class Match01/Test1/X11 V_2, + class Match01/Test1/X11 V_3, + class Match01/Test1/X12 V_4, + class Match01/Test1/X12 V_5, + class Match01/Test1/X13 V_6, + class Match01/Test1/X13 V_7, + class Match01/Test1/X14 V_8, + class Match01/Test1/X14 V_9) + IL_0000: ldarg.0 + IL_0001: brfalse IL_00c0 + + IL_0006: ldarg.1 + IL_0007: brfalse IL_00be + + IL_000c: ldarg.0 + IL_000d: ldfld int32 Match01/Test1::_tag + IL_0012: stloc.0 + IL_0013: ldarg.1 + IL_0014: ldfld int32 Match01/Test1::_tag + IL_0019: stloc.1 + IL_001a: ldloc.0 + IL_001b: ldloc.1 + IL_001c: bne.un IL_00bc + + IL_0021: ldarg.0 + IL_0022: call instance int32 Match01/Test1::get_Tag() + IL_0027: switch ( + IL_003c, + IL_0059, + IL_007a, + IL_009b) + IL_003c: ldarg.0 + IL_003d: castclass Match01/Test1/X11 + IL_0042: stloc.2 + IL_0043: ldarg.1 + IL_0044: castclass Match01/Test1/X11 + IL_0049: stloc.3 + IL_004a: ldloc.2 + IL_004b: ldfld int32 Match01/Test1/X11::item + IL_0050: ldloc.3 + IL_0051: ldfld int32 Match01/Test1/X11::item + IL_0056: ceq + IL_0058: ret + + IL_0059: ldarg.0 + IL_005a: castclass Match01/Test1/X12 + IL_005f: stloc.s V_4 + IL_0061: ldarg.1 + IL_0062: castclass Match01/Test1/X12 + IL_0067: stloc.s V_5 + IL_0069: ldloc.s V_4 + IL_006b: ldfld int32 Match01/Test1/X12::item + IL_0070: ldloc.s V_5 + IL_0072: ldfld int32 Match01/Test1/X12::item + IL_0077: ceq + IL_0079: ret + + IL_007a: ldarg.0 + IL_007b: castclass Match01/Test1/X13 + IL_0080: stloc.s V_6 + IL_0082: ldarg.1 + IL_0083: castclass Match01/Test1/X13 + IL_0088: stloc.s V_7 + IL_008a: ldloc.s V_6 + IL_008c: ldfld int32 Match01/Test1/X13::item + IL_0091: ldloc.s V_7 + IL_0093: ldfld int32 Match01/Test1/X13::item + IL_0098: ceq + IL_009a: ret + + IL_009b: ldarg.0 + IL_009c: castclass Match01/Test1/X14 + IL_00a1: stloc.s V_8 + IL_00a3: ldarg.1 + IL_00a4: castclass Match01/Test1/X14 + IL_00a9: stloc.s V_9 + IL_00ab: ldloc.s V_8 + IL_00ad: ldfld int32 Match01/Test1/X14::item + IL_00b2: ldloc.s V_9 + IL_00b4: ldfld int32 Match01/Test1/X14::item + IL_00b9: ceq + IL_00bb: ret + + IL_00bc: ldc.i4.0 + IL_00bd: ret + + IL_00be: ldc.i4.0 + IL_00bf: ret + + IL_00c0: ldarg.1 + IL_00c1: ldnull + IL_00c2: cgt.un + IL_00c4: ldc.i4.0 + IL_00c5: ceq + IL_00c7: ret + } + + .method public hidebysig virtual final instance bool Equals(object obj) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 4 + .locals init (class Match01/Test1 V_0) + IL_0000: ldarg.1 + IL_0001: isinst Match01/Test1 + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: brfalse.s IL_0012 + + IL_000a: ldarg.0 + IL_000b: ldloc.0 + IL_000c: callvirt instance bool Match01/Test1::Equals(class Match01/Test1) + IL_0011: ret + + IL_0012: ldc.i4.0 + IL_0013: ret + } + + .property instance int32 Tag() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance int32 Match01/Test1::get_Tag() + } + .property instance bool IsX11() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance bool Match01/Test1::get_IsX11() + } + .property instance bool IsX12() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance bool Match01/Test1::get_IsX12() + } + .property instance bool IsX13() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance bool Match01/Test1::get_IsX13() + } + .property instance bool IsX14() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) + .get instance bool Match01/Test1::get_IsX14() + } + } + + .method public static int32 select1(class Match01/Test1 x) cil managed + { + + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: call instance int32 Match01/Test1::get_Tag() + IL_0007: switch ( + IL_001c, + IL_0028, + IL_002a, + IL_002c) + IL_001c: ldarg.0 + IL_001d: castclass Match01/Test1/X11 + IL_0022: ldfld int32 Match01/Test1/X11::item + IL_0027: ret + + IL_0028: ldc.i4.2 + IL_0029: ret + + IL_002a: ldc.i4.3 + IL_002b: ret + + IL_002c: ldc.i4.4 + IL_002d: ret + } + + .method public static int32 fm(class Match01/Test1 y) cil managed + { + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call int32 Match01::select1(class Match01/Test1) + IL_0006: ret + } + +} + +.class private abstract auto ansi sealed ''.$Match01 + extends [runtime]System.Object +{ + .method public static void main@() cil managed + { + .entrypoint + + .maxstack 8 + IL_0000: ret + } + +} + +.class private auto ansi serializable sealed System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes + extends [runtime]System.Enum +{ + .custom instance void [runtime]System.FlagsAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field public specialname rtspecialname int32 value__ + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes All = int32(0xFFFFFFFF) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes None = int32(0x00000000) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicParameterlessConstructor = int32(0x00000001) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicConstructors = int32(0x00000003) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicConstructors = int32(0x00000004) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicMethods = int32(0x00000008) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicMethods = int32(0x00000010) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicFields = int32(0x00000020) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicFields = int32(0x00000040) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicNestedTypes = int32(0x00000080) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicNestedTypes = int32(0x00000100) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicProperties = int32(0x00000200) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicProperties = int32(0x00000400) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes PublicEvents = int32(0x00000800) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes NonPublicEvents = int32(0x00001000) + .field public static literal valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes Interfaces = int32(0x00002000) +} + +.class private auto ansi beforefieldinit System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute + extends [runtime]System.Attribute +{ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .field private valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .field private class [runtime]System.Type Type@ + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .method public specialname rtspecialname instance void .ctor(valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes MemberType, class [runtime]System.Type Type) cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [runtime]System.Attribute::.ctor() + IL_0006: ldarg.0 + IL_0007: ldarg.1 + IL_0008: stfld valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::MemberType@ + IL_000d: ldarg.0 + IL_000e: ldarg.2 + IL_000f: stfld class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::Type@ + IL_0014: ret + } + + .method public hidebysig specialname instance class [runtime]System.Type get_Type() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::Type@ + IL_0006: ret + } + + .method public hidebysig specialname instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes get_MemberType() cil managed + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: ldfld valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::MemberType@ + IL_0006: ret + } + + .property instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes + MemberType() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance valuetype System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::get_MemberType() + } + .property instance class [runtime]System.Type + Type() + { + .custom instance void [runtime]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 ) + .custom instance void [runtime]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 ) + .get instance class [runtime]System.Type System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute::get_Type() + } +} + + + + + + diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeInitialization.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeInitialization.fs index fbf3b3ac400..fd9eb1848d4 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeInitialization.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeInitialization.fs @@ -5,6 +5,7 @@ namespace EmittedIL.RealInternalSignature open Xunit open FSharp.Test open FSharp.Test.Compiler +open System.IO module ClassTypeInitialization = @@ -490,364 +491,13 @@ printfn "%A" (MyClass.result()) [] // Regular NoOptimize [] let ``nested generic closure`` (realSig, optimize) = - let withOptimization compilation = - if optimize then compilation |> withOptimize - else compilation |> withNoOptimize - - FSharp """ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace MyCollections - -#nowarn "52" // The value has been copied to ensure the original is not mutated by this operation - -open System.Diagnostics -open System.Collections -open System.Collections.Generic -open Microsoft.FSharp.Core - -module internal IEnumerator = - - let noReset() = raise (new System.NotSupportedException("SR.GetString(SR.resetNotSupported)")) - let notStarted() = raise (new System.InvalidOperationException("SR.GetString(SR.enumerationNotStarted)")) - let alreadyFinished() = raise (new System.InvalidOperationException("SR.GetString(SR.enumerationAlreadyFinished)")) - let check started = if not started then notStarted() - let dispose (r : System.IDisposable) = r.Dispose() - - let cast (e : IEnumerator) : IEnumerator<'T> = - { new IEnumerator<'T> with - member _.Current = unbox<'T> e.Current - - interface IEnumerator with - member _.Current = unbox<'T> e.Current :> obj - - [] - member _.MoveNext() = e.MoveNext() - - member _.Reset() = noReset() - - interface System.IDisposable with - member _.Dispose() = - match e with - | :? System.IDisposable as e -> e.Dispose() - | _ -> () } - - /// A concrete implementation of an enumerator that returns no values - [] - type EmptyEnumerator<'T>() = - let mutable started = false - interface IEnumerator<'T> with - member _.Current = - check started - (alreadyFinished() : 'T) - - interface System.Collections.IEnumerator with - member _.Current = - check started - (alreadyFinished() : obj) - - [] - member _.MoveNext() = - if not started then started <- true - false - - member _.Reset() = noReset() - - interface System.IDisposable with - member _.Dispose() = () - - let Empty<'T> () = (new EmptyEnumerator<'T>() :> IEnumerator<'T>) - - [] - type EmptyEnumerable<'T> = - - | EmptyEnumerable - - interface IEnumerable<'T> with - member _.GetEnumerator() = Empty<'T>() - - interface IEnumerable with - member _.GetEnumerator() = (Empty<'T>() :> IEnumerator) - - type GeneratedEnumerable<'T, 'State>(openf: unit -> 'State, compute: 'State -> 'T option, closef: 'State -> unit) = - let mutable started = false - let mutable curr = None - let state = ref (Some (openf ())) - let getCurr() : 'T = - check started - match curr with - | None -> alreadyFinished() - | Some x -> x - - let readAndClear () = - lock state (fun () -> - match state.Value with - | None -> None - | Some _ as res -> - state.Value <- None - res) - - let start() = - if not started then - started <- true - - let dispose() = - readAndClear() |> Option.iter closef - - let finish() = - try dispose() - finally curr <- None - - interface IEnumerator<'T> with - member _.Current = getCurr() - - interface IEnumerator with - member _.Current = box (getCurr()) - - [] - member _.MoveNext() = - start() - match state.Value with - | None -> false // we started, then reached the end, then got another MoveNext - | Some s -> - match (try compute s with e -> finish(); reraise()) with - | None -> finish(); false - | Some _ as x -> - curr <- x - true - - member _.Reset() = noReset() - - interface System.IDisposable with - member _.Dispose() = dispose() + let path = __SOURCE_DIRECTORY__ ++ "nested_generic_closure.fs" + let source = File.ReadAllText (path) - [] - type Singleton<'T>(v:'T) = - let mutable started = false - - interface IEnumerator<'T> with - member _.Current = v - - interface IEnumerator with - member _.Current = box v - - [] - member _.MoveNext() = if started then false else (started <- true; true) - - member _.Reset() = noReset() - - interface System.IDisposable with - member _.Dispose() = () - - let Singleton x = (new Singleton<'T>(x) :> IEnumerator<'T>) - - let EnumerateThenFinally f (e : IEnumerator<'T>) = - { new IEnumerator<'T> with - member _.Current = e.Current - - interface IEnumerator with - member _.Current = (e :> IEnumerator).Current - - [] - member _.MoveNext() = e.MoveNext() - - member _.Reset() = noReset() - - interface System.IDisposable with - member _.Dispose() = - try - e.Dispose() - finally - f() - } - - let inline checkNonNull argName arg = - if isNull arg then - nullArg argName - - let mkSeq f = - { new IEnumerable<'U> with - member _.GetEnumerator() = f() - - interface IEnumerable with - member _.GetEnumerator() = (f() :> IEnumerator) } - -namespace Microsoft.FSharp.Core.CompilerServices - - open System.Diagnostics - open Microsoft.FSharp.Core - open MyCollections - open MyCollections.IEnumerator - open System.Collections - open System.Collections.Generic - - module RuntimeHelpers = - - [] - type internal StructBox<'T when 'T:equality>(value:'T) = - member x.Value = value - - static member Comparer = - let gcomparer = HashIdentity.Structural<'T> - { new IEqualityComparer> with - member _.GetHashCode(v) = gcomparer.GetHashCode(v.Value) - member _.Equals(v1,v2) = gcomparer.Equals(v1.Value,v2.Value) } - - let Generate openf compute closef = - mkSeq (fun () -> new IEnumerator.GeneratedEnumerable<_,_>(openf, compute, closef) :> IEnumerator<'T>) - - let EnumerateFromFunctions create moveNext current = - Generate - create - (fun x -> if moveNext x then Some(current x) else None) - (fun x -> match box(x) with :? System.IDisposable as id -> id.Dispose() | _ -> ()) - - // A family of enumerators that can have additional 'finally' actions added to the enumerator through - // the use of mutation. This is used to 'push' the disposal action for a 'use' into the next enumerator. - // For example, - // seq { use x = ... - // while ... } - // results in the 'while' loop giving an adjustable enumerator. This is then adjusted by adding the disposal action - // from the 'use' into the enumerator. This means that we avoid constructing a two-deep enumerator chain in this - // common case. - type IFinallyEnumerator = - abstract AppendFinallyAction : (unit -> unit) -> unit - - /// A concrete implementation of IEnumerable that adds the given compensation to the "Dispose" chain of any - /// enumerators returned by the enumerable. - [] - type FinallyEnumerable<'T>(compensation: unit -> unit, restf: unit -> seq<'T>) = - interface IEnumerable<'T> with - member _.GetEnumerator() = - try - let ie = restf().GetEnumerator() - match ie with - | :? IFinallyEnumerator as a -> - a.AppendFinallyAction(compensation) - ie - | _ -> - IEnumerator.EnumerateThenFinally compensation ie - with e -> - compensation() - reraise() - interface IEnumerable with - member x.GetEnumerator() = ((x :> IEnumerable<'T>).GetEnumerator() :> IEnumerator) - - /// An optimized object for concatenating a sequence of enumerables - [] - type ConcatEnumerator<'T,'U when 'U :> seq<'T>>(sources: seq<'U>) = - let mutable outerEnum = sources.GetEnumerator() - let mutable currInnerEnum = IEnumerator.Empty() - - let mutable started = false - let mutable finished = false - let mutable compensations = [] - - [] // false = unchecked - val mutable private currElement : 'T - - member _.Finish() = - finished <- true - try - match currInnerEnum with - | null -> () - | _ -> - try - currInnerEnum.Dispose() - finally - currInnerEnum <- null - finally - try - match outerEnum with - | null -> () - | _ -> - try - outerEnum.Dispose() - finally - outerEnum <- null - finally - let rec iter comps = - match comps with - | [] -> () - | h :: t -> - try h() finally iter t - try - compensations |> List.rev |> iter - finally - compensations <- [] - - member x.GetCurrent() = - IEnumerator.check started - if finished then IEnumerator.alreadyFinished() else x.currElement - - interface IFinallyEnumerator with - member _.AppendFinallyAction(f) = - compensations <- f :: compensations - - interface IEnumerator<'T> with - member x.Current = x.GetCurrent() - - interface IEnumerator with - member x.Current = box (x.GetCurrent()) - - [] - member x.MoveNext() = - if not started then started <- true - if finished then false - else - let rec takeInner () = - // check the inner list - if currInnerEnum.MoveNext() then - x.currElement <- currInnerEnum.Current - true - else - // check the outer list - let rec takeOuter() = - if outerEnum.MoveNext() then - let ie = outerEnum.Current - // Optimization to detect the statically-allocated empty IEnumerables - match box ie with - | :? EmptyEnumerable<'T> -> - // This one is empty, just skip, don't call GetEnumerator, try again - takeOuter() - | _ -> - // OK, this one may not be empty. - // Don't forget to dispose of the enumerator for the inner list now we're done with it - currInnerEnum.Dispose() - currInnerEnum <- ie.GetEnumerator() - takeInner () - else - // We're done - x.Finish() - false - takeOuter() - takeInner () - - member _.Reset() = IEnumerator.noReset() - - interface System.IDisposable with - - [] - member x.Dispose() = - if not finished then - x.Finish() - - module doIt = - open System - open Microsoft.FSharp.Core.CompilerServices - open Microsoft.FSharp.Collections - - let x = seq { ArraySegment([|1uy; 2uy; 3uy|]); ArraySegment([|1uy; 2uy; 3uy|]); ArraySegment([|1uy; 2uy; 3uy|]); } - let enumerator = new RuntimeHelpers.ConcatEnumerator<_,_>(x) :> IEnumerator - let rec loop () = - if enumerator.MoveNext() then - printfn $"{enumerator.Current}" - loop () - loop () -""" + FSharp source |> asExe |> withRealInternalSignature realSig - |> withOptimization + |> withOptimization optimize |> compileAndRun |> shouldSucceed @@ -857,9 +507,6 @@ namespace Microsoft.FSharp.Core.CompilerServices [] // Regular NoOptimize [] let ``Generic class with closure with constraints`` (realSig, optimize) = - let withOptimization compilation = - if optimize then compilation |> withOptimize - else compilation |> withNoOptimize FSharp """ namespace Test @@ -893,7 +540,7 @@ module doIt = """ |> asExe |> withRealInternalSignature realSig - |> withOptimization + |> withOptimization optimize |> compileAndRun |> shouldSucceed @@ -903,9 +550,6 @@ module doIt = [] // Regular NoOptimize [] let ``AgedLookup`` (realSig, optimize) = - let withOptimization compilation = - if optimize then compilation |> withOptimize - else compilation |> withNoOptimize FSharp """ namespace Internal.Utilities.Collections @@ -1058,7 +702,7 @@ type internal AgedLookup<'Token, 'Key, 'Value when 'Value: not struct>(keepStron """ |> asLibrary |> withRealInternalSignature realSig - |> withOptimization + |> withOptimization optimize |> compile |> shouldSucceed @@ -1068,9 +712,6 @@ type internal AgedLookup<'Token, 'Key, 'Value when 'Value: not struct>(keepStron [] // Regular NoOptimize [] let ``BigTuples`` (realSig, optimize) = - let withOptimization compilation = - if optimize then compilation |> withOptimize - else compilation |> withNoOptimize FSharp """ namespace Equality @@ -1079,7 +720,7 @@ type BigGenericTuple<'a> = BigGenericTuple of int * 'a * byte * int * 'a * byte """ |> asLibrary |> withRealInternalSignature realSig - |> withOptimization + |> withOptimization optimize |> compile |> shouldSucceed @@ -1089,9 +730,6 @@ type BigGenericTuple<'a> = BigGenericTuple of int * 'a * byte * int * 'a * byte [] // Regular NoOptimize [] let ``Array groupBy id`` (realSig, optimize) = - let withOptimization compilation = - if optimize then compilation |> withOptimize - else compilation |> withNoOptimize FSharp """ module GroupByTest @@ -1099,27 +737,24 @@ let ``for _ in Array groupBy id [||] do ...`` () = [|for _ in Array.groupBy id [ """ |> asLibrary |> withRealInternalSignature realSig - |> withOptimization + |> withOptimization optimize |> compile |> shouldSucceed let roundTripWithInterfaceGeneration(realsig, optimize, implementationFile) = - let withOptimization compilation = - if optimize then compilation |> withOptimize - else compilation |> withNoOptimize let generatedSignature = Fs implementationFile |> withRealInternalSignature realsig - |> withOptimization + |> withOptimization optimize |> printSignatures Fsi generatedSignature |> asLibrary |> withAdditionalSourceFile (FsSource implementationFile) |> withRealInternalSignature realsig - |> withOptimization + |> withOptimization optimize |> compile |> shouldSucceed diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/nested_generic_closure.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/nested_generic_closure.fs new file mode 100644 index 00000000000..4d63e54ce28 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/nested_generic_closure.fs @@ -0,0 +1,349 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +namespace MyCollections + +#nowarn "52" // The value has been copied to ensure the original is not mutated by this operation + +open System.Diagnostics +open System.Collections +open System.Collections.Generic +open Microsoft.FSharp.Core + +module internal IEnumerator = + + let noReset() = raise (new System.NotSupportedException("SR.GetString(SR.resetNotSupported)")) + let notStarted() = raise (new System.InvalidOperationException("SR.GetString(SR.enumerationNotStarted)")) + let alreadyFinished() = raise (new System.InvalidOperationException("SR.GetString(SR.enumerationAlreadyFinished)")) + let check started = if not started then notStarted() + let dispose (r : System.IDisposable) = r.Dispose() + + let cast (e : IEnumerator) : IEnumerator<'T> = + { new IEnumerator<'T> with + member _.Current = unbox<'T> e.Current + + interface IEnumerator with + member _.Current = unbox<'T> e.Current :> obj + + [] + member _.MoveNext() = e.MoveNext() + + member _.Reset() = noReset() + + interface System.IDisposable with + member _.Dispose() = + match e with + | :? System.IDisposable as e -> e.Dispose() + | _ -> () } + + /// A concrete implementation of an enumerator that returns no values + [] + type EmptyEnumerator<'T>() = + let mutable started = false + interface IEnumerator<'T> with + member _.Current = + check started + (alreadyFinished() : 'T) + + interface System.Collections.IEnumerator with + member _.Current = + check started + (alreadyFinished() : obj) + + [] + member _.MoveNext() = + if not started then started <- true + false + + member _.Reset() = noReset() + + interface System.IDisposable with + member _.Dispose() = () + + let Empty<'T> () = (new EmptyEnumerator<'T>() :> IEnumerator<'T>) + + [] + type EmptyEnumerable<'T> = + + | EmptyEnumerable + + interface IEnumerable<'T> with + member _.GetEnumerator() = Empty<'T>() + + interface IEnumerable with + member _.GetEnumerator() = (Empty<'T>() :> IEnumerator) + + type GeneratedEnumerable<'T, 'State>(openf: unit -> 'State, compute: 'State -> 'T option, closef: 'State -> unit) = + let mutable started = false + let mutable curr = None + let state = ref (Some (openf ())) + let getCurr() : 'T = + check started + match curr with + | None -> alreadyFinished() + | Some x -> x + + let readAndClear () = + lock state (fun () -> + match state.Value with + | None -> None + | Some _ as res -> + state.Value <- None + res) + + let start() = + if not started then + started <- true + + let dispose() = + readAndClear() |> Option.iter closef + + let finish() = + try dispose() + finally curr <- None + + interface IEnumerator<'T> with + member _.Current = getCurr() + + interface IEnumerator with + member _.Current = box (getCurr()) + + [] + member _.MoveNext() = + start() + match state.Value with + | None -> false // we started, then reached the end, then got another MoveNext + | Some s -> + match (try compute s with e -> finish(); reraise()) with + | None -> finish(); false + | Some _ as x -> + curr <- x + true + + member _.Reset() = noReset() + + interface System.IDisposable with + member _.Dispose() = dispose() + + [] + type Singleton<'T>(v:'T) = + let mutable started = false + + interface IEnumerator<'T> with + member _.Current = v + + interface IEnumerator with + member _.Current = box v + + [] + member _.MoveNext() = if started then false else (started <- true; true) + + member _.Reset() = noReset() + + interface System.IDisposable with + member _.Dispose() = () + + let Singleton x = (new Singleton<'T>(x) :> IEnumerator<'T>) + + let EnumerateThenFinally f (e : IEnumerator<'T>) = + { new IEnumerator<'T> with + member _.Current = e.Current + + interface IEnumerator with + member _.Current = (e :> IEnumerator).Current + + [] + member _.MoveNext() = e.MoveNext() + + member _.Reset() = noReset() + + interface System.IDisposable with + member _.Dispose() = + try + e.Dispose() + finally + f() + } + + let inline checkNonNull argName arg = + if isNull arg then + nullArg argName + + let mkSeq f = + { new IEnumerable<'U> with + member _.GetEnumerator() = f() + + interface IEnumerable with + member _.GetEnumerator() = (f() :> IEnumerator) } + +namespace Microsoft.FSharp.Core.CompilerServices + + open System.Diagnostics + open Microsoft.FSharp.Core + open MyCollections + open MyCollections.IEnumerator + open System.Collections + open System.Collections.Generic + + module RuntimeHelpers = + + [] + type internal StructBox<'T when 'T:equality>(value:'T) = + member x.Value = value + + static member Comparer = + let gcomparer = HashIdentity.Structural<'T> + { new IEqualityComparer> with + member _.GetHashCode(v) = gcomparer.GetHashCode(v.Value) + member _.Equals(v1,v2) = gcomparer.Equals(v1.Value,v2.Value) } + + let Generate openf compute closef = + mkSeq (fun () -> new IEnumerator.GeneratedEnumerable<_,_>(openf, compute, closef) :> IEnumerator<'T>) + + let EnumerateFromFunctions create moveNext current = + Generate + create + (fun x -> if moveNext x then Some(current x) else None) + (fun x -> match box(x) with :? System.IDisposable as id -> id.Dispose() | _ -> ()) + + // A family of enumerators that can have additional 'finally' actions added to the enumerator through + // the use of mutation. This is used to 'push' the disposal action for a 'use' into the next enumerator. + // For example, + // seq { use x = ... + // while ... } + // results in the 'while' loop giving an adjustable enumerator. This is then adjusted by adding the disposal action + // from the 'use' into the enumerator. This means that we avoid constructing a two-deep enumerator chain in this + // common case. + type IFinallyEnumerator = + abstract AppendFinallyAction : (unit -> unit) -> unit + + /// A concrete implementation of IEnumerable that adds the given compensation to the "Dispose" chain of any + /// enumerators returned by the enumerable. + [] + type FinallyEnumerable<'T>(compensation: unit -> unit, restf: unit -> seq<'T>) = + interface IEnumerable<'T> with + member _.GetEnumerator() = + try + let ie = restf().GetEnumerator() + match ie with + | :? IFinallyEnumerator as a -> + a.AppendFinallyAction(compensation) + ie + | _ -> + IEnumerator.EnumerateThenFinally compensation ie + with e -> + compensation() + reraise() + interface IEnumerable with + member x.GetEnumerator() = ((x :> IEnumerable<'T>).GetEnumerator() :> IEnumerator) + + /// An optimized object for concatenating a sequence of enumerables + [] + type ConcatEnumerator<'T,'U when 'U :> seq<'T>>(sources: seq<'U>) = + let mutable outerEnum = sources.GetEnumerator() + let mutable currInnerEnum = IEnumerator.Empty() + + let mutable started = false + let mutable finished = false + let mutable compensations = [] + + [] // false = unchecked + val mutable private currElement : 'T + + member _.Finish() = + finished <- true + try + match currInnerEnum with + | null -> () + | _ -> + try + currInnerEnum.Dispose() + finally + currInnerEnum <- null + finally + try + match outerEnum with + | null -> () + | _ -> + try + outerEnum.Dispose() + finally + outerEnum <- null + finally + let rec iter comps = + match comps with + | [] -> () + | h :: t -> + try h() finally iter t + try + compensations |> List.rev |> iter + finally + compensations <- [] + + member x.GetCurrent() = + IEnumerator.check started + if finished then IEnumerator.alreadyFinished() else x.currElement + + interface IFinallyEnumerator with + member _.AppendFinallyAction(f) = + compensations <- f :: compensations + + interface IEnumerator<'T> with + member x.Current = x.GetCurrent() + + interface IEnumerator with + member x.Current = box (x.GetCurrent()) + + [] + member x.MoveNext() = + if not started then started <- true + if finished then false + else + let rec takeInner () = + // check the inner list + if currInnerEnum.MoveNext() then + x.currElement <- currInnerEnum.Current + true + else + // check the outer list + let rec takeOuter() = + if outerEnum.MoveNext() then + let ie = outerEnum.Current + // Optimization to detect the statically-allocated empty IEnumerables + match box ie with + | :? EmptyEnumerable<'T> -> + // This one is empty, just skip, don't call GetEnumerator, try again + takeOuter() + | _ -> + // OK, this one may not be empty. + // Don't forget to dispose of the enumerator for the inner list now we're done with it + currInnerEnum.Dispose() + currInnerEnum <- ie.GetEnumerator() + takeInner () + else + // We're done + x.Finish() + false + takeOuter() + takeInner () + + member _.Reset() = IEnumerator.noReset() + + interface System.IDisposable with + + [] + member x.Dispose() = + if not finished then + x.Finish() + + module doIt = + open System + open Microsoft.FSharp.Core.CompilerServices + open Microsoft.FSharp.Collections + + let x = seq { ArraySegment([|1uy; 2uy; 3uy|]); ArraySegment([|1uy; 2uy; 3uy|]); ArraySegment([|1uy; 2uy; 3uy|]); } + let enumerator = new RuntimeHelpers.ConcatEnumerator<_,_>(x) :> IEnumerator + let rec loop () = + if enumerator.MoveNext() then + printfn $"{enumerator.Current}" + loop () + loop () diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index cd409116c3c..ebd0bf52648 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -537,6 +537,10 @@ module rec Compiler = let withOptimize (cUnit: CompilationUnit) : CompilationUnit = withOptionsHelper [ "--optimize+" ] "withOptimize is only supported for F#" cUnit + let withOptimization (optimization: bool) (cUnit: CompilationUnit) : CompilationUnit = + let option = if optimization then "--optimize+" else "--optimize-" + withOptionsHelper [ option ] "withOptimization is only supported for F#" cUnit + let withFullPdb(cUnit: CompilationUnit) : CompilationUnit = withOptionsHelper [ "--debug:full" ] "withFullPdb is only supported for F#" cUnit