Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Compiler/Facilities/LanguageFeatures.fs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ type LanguageVersion(versionText, ?disabledFeaturesArray: LanguageFeature array)
static let languageVersion100 = 10.0m
static let languageVersion110 = 11.0m
static let previewVersion = 9999m // Language version when preview specified
static let defaultVersion = languageVersion100 // Language version when default specified
static let defaultVersion = languageVersion110 // Language version when default specified
static let latestVersion = defaultVersion // Language version when latest specified
static let latestMajorVersion = defaultVersion // Language version when latestmajor specified

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module SignatureEnforcedAttributes =
|> FS
|> withAdditionalSourceFile (fs implSrc)
|> asLibrary
|> withLangVersion10 // FS3888 is a warning pre-11 and an error at 11.0 (ErrorOnMissingSignatureAttribute); pin to the warning behavior
|> ignoreWarnings
|> compile

Expand Down Expand Up @@ -265,6 +266,7 @@ let inline f (x: int) = x + 1
|> FS
|> withAdditionalSourceFile (fs implSrc)
|> asLibrary
|> withLangVersion10 // #nowarn suppresses FS3888 only while it is a warning (pre-11); at 11.0 it is an error
|> compile
|> shouldSucceed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ let private coreOptions compilation =
let verifyCompilation compilation =
compilation
|> coreOptions
|> withLangVersion10 // default baseline captures the pre-11 closure IL; DirectDelegateConstruction (11.0) is covered by the preview twin

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is likely not going to age well.

@T-Gro Should we try to not add these comments after all? I think they distract more than they help, especially because we're getting more of them.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment as well as the test can be removed once the feature is stabilized.

Until then, its good to have anything proving that:

  • both variants (feature on/off) are tested
  • what tests can be removed (rather then rewritten) when feature stabilizes

I do agree comments are not the optimal tool, maybe named function call would be better?

TLDR:
I would love to keep anything around that tells the future maintainers "this test has to be ported" vs "this test can be removed".

|> compile
|> shouldSucceed
|> verifyPEFileWithSystemDlls
Expand Down Expand Up @@ -212,6 +213,7 @@ let main _ =
if d.Method.Name <> "Invoke" then failwithf "expected closure Method.Name 'Invoke' but got '%s'" d.Method.Name
0
"""
|> withLangVersion10 // "without the feature": DirectDelegateConstruction is off pre-11, so the delegate goes through a closure
|> compileExeAndRun
|> shouldSucceed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ module NullnessMetadata =
let ``Nullable attr for exception types`` compilation =
compilation
|> getCompilation
|> withLangVersion10 // ExceptionFieldSerializationSupport (11.0) changes exception IL; pin to pre-11 (nullness stays on, gated at 9.0)
|> verifyCompilation DoNotOptimize

[<Theory; FileInlineData("ReferenceDU.fs")>]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module SerializableAttribute =
|> withEmbeddedPdb
|> withEmbedAllSource
|> ignoreWarnings
|> withLangVersion10 // baselines capture pre-11 serialization IL; ExceptionFieldSerializationSupport (11.0) is off here
|> compile
|> verifyILBaseline

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ module TestFrameworkAdapter =
match version with
| LangVersion.V80 -> "8.0",bonusArgs
| LangVersion.V90 -> "9.0",bonusArgs
| LangVersion.V10 -> "10.0",bonusArgs
| LangVersion.Preview -> "preview",bonusArgs
| LangVersion.Latest -> "latest", bonusArgs

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ let ``type check neg10_a`` () = singleNegTest ( "typecheck/sigs") "neg10_a"
let ``type check neg11`` () = singleNegTest ( "typecheck/sigs") "neg11"

[<FactForDESKTOP>]
let ``type check neg12`` () = singleNegTest ( "typecheck/sigs") "neg12"
// Pinned to 10.0: at 11.0 AccessProtectedBaseFieldFromClosure lets the protected-member-from-closure
// cases compile, dropping baseline errors. 11.0 behavior is covered by dedicated conformance tests.
let ``type check neg12`` () = singleVersionedNegTest ("typecheck/sigs") LangVersion.V10 "neg12"

[<FactForDESKTOP>]
let ``type check neg13`` () = singleNegTest ( "typecheck/sigs") "neg13"
Expand Down
2 changes: 2 additions & 0 deletions tests/FSharp.Test.Utilities/ScriptHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ open FSharp.Test
type LangVersion =
| V80
| V90
| V10
| Preview
| Latest

Expand All @@ -40,6 +41,7 @@ type FSharpScript(?additionalArgs: string[], ?quiet: bool, ?langVersion: LangVer
| LangVersion.Latest -> "--langversion:latest"
| LangVersion.V80 -> "--langversion:8.0"
| LangVersion.V90 -> "--langversion:9.0"
| LangVersion.V10 -> "--langversion:10.0"
|]

let argv = Array.append baseArgs additionalArgs
Expand Down
15 changes: 10 additions & 5 deletions tests/fsharp/Compiler/CodeGen/EmittedIL/StaticMember.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ open Xunit

module ``Static Member`` =

// The delegate-from-method cases below are pinned to --langversion:10.0: at F# 11.0 (now the default)
// DirectDelegateConstruction builds the delegate straight from the target method, dropping the closure
// class this IL expects. The 11.0 form is covered by EmittedIL/DirectDelegates.

[<Fact>]
let ``Action on Static Member``() =
CompilerAssert.CompileLibraryAndVerifyILRealSig(
CompilerAssert.CompileLibraryAndVerifyILWithOptions([| "--realsig+"; "--langversion:10.0" |],
"""
module StaticMember01

Expand Down Expand Up @@ -74,7 +78,7 @@ type C =

[<Fact>]
let ``Action on Static Member with lambda``() =
CompilerAssert.CompileLibraryAndVerifyILRealSig(
CompilerAssert.CompileLibraryAndVerifyILWithOptions([| "--realsig+"; "--langversion:10.0" |],
"""
module StaticMember02

Expand Down Expand Up @@ -247,7 +251,7 @@ let main _ =

[<Fact>]
let ``Func on Static Member``() =
CompilerAssert.CompileLibraryAndVerifyILRealSig(
CompilerAssert.CompileLibraryAndVerifyILWithOptions([| "--realsig+"; "--langversion:10.0" |],
"""
module StaticMember04

Expand Down Expand Up @@ -313,7 +317,7 @@ type C =

[<Fact>]
let ``Func on Static Member with lambda``() =
CompilerAssert.CompileLibraryAndVerifyILRealSig(
CompilerAssert.CompileLibraryAndVerifyILWithOptions([| "--realsig+"; "--langversion:10.0" |],
"""
module StaticMember05

Expand Down Expand Up @@ -434,7 +438,8 @@ let main _ =
#if !FX_NO_WINFORMS
[<Fact>]
let ``EventHandler from Regression/83``() =
CompilerAssert.CompileLibraryAndVerifyILRealSig(
// Same pin as the cases above; WinForms-gated, so this one only runs on Windows CI.
CompilerAssert.CompileLibraryAndVerifyILWithOptions([| "--realsig+"; "--langversion:10.0" |],
"""
module StaticMember07

Expand Down
7 changes: 5 additions & 2 deletions tests/fsharp/tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,14 @@ module CoreTests =
exec cfg cfg.DotNetExe ($"msbuild {projectFile} /p:Configuration={cfg.BUILD_CONFIG} -property:FSharpRepositoryPath={FSharpRepositoryPath}")

#if !NETCOREAPP
// Pinned to 10.0: at 11.0 ErrorOnMissingSignatureAttribute turns FS3888 (attribute on impl but
// not signature) from warning into error, which this test deliberately exercises. 11.0 behavior is
// covered by Conformance/Signatures/SignatureEnforcedAttributes.
[<Fact>]
let ``attributes-FSC_OPTIMIZED`` () = singleTestBuildAndRun "core/attributes" FSC_OPTIMIZED
let ``attributes-FSC_OPTIMIZED`` () = singleTestBuildAndRunVersion "core/attributes" FSC_OPTIMIZED "10.0"

[<Fact>]
let ``attributes-FSI`` () = singleTestBuildAndRun "core/attributes" FSI
let ``attributes-FSI`` () = singleTestBuildAndRunVersion "core/attributes" FSI "10.0"

[<Fact>]
let span () =
Expand Down
Loading