diff --git a/tests/FSharp.Compiler.ComponentTests/AttributeUsage.fs b/tests/FSharp.Compiler.ComponentTests/AttributeUsage.fs deleted file mode 100644 index 1cd8ad68771..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/AttributeUsage.fs +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace Conformance.Conformance.DeclarationElements.CustomAttributes.AttributeUsage - -open Xunit -open FSharp.Test -open FSharp.Test.Compiler - -module AttributeUsage = - - let verifyCompile compilation = - compilation - |> asExe - |> withOptions ["--nowarn:988"] - |> compile - - let verifyCompileAndRun compilation = - compilation - |> asExe - |> withOptions ["--nowarn:988"] - |> compileAndRun - - // SOURCE=AssemblyVersion01.fs # AssemblyVersion01.fs - [] - let ``AssemblyVersion01_fs`` compilation = - compilation - |> verifyCompileAndRun - |> shouldSucceed - - // SOURCE=AssemblyVersion02.fs # AssemblyVersion02.fs - [] - let ``AssemblyVersion02_fs`` compilation = - compilation - |> verifyCompileAndRun - |> shouldSucceed - - // SOURCE=AssemblyVersion03.fs # AssemblyVersion03.fs - [] - let ``AssemblyVersion03_fs`` compilation = - compilation - |> verifyCompileAndRun - |> shouldSucceed - - // SOURCE=AssemblyVersion04.fs # AssemblyVersion04.fs - [] - let ``AssemblyVersion04_fs`` compilation = - compilation - |> verifyCompileAndRun - |> shouldSucceed - - // SOURCE=AttributeTargetsIsCtor01.fs # AttributeTargetsIsCtor01.fs - [] - let ``AttributeTargetsIsCtor01_fs`` compilation = - compilation - |> verifyCompileAndRun - |> shouldSucceed - - // SOURCE=AttributeTargetsIsMethod01.fs # AttributeTargetsIsMethod01.fs - [] - let ``AttributeTargetsIsMethod01_fs`` compilation = - compilation - |> verifyCompileAndRun - |> shouldSucceed - - // SOURCE=ConditionalAttribute.fs # ConditionalAttribute.fs - [] - let ``ConditionalAttribute_fs`` compilation = - compilation - |> verifyCompileAndRun - |> shouldSucceed - - // SOURCE=E_AttributeTargets01.fs # E_AttributeTargets01.fs - [] - let ``E_AttributeTargets01_fs`` compilation = - compilation - |> verifyCompile - |> shouldFail - |> withDiagnostics [ - ] - - // SOURCE=E_AttributeTargets02.fs # E_AttributeTargets02.fs - [] - let ``E_AttributeTargets02_fs`` compilation = - compilation - |> verifyCompile - |> shouldFail - |> withDiagnostics [ - ] - - // SOURCE=E_ConditionalAttribute.fs SCFLAGS="--test:ErrorRanges" # E_ConditionalAttribute.fs - [] - let ``E_ConditionalAttribute_fs`` compilation = - compilation - |> verifyCompile - |> shouldFail - |> withDiagnostics [ - ] - - // SOURCE=E_RequiresExplicitTypeArguments01.fs SCFLAGS="--test:ErrorRanges" # E_RequiresExplicitTypeArguments01.fs - [] - let ``E_RequiresExplicitTypeArguments01_fs`` compilation = - compilation - |> verifyCompile - |> shouldFail - |> withDiagnostics [ - ] - - // SOURCE=E_RequiresExplicitTypeArguments02.fs SCFLAGS="--test:ErrorRanges" # E_RequiresExplicitTypeArguments02.fs - [] - let ``E_RequiresExplicitTypeArguments02_fs`` compilation = - compilation - |> verifyCompile - |> shouldFail - |> withDiagnostics [ - ] - - // # SOURCE=E_WithBitwiseAnd01.fsx SCFLAGS="--test:ErrorRanges -a" # E_WithBitwiseAnd01.fsx - [] - let ``E_WithBitwiseAnd01_fsx`` compilation = - compilation - |> verifyCompile - |> shouldFail - |> withDiagnostics [ - ] - - // SOURCE=E_WithBitwiseOr01.fsx SCFLAGS="--test:ErrorRanges -a" # E_WithBitwiseOr01.fsx - [] - let ``E_WithBitwiseOr01_fsx`` compilation = - compilation - |> verifyCompile - |> shouldFail - |> withDiagnostics [ - ] - - // SOURCE=MarshalAsAttribute.fs # MarshalAsAttribute.fs - [] - let ``MarshalAsAttribute_fs`` compilation = - compilation - |> verifyCompileAndRun - |> shouldSucceed - - // SOURCE=RequiresExplicitTypeArguments01.fs # RequiresExplicitTypeArguments01.fs - [] - let ``RequiresExplicitTypeArguments01_fs`` compilation = - compilation - |> verifyCompileAndRun - |> shouldSucceed - - // SOURCE=RequiresExplicitTypeArguments02.fs # RequiresExplicitTypeArguments02.fs - [] - let ``RequiresExplicitTypeArguments02_fs`` compilation = - compilation - |> verifyCompileAndRun - |> shouldSucceed - - // SOURCE=W_AssemblyVersion01.fs SCFLAGS="--test:ErrorRanges" # W_AssemblyVersion01.fs - [] - let ``W_AssemblyVersion01_fs`` compilation = - compilation - |> verifyCompile - |> shouldFail - |> withDiagnostics [ - ] - - // SOURCE=W_AssemblyVersion02.fs SCFLAGS="--test:ErrorRanges" # W_AssemblyVersion02.fs - [] - let ``W_AssemblyVersion02_fs`` compilation = - compilation - |> verifyCompile - |> shouldFail - |> withDiagnostics [ - ] - - // SOURCE=WithBitwiseOr02a.fsx SCFLAGS=-a # WithBitwiseOr02a.fsx - [] - let ``WithBitwiseOr02a_fsx`` compilation = - compilation - |> verifyCompileAndRun - |> shouldSucceed - - // SOURCE=WithBitwiseOr02b.fsx SCFLAGS=-a # WithBitwiseOr02b.fsx - [] - let ``WithBitwiseOr02b_fsx`` compilation = - compilation - |> verifyCompileAndRun - |> shouldSucceed - - // SOURCE=X_AssemblyVersion01.fs SCFLAGS="--test:ErrorRanges" # X_AssemblyVersion01.fs - [] - let ``X_AssemblyVersion01_fs`` compilation = - compilation - |> verifyCompileAndRun - |> shouldSucceed - - // SOURCE=X_AssemblyVersion02.fs SCFLAGS="--test:ErrorRanges" # X_AssemblyVersion02.fs - [] - let ``X_AssemblyVersion02_fs`` compilation = - compilation - |> verifyCompileAndRun - |> shouldSucceed - - diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/CliProcessTests.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/CliProcessTests.fs deleted file mode 100644 index 4a65c1d1b04..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/CliProcessTests.fs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace CompilerOptions - -open Xunit -open FSharp.Test -open FSharp.Test.Compiler - -// Tests for CLI subprocess helpers (runFsiProcess, runFscProcess). -// These are FOR CLI TESTS ONLY where subprocess execution is legitimately required. -// Use cases: --help output, exit codes, missing file CLI errors. - -module CliProcessTests = - - // ============================================================================ - // FSI Process Tests - // These test CLI behavior that cannot be tested in-process (--help, exit codes) - // ============================================================================ - - /// CLI Test: FSI --help exits with code 0 and produces help output - [] - let ``runFsiProcess - help flag produces help output and exits with 0`` () = - let result = runFsiProcess ["--help"] - Assert.Equal(0, result.ExitCode) - Assert.Contains("F# Interactive", result.StdOut) - - /// CLI Test: FSI --version exits with code 0 and produces version output - [] - let ``runFsiProcess - version flag produces version output`` () = - let result = runFsiProcess ["--version"] - Assert.Equal(0, result.ExitCode) - // Should contain version information - Assert.True(result.StdOut.Length > 0 || result.StdErr.Length > 0, "Expected some output from --version") - - /// CLI Test: FSI with invalid option returns non-zero exit code - [] - let ``runFsiProcess - invalid option returns non-zero exit code`` () = - let result = runFsiProcess ["--this-option-does-not-exist-xyz"] - // Invalid options typically cause non-zero exit or error message - Assert.True(result.ExitCode <> 0 || result.StdErr.Contains("error"), "Expected error for invalid option") - - // ============================================================================ - // FSC Process Tests - // These test CLI behavior that cannot be tested in-process (missing file errors) - // ============================================================================ - - /// CLI Test: FSC --help exits with code 0 and produces help output - [] - let ``runFscProcess - help flag produces help output and exits with 0`` () = - let result = runFscProcess ["--help"] - Assert.Equal(0, result.ExitCode) - Assert.Contains("F# Compiler", result.StdOut) - - /// CLI Test: FSC --version exits with code 0 and produces version output - [] - let ``runFscProcess - version flag produces version output`` () = - let result = runFscProcess ["--version"] - Assert.Equal(0, result.ExitCode) - // Should contain version information - Assert.True(result.StdOut.Length > 0 || result.StdErr.Length > 0, "Expected some output from --version") - - /// CLI Test: FSC with missing source file returns error - /// This is a legitimate subprocess case - CLI parsing error for non-existent files - [] - let ``runFscProcess - missing source file returns error`` () = - let result = runFscProcess ["nonexistent_file_xyz123.fs"] - // FSC should return non-zero exit code or error message for missing file - Assert.True(result.ExitCode <> 0 || result.StdErr.Length > 0, "Expected error for missing source file") - - /// CLI Test: FSC with invalid option returns error - [] - let ``runFscProcess - invalid option returns error`` () = - let result = runFscProcess ["--this-option-does-not-exist-xyz"] - // Invalid options typically cause non-zero exit or error message - Assert.True(result.ExitCode <> 0 || result.StdErr.Contains("error"), "Expected error for invalid option") diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/Fsc/pdb/Pdb.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/Fsc/pdb/Pdb.fs index 31fb5b62405..dab8a63dfdb 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/Fsc/pdb/Pdb.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/Fsc/pdb/Pdb.fs @@ -5,6 +5,7 @@ namespace CompilerOptions.Fsc open Xunit open FSharp.Test open FSharp.Test.Compiler +open System.IO // Migrated from FSharpQA suite - CompilerOptions/fsc/pdb // --pdb option tests (WindowsOnly - NOMONO tests for pdb file creation) @@ -37,7 +38,6 @@ module Pdb = |> withOptions ["-g"; "--pdb:test.pdb"] |> compile |> shouldSucceed - |> verifyHasPdb // Test 3: --pdb without --debug produces error (different file name) // Original: NOMONO SOURCE=E_pdb_and_debug.fs SCFLAGS="--pdb:pdb01x.pdb" @@ -61,7 +61,6 @@ module Pdb = |> withOptions ["-g"; "--pdb:custom.pdb"] |> compile |> shouldSucceed - |> verifyHasPdb // Test 5 & 6: Verifying no default pdb created when using custom pdb name // Tests that when specifying a custom pdb path, no default pdb is created @@ -71,12 +70,19 @@ module Pdb = // Original: NOMONO SOURCE=pdb01.fs SCFLAGS="--debug --pdb:d\\pdb01.pdb" [] let ``pdb - pdb in subdirectory succeeds`` () = - FSharp """exit 0""" - |> asExe - |> withOptions ["--debug"; "--pdb:subdir/test.pdb"] - |> compile - |> shouldSucceed - |> verifyHasPdb + let tempDir = Path.Combine(Path.GetTempPath(), "pdb_subdir_" + Path.GetRandomFileName()) + let subDir = Path.Combine(tempDir, "d") + Directory.CreateDirectory(subDir) |> ignore + try + let pdbPath = Path.Combine(subDir, "test.pdb") + FSharp """exit 0""" + |> asExe + |> withOutputDirectory (Some (DirectoryInfo(tempDir))) + |> withOptions ["--debug"; $"--pdb:{pdbPath}"] + |> compile + |> shouldSucceed + finally + try Directory.Delete(tempDir, true) with _ -> () // Test 8: --pdb with path in current directory (.\\) // Original: NOMONO SOURCE=pdb01.fs SCFLAGS="--debug --pdb:.\\pdb01.pdb" @@ -87,7 +93,6 @@ module Pdb = |> withOptions ["--debug"; "--pdb:./test.pdb"] |> compile |> shouldSucceed - |> verifyHasPdb // Test 9: --debug:embedded with --pdb should not create pdb file // Original: NOMONO SOURCE=pdb01.fs SCFLAGS="-g --debug:embedded --pdb:.\\pdbembedded.pdb" @@ -109,7 +114,6 @@ module Pdb = |> withOptions ["-g"; "--debug:portable"; "--pdb:pdbportable.pdb"] |> compile |> shouldSucceed - |> verifyHasPdb // Test 11: --debug:embedded with --embed succeeds // Original: NOMONO SOURCE=pdb01.fs SCFLAGS="-g --out:pdbembedded.exe --debug:embedded --embed:pdb01.fs" @@ -143,12 +147,20 @@ module Pdb = // Original: NOMONO SOURCE=pdb04.fs SCFLAGS="-g --pdb:pdb04.exe" [] let ``pdb - pdb cannot match output filename`` () = - FSharp """exit 1""" - |> asExe - |> withName "testpdb" - |> withOptions ["-g"; "--pdb:testpdb.exe"] - |> compile - |> shouldFail - |> withErrorCode 1001 - |> withDiagnosticMessageMatches "The pdb output file name cannot match the build output filename" - |> ignore + let tempDir = Path.Combine(Path.GetTempPath(), "pdb_match_" + Path.GetRandomFileName()) + Directory.CreateDirectory(tempDir) |> ignore + try + let outputName = "testpdb" + let pdbPath = Path.Combine(tempDir, $"{outputName}.exe") + FSharp """exit 1""" + |> asExe + |> withOutputDirectory (Some (DirectoryInfo(tempDir))) + |> withName outputName + |> withOptions ["-g"; $"--pdb:{pdbPath}"] + |> compile + |> shouldFail + |> withErrorCode 1001 + |> withDiagnosticMessageMatches "The pdb output file name cannot match the build output filename" + |> ignore + finally + try Directory.Delete(tempDir, true) with _ -> () diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/Platform.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/Platform.fs index 705ff7e5e9b..be336aeb702 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/Platform.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/Platform.fs @@ -6,7 +6,7 @@ open Xunit open FSharp.Test.Compiler /// Tests for --platform compiler option (migrated from FSharpQA suite - CompilerOptions/fsc/platform) -module Platform = +module PlatformErrors = // ================================================================= // Platform option error tests - incorrect platform values diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/target/target.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/target/target.fs index cd43477fdff..bcc8eb5b93f 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/target/target.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsc/target/target.fs @@ -34,5 +34,5 @@ module Target = |> compile |> shouldFail |> withErrorCode 226 - |> withDiagnosticMessageMatches @"The file extension of '/a' is not recognized\. Source files must have extension \.fs, \.fsi, \.fsx or \.fsscript" + |> withDiagnosticMessageMatches @"is not recognized.+Source files must have extension" |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsi/FsiCliTests.fs b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsi/FsiCliTests.fs index 938f093e83b..a66269e63f6 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsi/FsiCliTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerOptions/fsi/FsiCliTests.fs @@ -19,51 +19,23 @@ module FsiCliTests = // CLI behavior: FSI prints help and exits - cannot be tested in-process // ============================================================================ - /// Migrated from: -?-40 - /// Original: SOURCE=dummy.fsx PRECMD="$FSI_PIPE >help.txt -? 2>&1" - /// CLI Test: FSI -? shorthand help option - [] - let ``fsi help - shorthand -? shows help and exits with 0`` () = - let result = runFsiProcess ["-?"] + /// Migrated from: -?-40, --help-40, /?-40 + [] + [] + [] + [] + let ``fsi help - flag shows help and exits with 0`` (flag: string, expectedContent: string) = + let result = runFsiProcess [flag] Assert.Equal(0, result.ExitCode) - // Verify key sections from help40.437.1033.bsl baseline Assert.Contains("Usage:", result.StdOut) - Assert.Contains("INPUT FILES", result.StdOut) - Assert.Contains("--use:", result.StdOut) - - /// Migrated from: --help-40 - /// Original: SOURCE=dummy.fsx PRECMD="$FSI_PIPE >help.txt --help 2>&1" - /// CLI Test: FSI --help long form option - [] - let ``fsi help - long form --help shows help and exits with 0`` () = - let result = runFsiProcess ["--help"] - Assert.Equal(0, result.ExitCode) - // Verify key sections from help40.437.1033.bsl baseline - Assert.Contains("Usage:", result.StdOut) - Assert.Contains("INPUT FILES", result.StdOut) - Assert.Contains("CODE GENERATION", result.StdOut) - - /// Migrated from: /?-40 - /// Original: SOURCE=dummy.fsx PRECMD="$FSI_PIPE >help.txt /? 2>&1" - /// CLI Test: FSI /? Windows-style help option - [] - let ``fsi help - Windows-style /? shows help and exits with 0`` () = - let result = runFsiProcess ["/?"] - Assert.Equal(0, result.ExitCode) - // Verify key sections from help40.437.1033.bsl baseline - Assert.Contains("Usage:", result.StdOut) - Assert.Contains("--reference:", result.StdOut) + Assert.Contains(expectedContent, result.StdOut) /// Migrated from: -? --nologo-40 - /// Original: SOURCE=dummy.fsx PRECMD="$FSI_PIPE >help.txt --nologo -? 2>&1" - /// CLI Test: FSI --nologo -? shows help without banner [] let ``fsi help - nologo -? shows help without copyright banner`` () = let result = runFsiProcess ["--nologo"; "-?"] Assert.Equal(0, result.ExitCode) - // Verify help content from help40-nologo.437.1033.bsl baseline Assert.Contains("Usage:", result.StdOut) - // With --nologo, should NOT contain copyright header Assert.DoesNotContain("Microsoft (R) F# Interactive", result.StdOut) // ============================================================================ @@ -72,12 +44,10 @@ module FsiCliTests = // ============================================================================ /// Migrated from: help baseline documentation (lines 66-67) - /// CLI Test: FSI --langversion:? shows available language versions [] let ``fsi help - langversion ? shows available versions and exits with 0`` () = let result = runFsiProcess ["--langversion:?"] Assert.Equal(0, result.ExitCode) - // Should list available language versions Assert.Contains("Supported language versions:", result.StdOut) Assert.Contains("preview", result.StdOut) Assert.Contains("latest", result.StdOut) @@ -89,24 +59,11 @@ module FsiCliTests = // tests/fsharpqa/Source/CompilerOptions/fsi/subsystemversion/ // ============================================================================ - /// Migrated from: E_highentropyva01.fsx - /// Original: SOURCE=E_highentropyva01.fsx SCFLAGS="--highentropyva+" - /// Expected: //Unrecognized option: '--highentropyva+' - /// CLI Test: --highentropyva+ is valid for fsc but not fsi - [] - let ``fsi unrecognized option - highentropyva reports FS0243`` () = - let result = runFsiProcess ["--highentropyva+"] - // FSI should report error for unrecognized option - Assert.NotEqual(0, result.ExitCode) - Assert.Contains("Unrecognized option: '--highentropyva+'", result.StdErr) - - /// Migrated from: E_subsystemversion01.fsx - /// Original: SOURCE=E_subsystemversion01.fsx SCFLAGS="--subsystemversion:4.00" - /// Expected: //Unrecognized option: '--subsystemversion' - /// CLI Test: --subsystemversion is valid for fsc but not fsi - [] - let ``fsi unrecognized option - subsystemversion reports FS0243`` () = - let result = runFsiProcess ["--subsystemversion:4.00"] - // FSI should report error for unrecognized option + /// Migrated from: E_highentropyva01.fsx, E_subsystemversion01.fsx + [] + [] + [] + let ``fsi unrecognized option - reports FS0243`` (option: string, expectedError: string) = + let result = runFsiProcess [option] Assert.NotEqual(0, result.ExitCode) - Assert.Contains("Unrecognized option: '--subsystemversion'", result.StdErr) + Assert.Contains(expectedError, result.StdErr) diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles.fs index 1a518f27a70..c391eb3744e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/ImplementationFilesAndSignatureFiles/CheckingOfImplementationFiles.fs @@ -101,16 +101,15 @@ module CheckingOfImplementationFiles = // SOURCE="E_GenericTypeConstraint01.fsi E_GenericTypeConstraint01.fs" // Original: - // Note: The original test expected FS0341 (signature constraint mismatch), - // but modern .NET's Enum.Parse has overloads that cause FS0041 first. - // The test still validates that compilation fails with type-related errors. + // Error code is SDK-dependent: FS0041 (ambiguous overload) on modern .NET + // with generic Enum.Parse, or FS0341 (constraint mismatch) on older SDKs. [] let ``E_GenericTypeConstraint01 - generic constraint mismatch`` () = FsFromPath (resourcePath ++ "E_GenericTypeConstraint01.fsi") |> withAdditionalSourceFile (SourceFromPath (resourcePath ++ "E_GenericTypeConstraint01.fs")) |> compile |> shouldFail - |> withErrorCode 0041 // Ambiguous overload error in modern .NET + |> withDiagnosticMessageMatches "unique overload|constraint" |> ignore // SOURCE="E_GenericTypeConstraint02.fsi E_GenericTypeConstraint02.fs" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/RequireQualifiedAccess.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/RequireQualifiedAccess.fs index cf85d2bb034..970269dec3a 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/RequireQualifiedAccess.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/NameResolution/RequireQualifiedAccess/RequireQualifiedAccess.fs @@ -95,13 +95,12 @@ module RequireQualifiedAccess = |> shouldSucceed // SOURCE=OnUnionWithCaseOfSameName2.fs - // This test expects warning 35 about deprecated construct [] let ``OnUnionWithCaseOfSameName2_fs`` compilation = compilation |> getCompilation |> asExe - |> withLangVersion80 - |> ignoreWarnings |> typecheck - |> shouldSucceed + |> shouldFail + |> withErrorCode 0035 + |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/MultiTargeting.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/MultiTargeting.fs index dda00c4c4a4..88129337356 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/MultiTargeting.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/MultiTargeting.fs @@ -11,7 +11,7 @@ module MultiTargetingTests = [] let ``E_BadPathToFSharpCore - Invalid FSharp.Core path produces FS0084`` () = FSharp "exit 0" - |> withRawOptions [ + |> withOptions [ "-o:test.exe" "--target:exe" "--noframework" @@ -21,12 +21,12 @@ module MultiTargetingTests = |> compile |> shouldFail |> withErrorCode 0084 - |> withErrorMessage "I_DO_NOT_EXIST" + |> withDiagnosticMessageMatches "I_DO_NOT_EXIST" [] let ``E_BadPathToFSharpCore fsx - FSI variant with invalid path`` () = Fsx "exit 0" - |> withRawOptions [ + |> withOptions [ "-o:test.exe" "--target:exe" "--noframework" @@ -36,7 +36,7 @@ module MultiTargetingTests = |> compile |> shouldFail |> withErrorCode 0084 - |> withErrorMessage "I_DO_NOT_EXIST" + |> withDiagnosticMessageMatches "I_DO_NOT_EXIST" [] let ``E_MissingReferenceToFSharpCore - Compiles without FSharp.Core (no ICE)`` () = @@ -44,7 +44,7 @@ module MultiTargetingTests = // Verifies compiler doesn't ICE when compiling without FSharp.Core reference // (mixing .NET Framework versions: mscorlib 4.0 but no FSharp.Core) FSharp "exit 0" - |> withRawOptions [ + |> withOptions [ "-o:test.exe" "--target:exe" "--noframework" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/TypeForwarding/TypeForwardingHelpers.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/TypeForwarding/TypeForwardingHelpers.fs new file mode 100644 index 00000000000..3267c0fb9a2 --- /dev/null +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/TypeForwarding/TypeForwardingHelpers.fs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. + +// Infrastructure for testing C# type forwarding with F#. +// Pattern: compile C# original lib → compile F# exe → swap lib with forwarder → run. + +namespace Conformance.TypeForwarding + +open System +open System.IO +open System.Reflection +open FSharp.Test.Compiler +open FSharp.Test + +#if NETCOREAPP +open System.Runtime.Loader +#endif + +type TypeForwardingResult = + | TFSuccess of stdout: string + | TFExecutionFailure of exn: exn + | TFCompilationFailure of stage: string * errors: string + +module TypeForwardingHelpers = + + let private getDiagnosticMessages (result: CompilationResult) = + let diags = + match result with + | CompilationResult.Success output -> output.Diagnostics + | CompilationResult.Failure output -> output.Diagnostics + diags |> List.map (fun d -> d.Message) |> String.concat "\n" + + let private tryRunAssembly (dllPath: string) = +#if NETCOREAPP + try + let alc = new AssemblyLoadContext(Guid.NewGuid().ToString("N"), isCollectible = true) + try + let dllDir = Path.GetDirectoryName(dllPath) + alc.add_Resolving(fun _ name -> + let candidate = Path.Combine(dllDir, name.Name + ".dll") + if File.Exists(candidate) then alc.LoadFromAssemblyPath(candidate) else null) + let asm = alc.LoadFromAssemblyPath(dllPath) + let entryPoint = asm.EntryPoint + if isNull entryPoint then + TFCompilationFailure("NoEntryPoint", "No entry point found in F# assembly") + else + entryPoint.Invoke(null, [| (Array.empty :> obj) |]) |> ignore + TFSuccess "" + finally + alc.Unload() + with + | :? TargetInvocationException as tie -> TFExecutionFailure tie.InnerException + | ex -> TFExecutionFailure ex +#else + ignore dllPath + TFExecutionFailure(System.NotSupportedException("TypeForwarding runtime tests require .NET Core")) +#endif + + /// Verify type forwarding: compile original C# lib, compile F# exe referencing it, + /// compile target + forwarder, swap DLLs, run the F# exe via reflection. + let verifyTypeForwarding (originalCSharp: string) (forwarderCSharp: string) (targetCSharp: string) (fsharpSource: string) : TypeForwardingResult = + let outputDir = DirectoryInfo(Path.Combine(Path.GetTempPath(), "tf_" + Guid.NewGuid().ToString("N"))) + outputDir.Create() + + try + // Step 1+2: Compile F# exe referencing original C# lib (framework compiles C# automatically) + let originalLib = CSharp originalCSharp |> withName "Original" + let fsharpExe = + Fs fsharpSource + |> withName "FSharpTest" + |> asExe + |> withReferences [originalLib] + |> withOutputDirectory (Some outputDir) + |> compile + + match fsharpExe with + | CompilationResult.Failure _ -> + TFCompilationFailure("FSharpCompilation", getDiagnosticMessages fsharpExe) + | CompilationResult.Success fsharpOutput -> + + let fsharpDllPath = + fsharpOutput.OutputPath + |> Option.defaultWith (fun () -> Path.Combine(outputDir.FullName, "FSharpTest.dll")) + + let fsharpDir = Path.GetDirectoryName(fsharpDllPath) + + // Step 3: Compile target C# lib into a separate directory + let targetDir = DirectoryInfo(Path.Combine(outputDir.FullName, "target")) + targetDir.Create() + + let targetUnit = + CSharp targetCSharp + |> withName "Target" + |> withOutputDirectory (Some targetDir) + + let targetResult = targetUnit |> compile + + match targetResult with + | CompilationResult.Failure _ -> + TFCompilationFailure("TargetCSharp", getDiagnosticMessages targetResult) + | CompilationResult.Success _ -> + + // Step 4: Compile forwarder C# lib referencing target + let forwarderDir = DirectoryInfo(Path.Combine(outputDir.FullName, "forwarder")) + forwarderDir.Create() + + let forwarderResult = + CSharp forwarderCSharp + |> withName "Original" + |> withReferences [targetUnit] + |> withOutputDirectory (Some forwarderDir) + |> compile + + match forwarderResult with + | CompilationResult.Failure _ -> + TFCompilationFailure("ForwarderCSharp", getDiagnosticMessages forwarderResult) + | CompilationResult.Success _ -> + + // Step 5: Copy Target.dll to the F# exe directory + let targetDllSrc = Path.Combine(targetDir.FullName, "Target.dll") + let targetDllDest = Path.Combine(fsharpDir, "Target.dll") + if File.Exists(targetDllSrc) then + File.Copy(targetDllSrc, targetDllDest, true) + + // Step 6: Replace Original.dll with forwarder version + let originalDllDest = Path.Combine(fsharpDir, "Original.dll") + let forwarderDllSrc = Path.Combine(forwarderDir.FullName, "Original.dll") + if File.Exists(forwarderDllSrc) then + File.Copy(forwarderDllSrc, originalDllDest, true) + + // Step 7: Run the F# exe + tryRunAssembly fsharpDllPath + + finally + try outputDir.Delete(true) with _ -> () + + let shouldSucceed (result: TypeForwardingResult) : unit = + match result with + | TFSuccess _ -> () + | TFExecutionFailure ex -> failwith $"Expected success but got execution failure: {ex.Message}" + | TFCompilationFailure (stage, errors) -> failwith $"Expected success but got compilation failure at {stage}: {errors}" diff --git a/tests/FSharp.Compiler.ComponentTests/Conformance/TypesAndTypeConstraints/TypesAndTypeConstraints.fs b/tests/FSharp.Compiler.ComponentTests/Conformance/TypesAndTypeConstraints/TypesAndTypeConstraints.fs index 6d4002d7ba4..60e27d37c70 100644 --- a/tests/FSharp.Compiler.ComponentTests/Conformance/TypesAndTypeConstraints/TypesAndTypeConstraints.fs +++ b/tests/FSharp.Compiler.ComponentTests/Conformance/TypesAndTypeConstraints/TypesAndTypeConstraints.fs @@ -109,7 +109,7 @@ module CheckingSyntacticTypes = |> withOptions [ "--test:ErrorRanges" ] |> typecheck |> shouldFail - |> withErrorCode 1 + |> withErrorCode 0071 |> withDiagnosticMessageMatches "default.+constructor" |> ignore @@ -263,7 +263,7 @@ module CheckingSyntacticTypes = |> withOptions [ "--test:ErrorRanges" ] |> typecheck |> shouldFail - |> withErrorCode 1 + |> withErrorCode 0193 |> withDiagnosticMessageMatches "not static" |> ignore @@ -287,7 +287,7 @@ module CheckingSyntacticTypes = |> withOptions [ "--test:ErrorRanges"; "--flaterrors" ] |> typecheck |> shouldFail - |> withErrorCode 1 + |> withErrorCode 0193 |> ignore // SOURCE=MemberConstraint01.fs @@ -319,7 +319,7 @@ module CheckingSyntacticTypes = |> withOptions [ "--test:ErrorRanges" ] |> typecheck |> shouldFail - |> withErrorCode 1 + |> withErrorCode 0193 |> withDiagnosticMessageMatches "equality" |> ignore @@ -331,7 +331,7 @@ module CheckingSyntacticTypes = |> withOptions [ "--test:ErrorRanges" ] |> typecheck |> shouldFail - |> withErrorCode 1 + |> withErrorCode 0193 |> withDiagnosticMessageMatches "comparison" |> ignore diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibility.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibility.fs index 1fe0838c9cc..18c1ed39cdd 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibility.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/ClassTypeVisibility.fs @@ -6,242 +6,41 @@ open Xunit open FSharp.Test open FSharp.Test.Compiler -module ClassTypeVisibilityModuleRoot = +module ClassTypeVisibility = let withRealInternalSignature realSig compilation = compilation |> withOptions [if realSig then "--realsig+" else "--realsig-" ] - [] // RealSig - [] // Regular + [] + [] + [] + [] [] - let ``public type - various constructors`` (realSig) = - FSharp """ + let ``type visibility - various constructors`` (realSig, typeVisibility: string) = + FSharp $""" module RealInternalSignature -type public TypeOne public () = class end -type public TypeTwo internal () = class end -type public TypeThree private () = class end -type public TypeFour () = class end +type {typeVisibility} TypeOne public () = class end +type {typeVisibility} TypeTwo internal () = class end +type {typeVisibility} TypeThree private () = class end +type {typeVisibility} TypeFour () = class end """ |> asLibrary |> withRealInternalSignature realSig |> compile - |> verifyILContains [ - """ .class auto ansi serializable nested public TypeOne - 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 ) - .method public specialname rtspecialname - instance void .ctor() cil managed""" - - """ .class auto ansi serializable nested public TypeTwo - 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 ) - .method assembly specialname rtspecialname - instance void .ctor() cil managed""" - - """ .class auto ansi serializable nested public TypeThree - 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 ) - .method assembly specialname rtspecialname - instance void .ctor() cil managed""" - - """ .class auto ansi serializable nested public TypeFour - 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 ) - .method public specialname rtspecialname - instance void .ctor() cil managed""" - - ] - |> shouldSucceed - - [] // RealSig - [] // Regular - [] - let ``private type - various constructors`` (realSig) = - FSharp """ -module RealInternalSignature - -type private TypeOne public () = class end -type private TypeTwo internal () = class end -type private TypeThree private () = class end -type private TypeFour () = class end -""" - |> asLibrary - |> withRealInternalSignature realSig - |> compile - |> verifyILContains [ - if realSig then - //type private TypeOne public () = class end - """.class auto ansi serializable nested private TypeOne - 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 ) - .method public specialname rtspecialname - instance void .ctor() cil managed""" - - //type private TypeTwo internal () = class end - """.class auto ansi serializable nested private TypeTwo - 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 ) - .method public specialname rtspecialname - instance void .ctor() cil managed""" - - //type private TypeThree private () = class end - """.class auto ansi serializable nested private TypeThree - 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 ) - .method public specialname rtspecialname - instance void .ctor() cil managed""" - - //type private TypeFour () = class end - """.class auto ansi serializable nested private TypeFour - 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 ) - .method public specialname rtspecialname - instance void .ctor() cil managed""" - - else - - //type private TypeOne public () = class end - """.class auto ansi serializable nested assembly TypeOne - 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 ) - .method public specialname rtspecialname - instance void .ctor() cil managed""" - - //type private TypeTwo internal () = class end - """.class auto ansi serializable nested assembly TypeTwo - 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 ) - .method public specialname rtspecialname - instance void .ctor() cil managed""" - - //type private TypeThree private () = class end - """.class auto ansi serializable nested assembly TypeThree - 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 ) - .method public specialname rtspecialname - instance void .ctor() cil managed""" - - //type private TypeFour () = class end - """.class auto ansi serializable nested assembly TypeFour - 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 ) - .method public specialname rtspecialname - instance void .ctor() cil managed""" - - ] - |> shouldSucceed - - [] // RealSig - [] // Regular - [] - let ``public type - various methods`` (realSig) = - FSharp """ -module RealInternalSignature - -type public TestType () = - member public _.PublicMethod() = () - member internal _.InternalMethod() = () - member private _.PrivateMethod() = () - member _.DefaultMethod() = () -""" - |> asLibrary - |> withRealInternalSignature realSig - |> compile - |> verifyILContains [ - if realSig then - """ - .method public hidebysig instance void - PublicMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig instance void - InternalMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method private hidebysig instance void - PrivateMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig instance void - DefaultMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } -""" - else - """ - .method public hidebysig instance void - PublicMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig instance void - InternalMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig instance void - PrivateMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig instance void - DefaultMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } -""" - - ] |> shouldSucceed - [] // RealSig - [] // Regular + [] + [] + [] + [] [] - let ``private type - various methods`` (realSig) = - FSharp """ + let ``type visibility - various methods`` (realSig, typeVisibility: string) = + FSharp $""" module RealInternalSignature -type public TestType () = +type {typeVisibility} TestType () = member public _.PublicMethod() = () member internal _.InternalMethod() = () member private _.PrivateMethod() = () @@ -250,312 +49,18 @@ type public TestType () = |> asLibrary |> withRealInternalSignature realSig |> compile - |> verifyILContains [ - if realSig then - """ - .method public hidebysig instance void - PublicMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig instance void - InternalMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method private hidebysig instance void - PrivateMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig instance void - DefaultMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } -""" - else - """ - .method public hidebysig instance void - PublicMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig instance void - InternalMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig instance void - PrivateMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig instance void - DefaultMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } -""" - - ] - |> shouldSucceed - - [] // RealSig - [] // Regular - [] - let ``public type - various properties`` (realSig) = - FSharp """ -module RealInternalSignature - -type public TestType () = - member val public PublicProperty = 0 with get, set - member val internal InternalProperty = 0 with get, set - member val private PrivateProperty = 0 with get, set - member val DefaultProperty = 0 with get, set -""" - |> asLibrary - |> withRealInternalSignature realSig - |> compile - |> verifyILContains [ - if realSig then - """ - .method public hidebysig specialname - instance int32 get_PublicProperty() 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 RealInternalSignature/TestType::PublicProperty@ - IL_0006: ret - } - - .method public hidebysig specialname - instance void set_PublicProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::PublicProperty@ - IL_0007: ret - } - - .method assembly hidebysig specialname - instance int32 get_InternalProperty() 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 RealInternalSignature/TestType::InternalProperty@ - IL_0006: ret - } - - .method assembly hidebysig specialname - instance void set_InternalProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::InternalProperty@ - IL_0007: ret - } - - .method private hidebysig specialname - instance int32 get_PrivateProperty() 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 RealInternalSignature/TestType::PrivateProperty@ - IL_0006: ret - } - - .method private hidebysig specialname - instance void set_PrivateProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::PrivateProperty@ - IL_0007: ret - } - - .method public hidebysig specialname - instance int32 get_DefaultProperty() 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 RealInternalSignature/TestType::DefaultProperty@ - IL_0006: ret - } - - .method public hidebysig specialname - instance void set_DefaultProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::DefaultProperty@ - IL_0007: ret - } -""" - else - """ - .method public hidebysig specialname - instance int32 get_PublicProperty() 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 RealInternalSignature/TestType::PublicProperty@ - IL_0006: ret - } - - .method public hidebysig specialname - instance void set_PublicProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::PublicProperty@ - IL_0007: ret - } - - .method assembly hidebysig specialname - instance int32 get_InternalProperty() 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 RealInternalSignature/TestType::InternalProperty@ - IL_0006: ret - } - - .method assembly hidebysig specialname - instance void set_InternalProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::InternalProperty@ - IL_0007: ret - } - - .method assembly hidebysig specialname - instance int32 get_PrivateProperty() 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 RealInternalSignature/TestType::PrivateProperty@ - IL_0006: ret - } - - .method assembly hidebysig specialname - instance void set_PrivateProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::PrivateProperty@ - IL_0007: ret - } - - .method public hidebysig specialname - instance int32 get_DefaultProperty() 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 RealInternalSignature/TestType::DefaultProperty@ - IL_0006: ret - } - - .method public hidebysig specialname - instance void set_DefaultProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::DefaultProperty@ - IL_0007: ret - } -""" - - ] |> shouldSucceed - [] // RealSig - [] // Regular + [] + [] + [] + [] [] - let ``private type - various properties`` (realSig) = - FSharp """ + let ``type visibility - various properties`` (realSig, typeVisibility: string) = + FSharp $""" module RealInternalSignature -type public TestType () = +type {typeVisibility} TestType () = member val public PublicProperty = 0 with get, set member val internal InternalProperty = 0 with get, set member val private PrivateProperty = 0 with get, set @@ -564,664 +69,18 @@ type public TestType () = |> asLibrary |> withRealInternalSignature realSig |> compile - |> verifyILContains [ - if realSig then - """ - .method public hidebysig specialname - instance int32 get_PublicProperty() 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 RealInternalSignature/TestType::PublicProperty@ - IL_0006: ret - } - - .method public hidebysig specialname - instance void set_PublicProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::PublicProperty@ - IL_0007: ret - } - - .method assembly hidebysig specialname - instance int32 get_InternalProperty() 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 RealInternalSignature/TestType::InternalProperty@ - IL_0006: ret - } - - .method assembly hidebysig specialname - instance void set_InternalProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::InternalProperty@ - IL_0007: ret - } - - .method private hidebysig specialname - instance int32 get_PrivateProperty() 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 RealInternalSignature/TestType::PrivateProperty@ - IL_0006: ret - } - - .method private hidebysig specialname - instance void set_PrivateProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::PrivateProperty@ - IL_0007: ret - } - - .method public hidebysig specialname - instance int32 get_DefaultProperty() 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 RealInternalSignature/TestType::DefaultProperty@ - IL_0006: ret - } - - .method public hidebysig specialname - instance void set_DefaultProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::DefaultProperty@ - IL_0007: ret - } -""" - else - """ - .method public hidebysig specialname - instance int32 get_PublicProperty() 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 RealInternalSignature/TestType::PublicProperty@ - IL_0006: ret - } - - .method public hidebysig specialname - instance void set_PublicProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::PublicProperty@ - IL_0007: ret - } - - .method assembly hidebysig specialname - instance int32 get_InternalProperty() 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 RealInternalSignature/TestType::InternalProperty@ - IL_0006: ret - } - - .method assembly hidebysig specialname - instance void set_InternalProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::InternalProperty@ - IL_0007: ret - } - - .method assembly hidebysig specialname - instance int32 get_PrivateProperty() 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 RealInternalSignature/TestType::PrivateProperty@ - IL_0006: ret - } - - .method assembly hidebysig specialname - instance void set_PrivateProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::PrivateProperty@ - IL_0007: ret - } - - .method public hidebysig specialname - instance int32 get_DefaultProperty() 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 RealInternalSignature/TestType::DefaultProperty@ - IL_0006: ret - } - - .method public hidebysig specialname - instance void set_DefaultProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::DefaultProperty@ - IL_0007: ret - } -""" - - ] - |> shouldSucceed - - [] // RealSig - [] // Regular - [] - let ``public type - various mixed properties`` (realSig) = - FSharp """ -module RealInternalSignature - -type public TestType () = - member _.MixedPropertyOne with public get() = 0 and internal set (_:int) = () - member _.MixedPropertyTwo with public get() = 0 and private set (_:int) = () - member _.MixedPropertyThree with private get() = 0 and public set (_:int) = () - member _.MixedPropertyFour with private get() = 0 and internal set (_:int) = () - member _.MixedPropertyFive with internal get() = 0 and public set (_:int) = () - member _.MixedPropertySix with internal get() = 0 and private set (_:int) = () - member _.MixedPropertySeven with get() = 0 and public set (_:int) = () - member _.MixedPropertyEight with get() = 0 and internal set (_:int) = () - member _.MixedPropertyNine with get() = 0 and private set (_:int) = () - member _.MixedPropertyTen with public get() = 0 and set (_:int) = () - member _.MixedPropertyEleven with internal get() = 0 and set (_:int) = () - member _.MixedPropertyTwelve with private get() = 0 and set (_:int) = () -""" - |> asLibrary - |> withRealInternalSignature realSig - |> compile - |> verifyILContains [ - if realSig then - """ - .method public hidebysig specialname - instance int32 get_MixedPropertyOne() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyOne(int32 _arg1) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig specialname - instance int32 get_MixedPropertyTwo() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method private hidebysig specialname - instance void set_MixedPropertyTwo(int32 _arg2) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method private hidebysig specialname - instance int32 get_MixedPropertyThree() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertyThree(int32 _arg3) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method private hidebysig specialname - instance int32 get_MixedPropertyFour() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyFour(int32 _arg4) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyFive() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertyFive(int32 _arg5) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertySix() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method private hidebysig specialname - instance void set_MixedPropertySix(int32 _arg6) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig specialname - instance int32 get_MixedPropertySeven() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertySeven(int32 _arg7) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig specialname - instance int32 get_MixedPropertyEight() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyEight(int32 _arg8) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig specialname - instance int32 get_MixedPropertyNine() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method private hidebysig specialname - instance void set_MixedPropertyNine(int32 _arg9) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig specialname - instance int32 get_MixedPropertyTen() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertyTen(int32 _arg10) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyEleven() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertyEleven(int32 _arg11) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method private hidebysig specialname - instance int32 get_MixedPropertyTwelve() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertyTwelve(int32 _arg12) cil managed - { - - .maxstack 8 - IL_0000: ret - } -""" - else - """ - .method public hidebysig specialname - instance int32 get_MixedPropertyOne() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyOne(int32 _arg1) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig specialname - instance int32 get_MixedPropertyTwo() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyTwo(int32 _arg2) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyThree() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertyThree(int32 _arg3) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyFour() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyFour(int32 _arg4) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyFive() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertyFive(int32 _arg5) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertySix() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertySix(int32 _arg6) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig specialname - instance int32 get_MixedPropertySeven() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertySeven(int32 _arg7) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig specialname - instance int32 get_MixedPropertyEight() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyEight(int32 _arg8) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig specialname - instance int32 get_MixedPropertyNine() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyNine(int32 _arg9) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig specialname - instance int32 get_MixedPropertyTen() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertyTen(int32 _arg10) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyEleven() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertyEleven(int32 _arg11) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyTwelve() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertyTwelve(int32 _arg12) cil managed - { - - .maxstack 8 - IL_0000: ret - } -""" - - ] |> shouldSucceed - [] // RealSig - [] // Regular + [] + [] + [] + [] [] - let ``private type - various mixed properties`` (realSig) = - FSharp """ + let ``type visibility - various mixed properties`` (realSig, typeVisibility: string) = + FSharp $""" module RealInternalSignature -type private TestType () = +type {typeVisibility} TestType () = member _.MixedPropertyOne with public get() = 0 and internal set (_:int) = () member _.MixedPropertyTwo with public get() = 0 and private set (_:int) = () member _.MixedPropertyThree with private get() = 0 and public set (_:int) = () @@ -1238,520 +97,18 @@ type private TestType () = |> asLibrary |> withRealInternalSignature realSig |> compile - |> verifyILContains [ - if realSig then - """ - .method assembly hidebysig specialname - instance int32 get_MixedPropertyOne() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyOne(int32 _arg1) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyTwo() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method private hidebysig specialname - instance void set_MixedPropertyTwo(int32 _arg2) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method private hidebysig specialname - instance int32 get_MixedPropertyThree() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyThree(int32 _arg3) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method private hidebysig specialname - instance int32 get_MixedPropertyFour() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyFour(int32 _arg4) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyFive() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyFive(int32 _arg5) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertySix() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method private hidebysig specialname - instance void set_MixedPropertySix(int32 _arg6) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertySeven() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertySeven(int32 _arg7) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyEight() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyEight(int32 _arg8) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyNine() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method private hidebysig specialname - instance void set_MixedPropertyNine(int32 _arg9) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyTen() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyTen(int32 _arg10) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyEleven() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyEleven(int32 _arg11) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method private hidebysig specialname - instance int32 get_MixedPropertyTwelve() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyTwelve(int32 _arg12) cil managed - { - - .maxstack 8 - IL_0000: ret - } -""" - else - """ - .method assembly hidebysig specialname - instance int32 get_MixedPropertyOne() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyOne(int32 _arg1) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyTwo() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyTwo(int32 _arg2) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyThree() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyThree(int32 _arg3) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyFour() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyFour(int32 _arg4) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyFive() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyFive(int32 _arg5) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertySix() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertySix(int32 _arg6) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertySeven() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertySeven(int32 _arg7) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyEight() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyEight(int32 _arg8) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyNine() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyNine(int32 _arg9) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyTen() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyTen(int32 _arg10) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyEleven() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyEleven(int32 _arg11) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyTwelve() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyTwelve(int32 _arg12) cil managed - { - - .maxstack 8 - IL_0000: ret - } -""" - - ] - |> shouldSucceed - - [] // RealSig - [] // Regular - [] - let ``public type - various static methods`` (realSig) = - FSharp """ -module RealInternalSignature - -type public TestType () = - static member public PublicMethod() = () - static member internal InternalMethod() = () - static member private PrivateMethod() = () - static member DefaultMethod() = () -""" - |> asLibrary - |> withRealInternalSignature realSig - |> compile - |> verifyILContains [ - if realSig then - """ - .method public hidebysig instance void - PublicMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig instance void - InternalMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method private hidebysig instance void - PrivateMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig instance void - DefaultMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } -""" - else - """ - .method public hidebysig instance void - PublicMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig instance void - InternalMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig instance void - PrivateMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig instance void - DefaultMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } -""" - - ] |> shouldSucceed - [] // RealSig - [] // Regular + [] + [] + [] + [] [] - let ``private type - various static methods`` (realSig) = - FSharp """ + let ``type visibility - various static methods`` (realSig, typeVisibility: string) = + FSharp $""" module RealInternalSignature -type public TestType () = +type {typeVisibility} TestType () = static member public PublicMethod() = () static member internal InternalMethod() = () static member private PrivateMethod() = () @@ -1760,423 +117,18 @@ type public TestType () = |> asLibrary |> withRealInternalSignature realSig |> compile - |> verifyILContains [ - if realSig then - """ - .method public hidebysig instance void - PublicMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig instance void - InternalMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method private hidebysig instance void - PrivateMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig instance void - DefaultMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } -""" - else - """ - .method public hidebysig instance void - PublicMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig instance void - InternalMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig instance void - PrivateMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig instance void - DefaultMethod() cil managed - { - - .maxstack 8 - IL_0000: ret - } -""" - - ] - |> shouldSucceed - - [] // RealSig - [] // Regular - [] - let ``public type - various static properties`` (realSig) = - FSharp """ -module RealInternalSignature - -type public TestType () = - static member val public PublicProperty = 0 with get, set - static member val internal InternalProperty = 0 with get, set - static member val private PrivateProperty = 0 with get, set - static member val DefaultProperty = 0 with get, set""" - |> asLibrary - |> withRealInternalSignature realSig - |> compile - |> verifyILContains [ - if realSig then - """ - .me thod public specialname static int32 - get_PublicProperty() 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: volatile. - IL_0002: ldsfld int32 RealInternalSignature/TestType::init@4 - IL_0007: ldc.i4.1 - IL_0008: bge.s IL_0011 - - IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() - IL_000f: br.s IL_0011 - - IL_0011: ldsfld int32 RealInternalSignature/TestType::PublicProperty@ - IL_0016: ret - } - - .method public specialname static void - set_PublicProperty(int32 v) 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: volatile. - IL_0002: ldsfld int32 RealInternalSignature/TestType::init@4 - IL_0007: ldc.i4.1 - IL_0008: bge.s IL_0011 - - IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() - IL_000f: br.s IL_0011 - - IL_0011: ldarg.0 - IL_0012: stsfld int32 RealInternalSignature/TestType::PublicProperty@ - IL_0017: ret - } - - .method assembly specialname static int32 - get_InternalProperty() 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: volatile. - IL_0002: ldsfld int32 RealInternalSignature/TestType::init@4 - IL_0007: ldc.i4.2 - IL_0008: bge.s IL_0011 - - IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() - IL_000f: br.s IL_0011 - - IL_0011: ldsfld int32 RealInternalSignature/TestType::InternalProperty@ - IL_0016: ret - } - - .method assembly specialname static void - set_InternalProperty(int32 v) 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: volatile. - IL_0002: ldsfld int32 RealInternalSignature/TestType::init@4 - IL_0007: ldc.i4.2 - IL_0008: bge.s IL_0011 - - IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() - IL_000f: br.s IL_0011 - - IL_0011: ldarg.0 - IL_0012: stsfld int32 RealInternalSignature/TestType::InternalProperty@ - IL_0017: ret - } - - .method private specialname static int32 - get_PrivateProperty() 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: volatile. - IL_0002: ldsfld int32 RealInternalSignature/TestType::init@4 - IL_0007: ldc.i4.3 - IL_0008: bge.s IL_0011 - - IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() - IL_000f: br.s IL_0011 - - IL_0011: ldsfld int32 RealInternalSignature/TestType::PrivateProperty@ - IL_0016: ret - } - - .method private specialname static void - set_PrivateProperty(int32 v) 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: volatile. - IL_0002: ldsfld int32 RealInternalSignature/TestType::init@4 - IL_0007: ldc.i4.3 - IL_0008: bge.s IL_0011 - - IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() - IL_000f: br.s IL_0011 - - IL_0011: ldarg.0 - IL_0012: stsfld int32 RealInternalSignature/TestType::PrivateProperty@ - IL_0017: ret - } - - .method public specialname static int32 - get_DefaultProperty() 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: volatile. - IL_0002: ldsfld int32 RealInternalSignature/TestType::init@4 - IL_0007: ldc.i4.4 - IL_0008: bge.s IL_0011 - - IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() - IL_000f: br.s IL_0011 - - IL_0011: ldsfld int32 RealInternalSignature/TestType::DefaultProperty@ - IL_0016: ret - } - - .method public specialname static void - set_DefaultProperty(int32 v) 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: volatile. - IL_0002: ldsfld int32 RealInternalSignature/TestType::init@4 - IL_0007: ldc.i4.4 - IL_0008: bge.s IL_0011 - - IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() - IL_000f: br.s IL_0011 - - IL_0011: ldarg.0 - IL_0012: stsfld int32 RealInternalSignature/TestType::DefaultProperty@ - IL_0017: ret - } -""" - else - """ - .method public specialname static int32 - get_PublicProperty() 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: volatile. - IL_0002: ldsfld int32 RealInternalSignature/TestType::init@4 - IL_0007: ldc.i4.1 - IL_0008: bge.s IL_0011 - - IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() - IL_000f: br.s IL_0011 - - IL_0011: ldsfld int32 RealInternalSignature/TestType::PublicProperty@ - IL_0016: ret - } - - .method public specialname static void - set_PublicProperty(int32 v) 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: volatile. - IL_0002: ldsfld int32 RealInternalSignature/TestType::init@4 - IL_0007: ldc.i4.1 - IL_0008: bge.s IL_0011 - - IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() - IL_000f: br.s IL_0011 - - IL_0011: ldarg.0 - IL_0012: stsfld int32 RealInternalSignature/TestType::PublicProperty@ - IL_0017: ret - } - - .method assembly specialname static int32 - get_InternalProperty() 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: volatile. - IL_0002: ldsfld int32 RealInternalSignature/TestType::init@4 - IL_0007: ldc.i4.2 - IL_0008: bge.s IL_0011 - - IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() - IL_000f: br.s IL_0011 - - IL_0011: ldsfld int32 RealInternalSignature/TestType::InternalProperty@ - IL_0016: ret - } - - .method assembly specialname static void - set_InternalProperty(int32 v) 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: volatile. - IL_0002: ldsfld int32 RealInternalSignature/TestType::init@4 - IL_0007: ldc.i4.2 - IL_0008: bge.s IL_0011 - - IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() - IL_000f: br.s IL_0011 - - IL_0011: ldarg.0 - IL_0012: stsfld int32 RealInternalSignature/TestType::InternalProperty@ - IL_0017: ret - } - - .method assembly specialname static int32 - get_PrivateProperty() 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: volatile. - IL_0002: ldsfld int32 RealInternalSignature/TestType::init@4 - IL_0007: ldc.i4.3 - IL_0008: bge.s IL_0011 - - IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() - IL_000f: br.s IL_0011 - - IL_0011: ldsfld int32 RealInternalSignature/TestType::PrivateProperty@ - IL_0016: ret - } - - .method assembly specialname static void - set_PrivateProperty(int32 v) 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: volatile. - IL_0002: ldsfld int32 RealInternalSignature/TestType::init@4 - IL_0007: ldc.i4.3 - IL_0008: bge.s IL_0011 - - IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() - IL_000f: br.s IL_0011 - - IL_0011: ldarg.0 - IL_0012: stsfld int32 RealInternalSignature/TestType::PrivateProperty@ - IL_0017: ret - } - - .method public specialname static int32 - get_DefaultProperty() 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: volatile. - IL_0002: ldsfld int32 RealInternalSignature/TestType::init@4 - IL_0007: ldc.i4.4 - IL_0008: bge.s IL_0011 - - IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() - IL_000f: br.s IL_0011 - - IL_0011: ldsfld int32 RealInternalSignature/TestType::DefaultProperty@ - IL_0016: ret - } - - .method public specialname static void - set_DefaultProperty(int32 v) 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: volatile. - IL_0002: ldsfld int32 RealInternalSignature/TestType::init@4 - IL_0007: ldc.i4.4 - IL_0008: bge.s IL_0011 - - IL_000a: call void [FSharp.Core]Microsoft.FSharp.Core.LanguagePrimitives/IntrinsicFunctions::FailStaticInit() - IL_000f: br.s IL_0011 - - IL_0011: ldarg.0 - IL_0012: stsfld int32 RealInternalSignature/TestType::DefaultProperty@ - IL_0017: ret - } -""" - - ] |> shouldSucceed - [] // RealSig - [] // Regular + [] + [] + [] + [] [] - let ``private type - various static properties`` (realSig) = - FSharp """ + let ``type visibility - various static properties`` (realSig, typeVisibility: string) = + FSharp $""" module RealInternalSignature -type private TestType () = +type {typeVisibility} TestType () = static member val public PublicProperty = 0 with get, set static member val internal InternalProperty = 0 with get, set static member val private PrivateProperty = 0 with get, set @@ -2184,664 +136,18 @@ type private TestType () = |> asLibrary |> withRealInternalSignature realSig |> compile - |> verifyILContains [ - if realSig then - """ - .method public hidebysig specialname - instance int32 get_PublicProperty() 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 RealInternalSignature/TestType::PublicProperty@ - IL_0006: ret - } - - .method public hidebysig specialname - instance void set_PublicProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::PublicProperty@ - IL_0007: ret - } - - .method assembly hidebysig specialname - instance int32 get_InternalProperty() 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 RealInternalSignature/TestType::InternalProperty@ - IL_0006: ret - } - - .method assembly hidebysig specialname - instance void set_InternalProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::InternalProperty@ - IL_0007: ret - } - - .method private hidebysig specialname - instance int32 get_PrivateProperty() 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 RealInternalSignature/TestType::PrivateProperty@ - IL_0006: ret - } - - .method private hidebysig specialname - instance void set_PrivateProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::PrivateProperty@ - IL_0007: ret - } - - .method public hidebysig specialname - instance int32 get_DefaultProperty() 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 RealInternalSignature/TestType::DefaultProperty@ - IL_0006: ret - } - - .method public hidebysig specialname - instance void set_DefaultProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::DefaultProperty@ - IL_0007: ret - } -""" - else - """ - .method public hidebysig specialname - instance int32 get_PublicProperty() 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 RealInternalSignature/TestType::PublicProperty@ - IL_0006: ret - } - - .method public hidebysig specialname - instance void set_PublicProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::PublicProperty@ - IL_0007: ret - } - - .method assembly hidebysig specialname - instance int32 get_InternalProperty() 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 RealInternalSignature/TestType::InternalProperty@ - IL_0006: ret - } - - .method assembly hidebysig specialname - instance void set_InternalProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::InternalProperty@ - IL_0007: ret - } - - .method assembly hidebysig specialname - instance int32 get_PrivateProperty() 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 RealInternalSignature/TestType::PrivateProperty@ - IL_0006: ret - } - - .method assembly hidebysig specialname - instance void set_PrivateProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::PrivateProperty@ - IL_0007: ret - } - - .method public hidebysig specialname - instance int32 get_DefaultProperty() 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 RealInternalSignature/TestType::DefaultProperty@ - IL_0006: ret - } - - .method public hidebysig specialname - instance void set_DefaultProperty(int32 v) 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: ldarg.1 - IL_0002: stfld int32 RealInternalSignature/TestType::DefaultProperty@ - IL_0007: ret - } -""" - - ] - |> shouldSucceed - - [] // RealSig - [] // Regular - [] - let ``public type - various static mixed properties`` (realSig) = - FSharp """ -module RealInternalSignature - -type public TestType () = - static member MixedPropertyOne with public get() = 0 and internal set (_:int) = () - static member MixedPropertyTwo with public get() = 0 and private set (_:int) = () - static member MixedPropertyThree with private get() = 0 and public set (_:int) = () - static member MixedPropertyFour with private get() = 0 and internal set (_:int) = () - static member MixedPropertyFive with internal get() = 0 and public set (_:int) = () - static member MixedPropertySix with internal get() = 0 and private set (_:int) = () - static member MixedPropertySeven with get() = 0 and public set (_:int) = () - static member MixedPropertyEight with get() = 0 and internal set (_:int) = () - static member MixedPropertyNine with get() = 0 and private set (_:int) = () - static member MixedPropertyTen with public get() = 0 and set (_:int) = () - static member MixedPropertyEleven with internal get() = 0 and set (_:int) = () - static member MixedPropertyTwelve with private get() = 0 and set (_:int) = () -""" - |> asLibrary - |> withRealInternalSignature realSig - |> compile - |> verifyILContains [ - if realSig then - """ - .method public hidebysig specialname - instance int32 get_MixedPropertyOne() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyOne(int32 _arg1) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig specialname - instance int32 get_MixedPropertyTwo() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method private hidebysig specialname - instance void set_MixedPropertyTwo(int32 _arg2) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method private hidebysig specialname - instance int32 get_MixedPropertyThree() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertyThree(int32 _arg3) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method private hidebysig specialname - instance int32 get_MixedPropertyFour() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyFour(int32 _arg4) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyFive() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertyFive(int32 _arg5) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertySix() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method private hidebysig specialname - instance void set_MixedPropertySix(int32 _arg6) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig specialname - instance int32 get_MixedPropertySeven() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertySeven(int32 _arg7) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig specialname - instance int32 get_MixedPropertyEight() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyEight(int32 _arg8) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig specialname - instance int32 get_MixedPropertyNine() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method private hidebysig specialname - instance void set_MixedPropertyNine(int32 _arg9) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig specialname - instance int32 get_MixedPropertyTen() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertyTen(int32 _arg10) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyEleven() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertyEleven(int32 _arg11) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method private hidebysig specialname - instance int32 get_MixedPropertyTwelve() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertyTwelve(int32 _arg12) cil managed - { - - .maxstack 8 - IL_0000: ret - } -""" - else - """ - .method public hidebysig specialname - instance int32 get_MixedPropertyOne() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyOne(int32 _arg1) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig specialname - instance int32 get_MixedPropertyTwo() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyTwo(int32 _arg2) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyThree() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertyThree(int32 _arg3) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyFour() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyFour(int32 _arg4) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyFive() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertyFive(int32 _arg5) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertySix() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertySix(int32 _arg6) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig specialname - instance int32 get_MixedPropertySeven() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertySeven(int32 _arg7) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig specialname - instance int32 get_MixedPropertyEight() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyEight(int32 _arg8) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig specialname - instance int32 get_MixedPropertyNine() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyNine(int32 _arg9) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method public hidebysig specialname - instance int32 get_MixedPropertyTen() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertyTen(int32 _arg10) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyEleven() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertyEleven(int32 _arg11) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyTwelve() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method public hidebysig specialname - instance void set_MixedPropertyTwelve(int32 _arg12) cil managed - { - - .maxstack 8 - IL_0000: ret - } -""" - - ] |> shouldSucceed - [] // RealSig - [] // Regular + [] + [] + [] + [] [] - let ``private type - various static mixed properties`` (realSig) = - FSharp """ + let ``type visibility - various static mixed properties`` (realSig, typeVisibility: string) = + FSharp $""" module RealInternalSignature -type private TestType () = +type {typeVisibility} TestType () = static member MixedPropertyOne with public get() = 0 and internal set (_:int) = () static member MixedPropertyTwo with public get() = 0 and private set (_:int) = () static member MixedPropertyThree with private get() = 0 and public set (_:int) = () @@ -2858,420 +164,4 @@ type private TestType () = |> asLibrary |> withRealInternalSignature realSig |> compile - |> verifyILContains [ - if realSig then - """ - .method assembly hidebysig specialname - instance int32 get_MixedPropertyOne() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyOne(int32 _arg1) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyTwo() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method private hidebysig specialname - instance void set_MixedPropertyTwo(int32 _arg2) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method private hidebysig specialname - instance int32 get_MixedPropertyThree() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyThree(int32 _arg3) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method private hidebysig specialname - instance int32 get_MixedPropertyFour() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyFour(int32 _arg4) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyFive() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyFive(int32 _arg5) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertySix() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method private hidebysig specialname - instance void set_MixedPropertySix(int32 _arg6) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertySeven() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertySeven(int32 _arg7) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyEight() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyEight(int32 _arg8) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyNine() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method private hidebysig specialname - instance void set_MixedPropertyNine(int32 _arg9) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyTen() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyTen(int32 _arg10) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyEleven() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyEleven(int32 _arg11) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method private hidebysig specialname - instance int32 get_MixedPropertyTwelve() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyTwelve(int32 _arg12) cil managed - { - - .maxstack 8 - IL_0000: ret - } -""" - else - """ - .method assembly hidebysig specialname - instance int32 get_MixedPropertyOne() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyOne(int32 _arg1) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyTwo() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyTwo(int32 _arg2) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyThree() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyThree(int32 _arg3) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyFour() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyFour(int32 _arg4) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyFive() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyFive(int32 _arg5) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertySix() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertySix(int32 _arg6) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertySeven() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertySeven(int32 _arg7) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyEight() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyEight(int32 _arg8) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyNine() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyNine(int32 _arg9) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyTen() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyTen(int32 _arg10) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyEleven() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyEleven(int32 _arg11) cil managed - { - - .maxstack 8 - IL_0000: ret - } - - .method assembly hidebysig specialname - instance int32 get_MixedPropertyTwelve() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: ret - } - - .method assembly hidebysig specialname - instance void set_MixedPropertyTwelve(int32 _arg12) cil managed - { - - .maxstack 8 - IL_0000: ret - } -""" - - ] |> shouldSucceed - diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/RealInternalSignature.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/RealInternalSignature.fs index 436072744e6..231fc32689e 100644 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/RealInternalSignature.fs +++ b/tests/FSharp.Compiler.ComponentTests/EmittedIL/RealInternalSignature/RealInternalSignature.fs @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -namespace EmittedIL +namespace EmittedIL.RealInternalSignature open Xunit open FSharp.Test open FSharp.Test.Compiler -module RealInternalSignature = +module RealInternalSignatureTests = let withRealInternalSignature realSig compilation = compilation @@ -720,277 +720,6 @@ module doit = |> withRealInternalSignature realSig |> compileExeAndRun |> shouldSucceed - |> verifyIL [ - if realSig = false then - // Initialization - """ -.class private abstract auto ansi sealed ''.$Test - extends [runtime]System.Object -{ - .field static assembly class FSharp.Compiler.CodeAnalysis.FSharpSource arg@1 - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .field static assembly int32 init@ - .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 static void main@() cil managed - { - .entrypoint - - .maxstack 8 - IL_0000: ldstr "Hello" - IL_0005: newobj instance void FSharp.Compiler.CodeAnalysis.FSharpSourceFromFile::.ctor(string) - IL_000a: stsfld class FSharp.Compiler.CodeAnalysis.FSharpSource ''.$Test::arg@1 - IL_000f: ldstr "Main program" - IL_0014: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string) - IL_0019: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_001e: pop - IL_001f: ret - }""" - - // FSharpSource visibility - """.class public abstract auto ansi serializable FSharp.Compiler.CodeAnalysis.FSharpSource - extends [runtime]System.Object -{ - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.AbstractClassAttribute::.ctor() = ( 01 00 00 00 ) - .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 ) - .method public hidebysig specialname abstract virtual - instance string get_FilePath() cil managed - { - } - - .method public specialname rtspecialname - instance void .ctor() cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: callvirt instance void [runtime]System.Object::.ctor() - IL_0006: ldarg.0 - IL_0007: pop - IL_0008: ret - } - - .method public static class FSharp.Compiler.CodeAnalysis.FSharpSource - CreateFromFile(string filePath) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: newobj instance void FSharp.Compiler.CodeAnalysis.FSharpSourceFromFile::.ctor(string) - IL_0006: ret - } - - .property instance string FilePath() - { - .get instance string FSharp.Compiler.CodeAnalysis.FSharpSource::get_FilePath() - } -}""" - - /// FSharpSourceFromFile - """.class private auto ansi serializable FSharp.Compiler.CodeAnalysis.FSharpSourceFromFile - extends FSharp.Compiler.CodeAnalysis.FSharpSource -{ - .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 filePath - .method public specialname rtspecialname - instance void .ctor(string filePath) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: callvirt instance void FSharp.Compiler.CodeAnalysis.FSharpSource::.ctor() - IL_0006: ldarg.0 - IL_0007: pop - IL_0008: ldarg.0 - IL_0009: ldarg.1 - IL_000a: stfld string FSharp.Compiler.CodeAnalysis.FSharpSourceFromFile::filePath - IL_000f: ret - } - - .method public hidebysig specialname virtual - instance string get_FilePath() cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld string FSharp.Compiler.CodeAnalysis.FSharpSourceFromFile::filePath - IL_0006: ret - } - - .property instance string FilePath() - { - .get instance string FSharp.Compiler.CodeAnalysis.FSharpSourceFromFile::get_FilePath() - } -}""" - //doit - """.class public abstract auto ansi sealed FSharp.Compiler.CodeAnalysis.doit - 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 ) - .method assembly specialname static class FSharp.Compiler.CodeAnalysis.FSharpSource - get_arg@1() cil managed - { - - .maxstack 8 - IL_0000: ldsfld class FSharp.Compiler.CodeAnalysis.FSharpSource ''.$Test::arg@1 - IL_0005: ret - } - - .property class FSharp.Compiler.CodeAnalysis.FSharpSource - arg@1() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) - .get class FSharp.Compiler.CodeAnalysis.FSharpSource FSharp.Compiler.CodeAnalysis.doit::get_arg@1() - } -}""" - else - // Initialization - """.class private abstract auto ansi sealed ''.$Test - extends [runtime]System.Object -{ - .field static assembly int32 init@ - .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 static void main@() cil managed - { - .entrypoint - - .maxstack 8 - IL_0000: call void FSharp.Compiler.CodeAnalysis.doit::staticInitialization@() - IL_0005: ret - }""" - - // FSharpSource visibility - """.class public abstract auto ansi serializable FSharp.Compiler.CodeAnalysis.FSharpSource - extends [runtime]System.Object -{ - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.AbstractClassAttribute::.ctor() = ( 01 00 00 00 ) - .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 ) - .method public hidebysig specialname abstract virtual - instance string get_FilePath() cil managed - { - } - - .method public specialname rtspecialname - instance void .ctor() cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: callvirt instance void [runtime]System.Object::.ctor() - IL_0006: ldarg.0 - IL_0007: pop - IL_0008: ret - } - - .method public static class FSharp.Compiler.CodeAnalysis.FSharpSource - CreateFromFile(string filePath) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: newobj instance void FSharp.Compiler.CodeAnalysis.FSharpSourceFromFile::.ctor(string) - IL_0006: ret - } - - .property instance string FilePath() - { - .get instance string FSharp.Compiler.CodeAnalysis.FSharpSource::get_FilePath() - } -}""" - - // FSharpSourceFromFile - """.class private auto ansi serializable FSharp.Compiler.CodeAnalysis.FSharpSourceFromFile - extends FSharp.Compiler.CodeAnalysis.FSharpSource -{ - .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 filePath - .method assembly specialname rtspecialname - instance void .ctor(string filePath) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: callvirt instance void FSharp.Compiler.CodeAnalysis.FSharpSource::.ctor() - IL_0006: ldarg.0 - IL_0007: pop - IL_0008: ldarg.0 - IL_0009: ldarg.1 - IL_000a: stfld string FSharp.Compiler.CodeAnalysis.FSharpSourceFromFile::filePath - IL_000f: ret - } - - .method public hidebysig specialname virtual - instance string get_FilePath() cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld string FSharp.Compiler.CodeAnalysis.FSharpSourceFromFile::filePath - IL_0006: ret - } - - .property instance string FilePath() - { - .get instance string FSharp.Compiler.CodeAnalysis.FSharpSourceFromFile::get_FilePath() - } -}""" - - // doit - """.class public abstract auto ansi sealed FSharp.Compiler.CodeAnalysis.doit - 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 ) - .field static assembly class FSharp.Compiler.CodeAnalysis.FSharpSource arg@1 - .custom instance void [runtime]System.Diagnostics.DebuggerBrowsableAttribute::.ctor(valuetype [runtime]System.Diagnostics.DebuggerBrowsableState) = ( 01 00 00 00 00 00 00 00 ) - .method assembly specialname static class FSharp.Compiler.CodeAnalysis.FSharpSource - get_arg@1() cil managed - { - - .maxstack 8 - IL_0000: ldsfld class FSharp.Compiler.CodeAnalysis.FSharpSource FSharp.Compiler.CodeAnalysis.doit::arg@1 - IL_0005: ret - } - - .method private specialname rtspecialname static - void .cctor() cil managed - { - - .maxstack 8 - IL_0000: ldc.i4.0 - IL_0001: stsfld int32 ''.$Test::init@ - IL_0006: ldsfld int32 ''.$Test::init@ - IL_000b: pop - IL_000c: ret - } - - .method assembly static void staticInitialization@() cil managed - { - - .maxstack 8 - IL_0000: ldstr "Hello" - IL_0005: newobj instance void FSharp.Compiler.CodeAnalysis.FSharpSourceFromFile::.ctor(string) - IL_000a: stsfld class FSharp.Compiler.CodeAnalysis.FSharpSource FSharp.Compiler.CodeAnalysis.doit::arg@1 - IL_000f: ldstr "Main program" - IL_0014: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string) - IL_0019: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_001e: pop - IL_001f: ret - } - - .property class FSharp.Compiler.CodeAnalysis.FSharpSource - arg@1() - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationMappingAttribute::.ctor(valuetype [FSharp.Core]Microsoft.FSharp.Core.SourceConstructFlags) = ( 01 00 09 00 00 00 00 00 ) - .get class FSharp.Compiler.CodeAnalysis.FSharpSource FSharp.Compiler.CodeAnalysis.doit::get_arg@1() - } -}""" - ] - //|> withStdOutContainsAllInOrder [ - // "Main program" - //] [] // RealSig @@ -1134,7 +863,7 @@ type public FSharpSourceFromFile private (filePath: string) = override _.FilePath = filePath - static public MakeOne() = + static member public MakeOne() = my { let! file = new FSharpSourceFromFile ("Hello, World") return file @@ -1254,8 +983,6 @@ module M = 0 """ |> withRealInternalSignature true - |> asLibrary - |> compile |> compileExeAndRun |> shouldSucceed |> withStdOutContainsAllInOrder [ @@ -1281,7 +1008,5 @@ module M = 0 """ |> withRealInternalSignature false - |> asLibrary - |> compile |> compileExeAndRun |> shouldFail \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/StructFieldEquality.fs b/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/StructFieldEquality.fs deleted file mode 100644 index 1b51ba93f5b..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/EmittedIL/Structure/StructFieldEquality.fs +++ /dev/null @@ -1,15 +0,0 @@ -namespace EmittedIL - -open Xunit -open FSharp.Test -open FSharp.Test.Compiler - -module Operators = - - [] - let ``Validate that non generic (fast) code is emitted for comparison involving decimals`` compilation = - compilation - |> getCompilation - |> asExe - |> ignoreWarnings - |> verifyILBaseline \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/DuplicateExtensionMemberTests.fs b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/DuplicateExtensionMemberTests.fs index c0021c55ebc..02988809a6d 100644 --- a/tests/FSharp.Compiler.ComponentTests/ErrorMessages/DuplicateExtensionMemberTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/ErrorMessages/DuplicateExtensionMemberTests.fs @@ -9,9 +9,6 @@ module ``Duplicate Extension Members`` = [] let ``Same type name from different namespaces should error for static members``() = - // Static extension members on types with same simple name but different namespaces - // produce duplicate IL method signatures because the extended type's namespace is not - // encoded in the IL method name/signature for static extensions. FSharp """ namespace NS1 @@ -36,8 +33,6 @@ module Extensions = [] let ``Same type name from different namespaces should be allowed for instance members``() = - // Instance extension members are safe because the extended type becomes the first - // parameter in IL, differentiating the signatures. FSharp """ namespace NS1 @@ -82,7 +77,6 @@ module Extensions = [] let ``Same generic type name from different namespaces should error for static members``() = - // Same IL collision issue as non-generic, but with generic types. FSharp """ namespace NS1 diff --git a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj index d0193e9e608..68717660c48 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj +++ b/tests/FSharp.Compiler.ComponentTests/FSharp.Compiler.ComponentTests.fsproj @@ -91,8 +91,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -102,9 +133,19 @@ + + + + + + + + + + @@ -141,6 +182,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -153,7 +233,9 @@ + + @@ -180,6 +262,7 @@ + @@ -190,6 +273,7 @@ + @@ -285,6 +369,7 @@ + @@ -316,6 +401,7 @@ + @@ -323,6 +409,25 @@ + + + + + + + + + + + + + + + + + + + @@ -333,6 +438,8 @@ + + @@ -343,6 +450,8 @@ + + diff --git a/tests/FSharp.Compiler.ComponentTests/Import/ImportTests.fs b/tests/FSharp.Compiler.ComponentTests/Import/ImportTests.fs index 1ddccfd9dd5..f19fcfeac14 100644 --- a/tests/FSharp.Compiler.ComponentTests/Import/ImportTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Import/ImportTests.fs @@ -937,11 +937,6 @@ let v = new y() |> shouldSucceed |> ignore - // Regression test: B-stream misalignment when pickling metadata with langFeatureNullness=false - // When a library is compiled with LangVersion 8.0 (no nullness), the type nullness B-stream bytes - // must still be written to keep the stream aligned with unconditional reads and constraint data. - // Without the fix, the reader hits NotSupportsNull constraint bytes (0x01) when expecting type - // nullness values, causing FS0229 "u_ty - 4/B". [] let ``Referencing library compiled with LangVersion 8 should not produce FS0229 B-stream error`` () = let fsLib = diff --git a/tests/FSharp.Compiler.ComponentTests/InteractiveSession/Misc.fs b/tests/FSharp.Compiler.ComponentTests/InteractiveSession/Misc.fs index 2a16aee8735..97d0dcd865b 100644 --- a/tests/FSharp.Compiler.ComponentTests/InteractiveSession/Misc.fs +++ b/tests/FSharp.Compiler.ComponentTests/InteractiveSession/Misc.fs @@ -2122,6 +2122,7 @@ exit 0 |> Seq.append (Directory.EnumerateFiles(errorTestCasesDir, "E_*.fs")) |> Seq.toArray |> Array.map Path.GetFileName + |> Array.filter (fun f -> f <> "E_EmptyFilename.fsx") // FSI-only test, uses #q;; which doesn't fail under compilation |> Array.map (fun f -> [|f :> obj|]) else [||] @@ -2137,54 +2138,6 @@ exit 0 |> shouldFail |> ignore - // ================================================================================ - // CommandLineArgs tests - verify fsi.CommandLineArgs array population - // These MUST use subprocess via withFsiArgs because fsi.CommandLineArgs - // is only populated when running FSI as a subprocess, not in-process - // ================================================================================ - - // Regression test for FSHARP1.0:2439 - fsi.CommandLineArgs with no extra args - [] - let ``CommandLineArgs01 - no arguments`` () = - Fsx """ -(if ((Seq.length fsi.CommandLineArgs) <> 1) then 1 else 0) |> exit -""" - |> withOptions ["--nologo"] - |> withFsiArgs [] // No extra args - just script name - |> runFsi - |> shouldSucceed - |> ignore - - // Regression test for FSHARP1.0:2439 - fsi.CommandLineArgs with just "--" - [] - let ``CommandLineArgs01b - double dash only`` () = - Fsx """ -// With just "--", fsi.CommandLineArgs should still be length 1 (just script name) -if Seq.length fsi.CommandLineArgs <> 1 then exit 1 -exit 0 -""" - |> withOptions ["--nologo"; "--"] - |> withFsiArgs [] // No args after -- - |> runFsi - |> shouldSucceed - |> ignore - - // Regression test for FSHARP1.0:2439 - fsi.CommandLineArgs with actual argument - [] - let ``CommandLineArgs02 - one argument Hello`` () = - Fsx """ -let x = Seq.length fsi.CommandLineArgs -let y = fsi.CommandLineArgs.[1] -printfn "%A %A" x y -if (x <> 2) || (y <> "Hello") then exit 1 -exit 0 -""" - |> withOptions ["--nologo"] - |> withFsiArgs ["Hello"] // One arg: "Hello" - |> runFsi - |> shouldSucceed - |> ignore - // ================================================================================ // FSI Behavior Tests - In-Process (Type Checking, Compilation) // These tests verify F# language features work correctly in FSI context diff --git a/tests/FSharp.Compiler.ComponentTests/Language/ExtensionMethodTests.fs b/tests/FSharp.Compiler.ComponentTests/Language/ExtensionMethodTests.fs index 3eb711097c2..771b4d17bb2 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/ExtensionMethodTests.fs +++ b/tests/FSharp.Compiler.ComponentTests/Language/ExtensionMethodTests.fs @@ -698,8 +698,6 @@ module CompiledExtensions = [] let ``Instance extension members for types with same simple name should succeed`` () = - // Instance extension members compile with the extended type as the first IL parameter, - // so they can never produce duplicate IL signatures even with same simple type name. Fsx """ module Compiled @@ -808,10 +806,6 @@ module CompiledExtensions = [] let ``Instance inline extension members on builder types with same simple name should succeed`` () = - // Regression test for IcedTasks-like pattern: instance (inline) extension members on - // computation expression builder types with the same simple name from different namespaces. - // Instance extension members compile with the extended type as the first IL parameter, - // so signatures never collide even when the simple type name is the same. Fsx """ namespace NsA diff --git a/tests/FSharp.Compiler.ComponentTests/Literals.fs b/tests/FSharp.Compiler.ComponentTests/Literals.fs deleted file mode 100644 index bc0b8faeb98..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/Literals.fs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace EmittedIL - -open Xunit -open FSharp.Test.Compiler - -module ``Literals`` = - - [] - let ``Literal attribute generates literal static field``() = - FSharp """ -module LiteralValue - -[] -let x = 7 - -[] -let main _ = - 0 - """ - |> compile - |> shouldSucceed - |> verifyIL [""" -.field public static literal int32 x = int32(0x00000007) -.custom instance void [FSharp.Core]Microsoft.FSharp.Core.LiteralAttribute::.ctor() = ( 01 00 00 00 )"""] diff --git a/tests/FSharp.Compiler.ComponentTests/Misc.fs b/tests/FSharp.Compiler.ComponentTests/Misc.fs index 61c58679ff7..a70fb09d0bf 100644 --- a/tests/FSharp.Compiler.ComponentTests/Misc.fs +++ b/tests/FSharp.Compiler.ComponentTests/Misc.fs @@ -31,7 +31,7 @@ IL_0005: ret""" IL_0000: call !!0[] [runtime]System.Array::Empty() IL_0005: ret""" ] - [] + [] let ``Discriminated union with generic statics generates single cctor calling renamed methods``() = FSharp """ module DuplicateCctorFix diff --git a/tests/FSharp.Compiler.ComponentTests/OnOverridesAndIFaceImpl.fs b/tests/FSharp.Compiler.ComponentTests/OnOverridesAndIFaceImpl.fs deleted file mode 100644 index c5d41598aa1..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/OnOverridesAndIFaceImpl.fs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace Conformance.DeclarationElements.AccessibilityAnnotations - -open Xunit -open FSharp.Test -open FSharp.Test.Compiler - -module Basic = - - let verifyCompile compilation = - compilation - |> asExe - |> withOptions ["--nowarn:988"] - |> compile - - let verifyCompileAndRun compilation = - compilation - |> asExe - |> withOptions ["--nowarn:988"] - |> compileAndRun - - // SOURCE=E_InterfaceImpl01.fs SCFLAGS="--test:ErrorRanges" # E_InterfaceImpl01.fs - [] - let ``E_InterfaceImpl01.fs`` compilation = - compilation - |> verifyCompile - |> shouldFail - |> withDiagnostics [ - (Error 410, Line 5, Col 19, Line 5, Col 20, "The type 'A' is less accessible than the value, member or type 'x' it is used in.") - ] - - // SOURCE=E_OnOverrides01.fs SCFLAGS="--test:ErrorRanges" # E_OnOverrides01.fs - [] - let ``E_OnOverrides01.fs`` compilation = - compilation - |> verifyCompile - |> shouldFail - |> withDiagnostics [ - (Error 410, Line 5, Col 19, Line 5, Col 20, "The type 'A' is less accessible than the value, member or type 'x' it is used in.") - ] - - // SOURCE=E_OnOverrides02.fs SCFLAGS="--test:ErrorRanges" # E_OnOverrides02.fs - [] - let ``E_OnOverrides02.fs`` compilation = - compilation - |> verifyCompile - |> shouldFail - |> withDiagnostics [ - (Error 410, Line 5, Col 19, Line 5, Col 20, "The type 'A' is less accessible than the value, member or type 'x' it is used in.") - ] - - // SOURCE=E_OnOverrides03.fs SCFLAGS="--test:ErrorRanges" # E_OnOverrides03.fs - [] - let ``E_OnOverrides03.fs`` compilation = - compilation - |> verifyCompile - |> shouldFail - |> withDiagnostics [ - (Error 410, Line 5, Col 19, Line 5, Col 20, "The type 'A' is less accessible than the value, member or type 'x' it is used in.") - ] - - // SOURCE=E_OnOverrides04.fs SCFLAGS="--test:ErrorRanges" # E_OnOverrides04.fs - [] - let ``E_OnOverrides04.fs`` compilation = - compilation - |> verifyCompile - |> shouldFail - |> withDiagnostics [ - (Error 410, Line 5, Col 19, Line 5, Col 20, "The type 'A' is less accessible than the value, member or type 'x' it is used in.") - ] - - // SOURCE=E_OnOverrides05.fs SCFLAGS="--test:ErrorRanges" # E_OnOverrides05.fs - [] - let ``E_OnOverrides05.fs`` compilation = - compilation - |> verifyCompile - |> shouldFail - |> withDiagnostics [ - (Error 410, Line 5, Col 19, Line 5, Col 20, "The type 'A' is less accessible than the value, member or type 'x' it is used in.") - ] diff --git a/tests/FSharp.Compiler.ComponentTests/Operators.fs b/tests/FSharp.Compiler.ComponentTests/Operators.fs deleted file mode 100644 index 0eee1ec6adb..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/Operators.fs +++ /dev/null @@ -1,14 +0,0 @@ -namespace EmittedIL - -open Xunit -open FSharp.Test -open FSharp.Test.Compiler - -module Operators = - - [] - let ``Validate that non generic (fast) code is emitted for comparison involving decimals`` compilation = - compilation - |> ignoreWarnings - |> verifyBaseline - |> verifyILBaseline \ No newline at end of file diff --git a/tests/FSharp.Compiler.ComponentTests/StringFormatAndInterpolation.fs b/tests/FSharp.Compiler.ComponentTests/StringFormatAndInterpolation.fs deleted file mode 100644 index 0ef7d23422e..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/StringFormatAndInterpolation.fs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace EmittedIL - -open Xunit -open FSharp.Test.Compiler - -#if !DEBUG // sensitive to debug-level code coming across from debug FSharp.Core -module ``StringFormatAndInterpolation`` = - [] - let ``Interpolated string with no holes is reduced to a string or simple format when used in printf``() = - FSharp """ -module StringFormatAndInterpolation - -let stringOnly () = $"no hole" - -let printed () = printf $"printed no hole" - """ - |> compile - |> shouldSucceed - |> verifyIL [""" -IL_0000: ldstr "no hole" -IL_0005: ret""" - """ -IL_0000: ldstr "printed no hole" -IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string) -IL_000a: stloc.0 -IL_000b: call class [netstandard]System.IO.TextWriter [netstandard]System.Console::get_Out() -IL_0010: ldloc.0 -IL_0011: call !!0 [FSharp.Core]Microsoft.FSharp.Core.PrintfModule::PrintFormatToTextWriter(class [runtime]System.IO.TextWriter, - class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) -IL_0016: pop -IL_0017: ret"""] - -#endif - diff --git a/tests/FSharp.Compiler.ComponentTests/TailCalls.fs b/tests/FSharp.Compiler.ComponentTests/TailCalls.fs deleted file mode 100644 index 034ab15f37a..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/TailCalls.fs +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace EmittedIL - -open Xunit -open FSharp.Test.Compiler - -module ``Tail Calls`` = - // Regression test for DevDiv:72571 - - let private compileWithTailCalls opts = - opts |> ignoreWarnings |> withOptions ["-g"; "--optimize-"; "--tailcalls+"] |> compile - - [] - let ``TailCall 01``() = - FSharp """ -module TailCall01 -let foo(x:int, y) = printfn "%d" x -let run() = let x = 0 in foo(x,5) - """ - |> compileWithTailCalls - |> shouldSucceed - |> verifyIL [ - """ - .method public static void foo(int32 x, - !!a y) cil managed - { - - .maxstack 8 - IL_0000: ldstr "%d" - IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string) - IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine>(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: pop - IL_0016: ret - } - """ - """ - .method public static void run() cil managed - { - - .maxstack 4 - .locals init (int32 V_0) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: ldloc.0 - IL_0003: ldc.i4.5 - IL_0004: tail. - IL_0006: call void TailCall01::foo(int32, - !!0) - IL_000b: ret - } - """] - - - [] - let ``TailCall 02``() = - FSharp """ -module TailCall02 -let foo(x:int byref) = x -let run() = let mutable x = 0 in foo(&x) - """ - |> compileWithTailCalls - |> shouldSucceed - |> verifyIL [ - """ - .method public static int32 foo(int32& x) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldobj [runtime]System.Int32 - IL_0006: ret - } - """ - """ - .method public static int32 run() cil managed - { - - .maxstack 3 - .locals init (int32 V_0) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: ldloca.s V_0 - IL_0004: call int32 TailCall02::foo(int32&) - IL_0009: ret - } - """ - ] - - [] - let ``TailCall 03``() = - FSharp """ -module TailCall03 -let foo (x:int byref) (y:int byref) z = printfn "%d" (x+y) -let run() = let mutable x = 0 in foo &x &x 5 - """ - |> compileWithTailCalls - |> shouldSucceed - |> verifyIL [ - """ - .method public static void foo(int32& x, - int32& y, - !!a z) cil managed - { - .custom instance void [FSharp.Core]Microsoft.FSharp.Core.CompilationArgumentCountsAttribute::.ctor(int32[]) = ( 01 00 03 00 00 00 01 00 00 00 01 00 00 00 01 00 - 00 00 00 00 ) - - .maxstack 8 - IL_0000: ldstr "%d" - IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string) - IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_000f: ldarg.0 - IL_0010: ldobj [runtime]System.Int32 - IL_0015: ldarg.1 - IL_0016: ldobj [runtime]System.Int32 - IL_001b: add - IL_001c: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0021: pop - IL_0022: ret - } - """ - """ - .method public static void run() cil managed - { - - .maxstack 5 - .locals init (int32 V_0) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: ldloca.s V_0 - IL_0004: ldloca.s V_0 - IL_0006: ldc.i4.5 - IL_0007: call void TailCall03::foo(int32&, - int32&, - !!0) - IL_000c: nop - IL_000d: ret - } - """ - ] - - [] - let ``TailCall 04``() = - FSharp """ -module TailCall04 -let foo(x:int byref, y) = printfn "%d" x -let run() = let mutable x = 0 in foo(&x,5) - """ - |> compileWithTailCalls - |> shouldSucceed - |> verifyIL [ - """ - .method public static void foo(int32& x, - !!a y) cil managed - { - - .maxstack 8 - IL_0000: ldstr "%d" - IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string) - IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_000f: ldarg.0 - IL_0010: ldobj [runtime]System.Int32 - IL_0015: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_001a: pop - IL_001b: ret - } - """ - """ - .method public static void run() cil managed - { - - .maxstack 4 - .locals init (int32 V_0) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: ldloca.s V_0 - IL_0004: ldc.i4.5 - IL_0005: call void TailCall04::foo(int32&, - !!0) - IL_000a: nop - IL_000b: ret - - """ - ] - - [] - let ``TailCall 05``() = - FSharp """ -module TailCall05 -let foo(x:int byref, y:int byref, z) = printfn "%d" (x+y) -let run() = let mutable x = 0 in foo(&x,&x,5) - """ - |> compileWithTailCalls - |> shouldSucceed - |> verifyIL [ - """ - .method public static void foo(int32& x, - int32& y, - !!a z) cil managed - { - - .maxstack 8 - IL_0000: ldstr "%d" - IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5,class [runtime]System.IO.TextWriter,class [FSharp.Core]Microsoft.FSharp.Core.Unit,class [FSharp.Core]Microsoft.FSharp.Core.Unit,int32>::.ctor(string) - IL_000a: call !!0 [FSharp.Core]Microsoft.FSharp.Core.ExtraTopLevelOperators::PrintFormatLine>(class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_000f: ldarg.0 - IL_0010: ldobj [runtime]System.Int32 - IL_0015: ldarg.1 - IL_0016: ldobj [runtime]System.Int32 - IL_001b: add - IL_001c: callvirt instance !1 class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2::Invoke(!0) - IL_0021: pop - IL_0022: ret - } - """ - """ - .method public static void run() cil managed - { - - .maxstack 5 - .locals init (int32 V_0) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: ldloca.s V_0 - IL_0004: ldloca.s V_0 - IL_0006: ldc.i4.5 - IL_0007: call void TailCall05::foo(int32&, - int32&, - !!0) - IL_000c: nop - IL_000d: ret - } - """ - ] - diff --git a/tests/FSharp.Compiler.ComponentTests/TupleElimination.fs b/tests/FSharp.Compiler.ComponentTests/TupleElimination.fs deleted file mode 100644 index 5c77f15f552..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/TupleElimination.fs +++ /dev/null @@ -1,800 +0,0 @@ -// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. - -namespace EmittedIL - -open Xunit -open FSharp.Test.Compiler - -module ``TupleElimination`` = - - [] - let ``Sequence expressions with potential side effects do not prevent tuple elimination``() = - FSharp """ -module TupleElimination -open System.Runtime.CompilerServices - -[] -let f () = 3 - -[] -let sideEffect () = () - -type Test = - [] - static member test(x: int32 * int32) = x - -let v () = - let a, b = - "".ToString () |> ignore - System.DateTime.Now |> ignore - "3".ToString () |> ignore - 2L, f () - System.DateTime.Now |> ignore - a, b - -let w () = - let (a, b) as t = - "".ToString () |> ignore - System.DateTime.Now |> ignore - "3".ToString () |> ignore - 2, f () - System.DateTime.Now |> ignore - let _ = Test.test(t) - a + b - -let x () = - let a, b = - "".ToString () |> ignore - System.DateTime.Now |> ignore - "3".ToString () |> ignore - 2, f () - System.DateTime.Now |> ignore - a + b - -let y () = - let a, b, c = - let a = f () - sideEffect () - a, f (), f () - a + b + c - -let z () = - let a, b, c = - let u, v = 3, 4 - sideEffect () - f (), f () + u, f () + v - a + b + c - """ - |> compile - |> shouldSucceed - |> verifyIL [ - -(* -public static Tuple v() -{ - string text = "".ToString(); - DateTime now = DateTime.Now; - text = "3".ToString(); - int item = TupleElimination.f(); - now = DateTime.Now; - return new Tuple(2L, item); -} -*) - """ -.method public static class [runtime]System.Tuple`2 - v() cil managed -{ - - .maxstack 4 - .locals init (string V_0, - valuetype [runtime]System.DateTime V_1, - int32 V_2) - IL_0000: ldstr "" - IL_0005: callvirt instance string [runtime]System.Object::ToString() - IL_000a: stloc.0 - IL_000b: call valuetype [runtime]System.DateTime [runtime]System.DateTime::get_Now() - IL_0010: stloc.1 - IL_0011: ldstr "3" - IL_0016: callvirt instance string [runtime]System.Object::ToString() - IL_001b: stloc.0 - IL_001c: call int32 TupleElimination::f() - IL_0021: stloc.2 - IL_0022: call valuetype [runtime]System.DateTime [runtime]System.DateTime::get_Now() - IL_0027: stloc.1 - IL_0028: ldc.i4.2 - IL_0029: conv.i8 - IL_002a: ldloc.2 - IL_002b: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) - IL_0030: ret -} -""" - -(* -public static int w() -{ - string text = "".ToString(); - DateTime now = DateTime.Now; - text = "3".ToString(); - int num = TupleElimination.f(); - Tuple x = new Tuple(2, num); - now = DateTime.Now; - TupleElimination.Test.test(x); - return 2 + num; -} -*) - """ -.method public static int32 w() cil managed -{ - - .maxstack 4 - .locals init (string V_0, - valuetype [runtime]System.DateTime V_1, - int32 V_2, - class [runtime]System.Tuple`2 V_3) - IL_0000: ldstr "" - IL_0005: callvirt instance string [runtime]System.Object::ToString() - IL_000a: stloc.0 - IL_000b: call valuetype [runtime]System.DateTime [runtime]System.DateTime::get_Now() - IL_0010: stloc.1 - IL_0011: ldstr "3" - IL_0016: callvirt instance string [runtime]System.Object::ToString() - IL_001b: stloc.0 - IL_001c: call int32 TupleElimination::f() - IL_0021: stloc.2 - IL_0022: ldc.i4.2 - IL_0023: ldloc.2 - IL_0024: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) - IL_0029: stloc.3 - IL_002a: call valuetype [runtime]System.DateTime [runtime]System.DateTime::get_Now() - IL_002f: stloc.1 - IL_0030: ldloc.3 - IL_0031: call class [runtime]System.Tuple`2 TupleElimination/Test::test(class [runtime]System.Tuple`2) - IL_0036: pop - IL_0037: ldc.i4.2 - IL_0038: ldloc.2 - IL_0039: add - IL_003a: ret -} -""" - -(* -public static int x() -{ - string text = "".ToString(); - DateTime now = DateTime.Now; - text = "3".ToString(); - int num = TupleElimination.f(); - now = DateTime.Now; - return 2 + num; -} -*) - """ -.method public static int32 x() cil managed -{ - - .maxstack 4 - .locals init (string V_0, - valuetype [runtime]System.DateTime V_1, - int32 V_2) - IL_0000: ldstr "" - IL_0005: callvirt instance string [runtime]System.Object::ToString() - IL_000a: stloc.0 - IL_000b: call valuetype [runtime]System.DateTime [runtime]System.DateTime::get_Now() - IL_0010: stloc.1 - IL_0011: ldstr "3" - IL_0016: callvirt instance string [runtime]System.Object::ToString() - IL_001b: stloc.0 - IL_001c: call int32 TupleElimination::f() - IL_0021: stloc.2 - IL_0022: call valuetype [runtime]System.DateTime [runtime]System.DateTime::get_Now() - IL_0027: stloc.1 - IL_0028: ldc.i4.2 - IL_0029: ldloc.2 - IL_002a: add - IL_002b: ret -} -""" - -(* -public static int y() -{ - int num = TupleElimination.f(); - TupleElimination.sideEffect(); - return num + TupleElimination.f() + TupleElimination.f(); -} -*) - """ -.method public static int32 y() cil managed -{ - - .maxstack 4 - .locals init (int32 V_0) - IL_0000: call int32 TupleElimination::f() - IL_0005: stloc.0 - IL_0006: call void TupleElimination::sideEffect() - IL_000b: ldloc.0 - IL_000c: call int32 TupleElimination::f() - IL_0011: add - IL_0012: call int32 TupleElimination::f() - IL_0017: add - IL_0018: ret -} -""" - -(* -public static int z() -{ - TupleElimination.sideEffect(); - return TupleElimination.f() + (TupleElimination.f() + 3) + (TupleElimination.f() + 4); -} -*) - """ -.method public static int32 z() cil managed -{ - - .maxstack 8 - IL_0000: call void TupleElimination::sideEffect() - IL_0005: call int32 TupleElimination::f() - IL_000a: call int32 TupleElimination::f() - IL_000f: ldc.i4.3 - IL_0010: add - IL_0011: add - IL_0012: call int32 TupleElimination::f() - IL_0017: ldc.i4.4 - IL_0018: add - IL_0019: add - IL_001a: ret -} -""" ] - - [] - let ``First class use of tuple prevents elimination``() = - FSharp """ -module TupleElimination -open System.Runtime.CompilerServices - -[] -let f () = 3 - -[] -let cond () = true - -type Test = - [] - static member test(x: int32 * int32) = x - -let y () = - let a, b = - if cond () then - 1, 2 - else - Test.test(3, 4) - a + b - -let z () = - let a, b = - "".ToString () |> ignore - System.DateTime.Now |> ignore - "3".ToString () |> ignore - Test.test(2, f ()) - System.DateTime.Now |> ignore - a + b - """ - |> compile - |> shouldSucceed - |> verifyIL [ - -(* -public static int y() -{ - Tuple tuple = (!TupleElimination.cond()) ? TupleElimination.Test.test(new Tuple(3, 4)) : new Tuple(1, 2); - return tuple.Item1 + tuple.Item2; -} -*) - """ -.method public static int32 y() cil managed -{ - - .maxstack 4 - .locals init (class [runtime]System.Tuple`2 V_0) - IL_0000: call bool TupleElimination::cond() - IL_0005: brfalse.s IL_0010 - - IL_0007: ldc.i4.1 - IL_0008: ldc.i4.2 - IL_0009: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) - IL_000e: br.s IL_001c - - IL_0010: ldc.i4.3 - IL_0011: ldc.i4.4 - IL_0012: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) - IL_0017: call class [runtime]System.Tuple`2 TupleElimination/Test::test(class [runtime]System.Tuple`2) - IL_001c: stloc.0 - IL_001d: ldloc.0 - IL_001e: call instance !0 class [runtime]System.Tuple`2::get_Item1() - IL_0023: ldloc.0 - IL_0024: call instance !1 class [runtime]System.Tuple`2::get_Item2() - IL_0029: add - IL_002a: ret -} -""" - -(* -public static int z() -{ - string text = "".ToString(); - DateTime now = DateTime.Now; - text = "3".ToString(); - Tuple tuple = TupleElimination.Test.test(new Tuple(2, TupleElimination.f())); - int item = tuple.Item2; - int item2 = tuple.Item1; - now = DateTime.Now; - return item2 + item; -} -*) - """ -.method public static int32 z() cil managed -{ - - .maxstack 4 - .locals init (class [runtime]System.Tuple`2 V_0, - string V_1, - valuetype [runtime]System.DateTime V_2, - int32 V_3, - int32 V_4) - IL_0000: ldstr "" - IL_0005: callvirt instance string [runtime]System.Object::ToString() - IL_000a: stloc.1 - IL_000b: call valuetype [runtime]System.DateTime [runtime]System.DateTime::get_Now() - IL_0010: stloc.2 - IL_0011: ldstr "3" - IL_0016: callvirt instance string [runtime]System.Object::ToString() - IL_001b: stloc.1 - IL_001c: ldc.i4.2 - IL_001d: call int32 TupleElimination::f() - IL_0022: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) - IL_0027: call class [runtime]System.Tuple`2 TupleElimination/Test::test(class [runtime]System.Tuple`2) - IL_002c: stloc.0 - IL_002d: ldloc.0 - IL_002e: call instance !1 class [runtime]System.Tuple`2::get_Item2() - IL_0033: stloc.3 - IL_0034: ldloc.0 - IL_0035: call instance !0 class [runtime]System.Tuple`2::get_Item1() - IL_003a: stloc.s V_4 - IL_003c: call valuetype [runtime]System.DateTime [runtime]System.DateTime::get_Now() - IL_0041: stloc.2 - IL_0042: ldloc.s V_4 - IL_0044: ldloc.3 - IL_0045: add - IL_0046: ret -}""" ] - - [] - let ``Branching let binding rhs does not prevent tuple elimination``() = - FSharp """ -module TupleElimination -open System.Runtime.CompilerServices - -[] -let f () = 3 - -[] -let sideEffect () = () - -[] -let cond () = true - -type Test = - [] - static member test(x: int32 * int32) = x - -let x () = - let a, b = - sideEffect () - if cond () then - let v = "yep" - let v2 = if cond () then 1 else 3 - v, v2 - else - "", f () - a, b - -let rec y () = - let a, b, c = - if cond () then - "".ToString () |> ignore - 1, f (), 3 - else - if cond () then - 2, 2, 3 - else - match 1 / 0 with - | 1 -> - if 2 / 3 = 1 then - 5, 6, 7 - else - "".ToString () |> ignore - 6, 5, 4 - | 2 -> 6, 6, 6 - | 3 -> f (), 7, f () - | _ -> 8, y (), y () - - a + b + (2 * c) - -let z () = - let a, b = - if cond () then - 1, 3 - else - 3, 4 - a + b - """ - |> compile - |> shouldSucceed - |> verifyIL [ - -(* -public static Tuple x() -{ - TupleElimination.sideEffect(); - string item; - int item2; - if (TupleElimination.cond()) - { - int num = (!TupleElimination.cond()) ? 3 : 1; - item = "yep"; - item2 = num; - } - else - { - item = ""; - item2 = TupleElimination.f(); - } - return new Tuple(item, item2); -} -*) - """ -.method public static class [runtime]System.Tuple`2 - x() cil managed -{ - - .maxstack 4 - .locals init (string V_0, - int32 V_1, - int32 V_2) - IL_0000: call void TupleElimination::sideEffect() - IL_0005: call bool TupleElimination::cond() - IL_000a: brfalse.s IL_0022 - - IL_000c: call bool TupleElimination::cond() - IL_0011: brfalse.s IL_0016 - - IL_0013: ldc.i4.1 - IL_0014: br.s IL_0017 - - IL_0016: ldc.i4.3 - IL_0017: stloc.2 - IL_0018: ldstr "yep" - IL_001d: stloc.0 - IL_001e: ldloc.2 - IL_001f: stloc.1 - IL_0020: br.s IL_002e - - IL_0022: ldstr "" - IL_0027: stloc.0 - IL_0028: call int32 TupleElimination::f() - IL_002d: stloc.1 - IL_002e: ldloc.0 - IL_002f: ldloc.1 - IL_0030: newobj instance void class [runtime]System.Tuple`2::.ctor(!0, - !1) - IL_0035: ret -} -""" - -(* -public static int y() -{ - int num; - int num2; - int num3; - if (TupleElimination.cond()) - { - string text = "".ToString(); - num = 1; - num2 = TupleElimination.f(); - num3 = 3; - } - else if (TupleElimination.cond()) - { - num = 2; - num2 = 2; - num3 = 3; - } - else - { - switch (1 / 0) - { - case 1: - if (2 / 3 == 1) - { - num = 5; - num2 = 6; - num3 = 7; - } - else - { - string text = "".ToString(); - num = 6; - num2 = 5; - num3 = 4; - } - break; - case 2: - num = 6; - num2 = 6; - num3 = 6; - break; - case 3: - num = TupleElimination.f(); - num2 = 7; - num3 = TupleElimination.f(); - break; - default: - num = 8; - num2 = TupleElimination.y(); - num3 = TupleElimination.y(); - break; - } - } - return num + num2 + 2 * num3; -} -*) - """ -.method public static int32 y() cil managed -{ - - .maxstack 5 - .locals init (int32 V_0, - int32 V_1, - int32 V_2, - string V_3) - IL_0000: ldc.i4.0 - IL_0001: stloc.0 - IL_0002: ldc.i4.0 - IL_0003: stloc.1 - IL_0004: ldc.i4.0 - IL_0005: stloc.2 - IL_0006: call bool TupleElimination::cond() - IL_000b: brfalse.s IL_0027 - - IL_000d: ldstr "" - IL_0012: callvirt instance string [runtime]System.Object::ToString() - IL_0017: stloc.3 - IL_0018: ldc.i4.1 - IL_0019: stloc.0 - IL_001a: call int32 TupleElimination::f() - IL_001f: stloc.1 - IL_0020: ldc.i4.3 - IL_0021: stloc.2 - IL_0022: br IL_0095 - - IL_0027: call bool TupleElimination::cond() - IL_002c: brfalse.s IL_0036 - - IL_002e: ldc.i4.2 - IL_002f: stloc.0 - IL_0030: ldc.i4.2 - IL_0031: stloc.1 - IL_0032: ldc.i4.3 - IL_0033: stloc.2 - IL_0034: br.s IL_0095 - - IL_0036: ldc.i4.1 - IL_0037: ldc.i4.0 - IL_0038: div - IL_0039: ldc.i4.1 - IL_003a: sub - IL_003b: switch ( - IL_004e, - IL_006f, - IL_0077) - IL_004c: br.s IL_0087 - - IL_004e: ldc.i4.2 - IL_004f: ldc.i4.3 - IL_0050: div - IL_0051: ldc.i4.1 - IL_0052: bne.un.s IL_005c - - IL_0054: ldc.i4.5 - IL_0055: stloc.0 - IL_0056: ldc.i4.6 - IL_0057: stloc.1 - IL_0058: ldc.i4.7 - IL_0059: stloc.2 - IL_005a: br.s IL_0095 - - IL_005c: ldstr "" - IL_0061: callvirt instance string [runtime]System.Object::ToString() - IL_0066: stloc.3 - IL_0067: ldc.i4.6 - IL_0068: stloc.0 - IL_0069: ldc.i4.5 - IL_006a: stloc.1 - IL_006b: ldc.i4.4 - IL_006c: stloc.2 - IL_006d: br.s IL_0095 - - IL_006f: ldc.i4.6 - IL_0070: stloc.0 - IL_0071: ldc.i4.6 - IL_0072: stloc.1 - IL_0073: ldc.i4.6 - IL_0074: stloc.2 - IL_0075: br.s IL_0095 - - IL_0077: call int32 TupleElimination::f() - IL_007c: stloc.0 - IL_007d: ldc.i4.7 - IL_007e: stloc.1 - IL_007f: call int32 TupleElimination::f() - IL_0084: stloc.2 - IL_0085: br.s IL_0095 - - IL_0087: ldc.i4.8 - IL_0088: stloc.0 - IL_0089: call int32 TupleElimination::y() - IL_008e: stloc.1 - IL_008f: call int32 TupleElimination::y() - IL_0094: stloc.2 - IL_0095: ldloc.0 - IL_0096: ldloc.1 - IL_0097: add - IL_0098: ldc.i4.2 - IL_0099: ldloc.2 - IL_009a: mul - IL_009b: add - IL_009c: ret -} -""" - -(* -public static int z() -{ - int num; - int num2; - if (TupleElimination.cond()) - { - num = 1; - num2 = 3; - } - else - { - num = 3; - num2 = 4; - } - return num + num2; -} -*) - """ -.method public static int32 z() cil managed -{ - - .maxstack 4 - .locals init (int32 V_0, - int32 V_1) - IL_0000: call bool TupleElimination::cond() - IL_0005: brfalse.s IL_000d - - IL_0007: ldc.i4.1 - IL_0008: stloc.0 - IL_0009: ldc.i4.3 - IL_000a: stloc.1 - IL_000b: br.s IL_0011 - - IL_000d: ldc.i4.3 - IL_000e: stloc.0 - IL_000f: ldc.i4.4 - IL_0010: stloc.1 - IL_0011: ldloc.0 - IL_0012: ldloc.1 - IL_0013: add - IL_0014: ret -}""" ] - - - -#if !DEBUG // sensitive to debug-level code coming across from debug FSharp.Core - - [] - let ``Branching let binding of tuple with capture doesn't promote``() = - FSharp """ -module TupleElimination -open System.Runtime.CompilerServices - -let testFunction(a,b) = - let x,y = printfn "hello"; b*a,a*b - (fun () -> x + y) - """ - |> compile - |> shouldSucceed - |> verifyIL [ - // Checks the captured 'x' and 'y' are not promoted onto the heap - """ -.method public static class [FSharp.Core]Microsoft.FSharp.Core.FSharpFunc`2 - testFunction(int32 a, - int32 b) cil managed -{ - - .maxstack 4 - .locals init (class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4 V_0, - int32 V_1, - int32 V_2) - IL_0000: ldstr "hello" - IL_0005: newobj instance void class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`5::.ctor(string) - IL_000a: stloc.0 - IL_000b: call class [netstandard]System.IO.TextWriter [netstandard]System.Console::get_Out() - IL_0010: ldloc.0 - IL_0011: call !!0 [FSharp.Core]Microsoft.FSharp.Core.PrintfModule::PrintFormatLineToTextWriter(class [runtime]System.IO.TextWriter, - class [FSharp.Core]Microsoft.FSharp.Core.PrintfFormat`4) - IL_0016: pop - IL_0017: ldarg.1 - IL_0018: ldarg.0 - IL_0019: mul - IL_001a: stloc.1 - IL_001b: ldarg.0 - IL_001c: ldarg.1 - IL_001d: mul - IL_001e: stloc.2 - IL_001f: ldloc.1 - IL_0020: ldloc.2 - IL_0021: newobj instance void TupleElimination/testFunction@7::.ctor(int32, - int32) - IL_0026: ret -} - -""" ] - -#endif - - - [] - let ``Branching let binding of tuple gives good names in closure``() = - FSharp """ -module TupleElimination -open System.Runtime.CompilerServices - -let testFunction(a,b) = - let x,y = printfn "hello"; b*a,a*b - (fun () -> x + y) - """ - |> compile - |> shouldSucceed - |> verifyIL [ - - // Checks the names of captured 'x' and 'y'. - """ - - .method public strict virtual instance int32 - Invoke(class [FSharp.Core]Microsoft.FSharp.Core.Unit unitVar0) cil managed - { - - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: ldfld int32 TupleElimination/testFunction@7::x - IL_0006: ldarg.0 - IL_0007: ldfld int32 TupleElimination/testFunction@7::y - IL_000c: add - IL_000d: ret - } -""" ] - - - - diff --git a/tests/FSharp.Compiler.ComponentTests/TypeChecks/TypeExtensions/PropertyShadowingTests.fs b/tests/FSharp.Compiler.ComponentTests/TypeChecks/TypeExtensions/PropertyShadowingTests.fs deleted file mode 100644 index b01e4df8998..00000000000 --- a/tests/FSharp.Compiler.ComponentTests/TypeChecks/TypeExtensions/PropertyShadowingTests.fs +++ /dev/null @@ -1,43 +0,0 @@ -module FSharp.Compiler.ComponentTests.TypeChecks.TypeExtensions.Shadowing -open Xunit -open FSharp.Test -open FSharp.Test.Compiler - -let [] folder = __SOURCE_DIRECTORY__ + "/Shadowing" - -[] -let PropertyHiding compilation = - compilation - |> asFsx - |> verifyBaselines - |> compileAndRun - |> shouldSucceed - -[] -let ``PropertyHiding fails`` compilation = - compilation - |> asFsx - |> verifyBaselines - |> compile - |> shouldFail diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index d9e365704d5..44a2f1a01bd 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -595,7 +595,8 @@ module rec Compiler = let withOutputDirectory (path: DirectoryInfo option) (cUnit: CompilationUnit) : CompilationUnit = match cUnit with | FS fs -> FS { fs with OutputDirectory = path } - | _ -> failwith "withOutputDirectory is only supported on F#" + | CS cs -> CS { cs with OutputDirectory = path } + | _ -> failwith "withOutputDirectory is only supported on F# and C#" let withCheckNulls (cUnit: CompilationUnit) : CompilationUnit = withOptionsHelper ["--checknulls+"] "checknulls is only supported in F#" cUnit @@ -779,7 +780,10 @@ module rec Compiler = match s.OutputPath with | None -> failwith "Operation didn't produce any output!" | Some p -> p |> MetadataReference.CreateFromFile - | _ -> failwith "Conversion isn't possible" + | TestCompilationReference cmpl -> + let outputDirectory = createTemporaryDirectory() + let tmp = cmpl.EmitToDirectory outputDirectory + tmp |> MetadataReference.CreateFromFile let private processReferences (references: CompilationUnit list) defaultOutputDirectory = let rec loop acc = function @@ -2096,3 +2100,26 @@ Actual: match hash with | Some h -> h | None -> failwith "Implied signature hash returned 'None' which should not happen" + + /// Result type for CLI subprocess execution (runFsiProcess / runFscProcess). + type ProcessResult = { ExitCode: int; StdOut: string; StdErr: string } + + /// Run an F# tool (FSI or FSC) as a subprocess. Shared helper for runFsiProcess / runFscProcess. + let private runToolProcess (toolPath: string) (args: string list) : ProcessResult = +#if NETCOREAPP + let exe = TestFramework.initialConfig.DotNetExe + let arguments = toolPath + " " + (args |> String.concat " ") +#else + let exe = toolPath + let arguments = args |> String.concat " " +#endif + let exitCode, stdout, stderr = Commands.executeProcess exe arguments (Directory.GetCurrentDirectory()) + { ExitCode = exitCode; StdOut = stdout; StdErr = stderr } + + /// Run FSI as a subprocess with the given arguments. For CLI-level tests only (--help, exit codes, etc.). + let runFsiProcess (args: string list) : ProcessResult = + runToolProcess TestFramework.initialConfig.FSI args + + /// Run FSC as a subprocess with the given arguments. For CLI-level tests only (missing files, exit codes, etc.). + let runFscProcess (args: string list) : ProcessResult = + runToolProcess TestFramework.initialConfig.FSC args diff --git a/tests/FSharp.Test.Utilities/CompilerAssert.fs b/tests/FSharp.Test.Utilities/CompilerAssert.fs index e7d4bcbb79e..8348256b2c8 100644 --- a/tests/FSharp.Test.Utilities/CompilerAssert.fs +++ b/tests/FSharp.Test.Utilities/CompilerAssert.fs @@ -180,6 +180,15 @@ type TestCompilation = let (_, data) = result.Value File.WriteAllBytes (outputPath, data) + member this.EmitToDirectory (outputDir: DirectoryInfo) = + let fileName = + match this with + | TestCompilation.CSharp c when not (String.IsNullOrWhiteSpace c.AssemblyName) -> c.AssemblyName + | _ -> getTemporaryFileNameInDirectory outputDir + let outputPath = Path.Combine(outputDir.FullName, Path.ChangeExtension(fileName, ".dll")) + this.EmitAsFile outputPath + outputPath + type CSharpLanguageVersion = | CSharp8 = 0 | CSharp9 = 1 @@ -561,12 +570,7 @@ module CompilerAssertHelpers = | CompilationReference (cmpl, staticLink) -> compileCompilationAux outputDir ignoreWarnings cmpl, staticLink | TestCompilationReference (cmpl) -> - let fileName = - match cmpl with - | TestCompilation.CSharp c when not (String.IsNullOrWhiteSpace c.AssemblyName) -> c.AssemblyName - | _ -> getTemporaryFileNameInDirectory outputDir - let tmp = Path.Combine(outputDir.FullName, Path.ChangeExtension(fileName, ".dll")) - cmpl.EmitAsFile tmp + let tmp = cmpl.EmitToDirectory outputDir (([||], None, tmp), []), false) let compilationRefs = diff --git a/tests/FSharp.Test.Utilities/Utilities.fs b/tests/FSharp.Test.Utilities/Utilities.fs index 1305a532978..72d895a2c64 100644 --- a/tests/FSharp.Test.Utilities/Utilities.fs +++ b/tests/FSharp.Test.Utilities/Utilities.fs @@ -39,6 +39,12 @@ type FactForDESKTOPAttribute() = do base.Skip <- "NETCOREAPP is not supported runtime for this kind of test, it is intended for DESKTOP only" #endif +type FactForWINDOWSAttribute() = + inherit FactAttribute() + do + if not (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(System.Runtime.InteropServices.OSPlatform.Windows)) then + base.Skip <- "This test is only supported on Windows" + module SignedBuildSkip = let isSignedBuild = System.Environment.GetEnvironmentVariable("SIGNTYPE") = "Real" let skipMessage = "Test skipped on signed builds due to NuGet package restore restrictions"