Skip to content

Commit

Permalink
Enable 4.7 by default (#7204)
Browse files Browse the repository at this point in the history
* Enable 4.7 by default

* Label format
  • Loading branch information
KevinRansom authored Jul 12, 2019
1 parent 742449a commit f5f7f0f
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 55 deletions.
47 changes: 24 additions & 23 deletions src/fsharp/LanguageFeatures.fs
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,42 @@ open System
/// LanguageFeature enumeration
[<RequireQualifiedAccess>]
type LanguageFeature =
| LanguageVersion46 = 0
| LanguageVersion47 = 1
| SingleUnderscorePattern = 2
| WildCardInForLoop = 3
| RelaxWhitespace = 4
| NameOf = 5
| ImplicitYield = 6
| OpenStaticClasses = 7
| PreviewVersion = 0
| LanguageVersion46 = 1
| LanguageVersion47 = 2
| SingleUnderscorePattern = 3
| WildCardInForLoop = 4
| RelaxWhitespace = 5
| NameOf = 6
| ImplicitYield = 7
| OpenStaticClasses = 8


/// LanguageVersion management
type LanguageVersion (specifiedVersion) =

// When we increment language versions here preview is higher than current RTM version
static let languageVersion46 = 4.6m
static let languageVersion47 = 4.7m

static let previewVersion = languageVersion47 // Language version when preview specified
static let defaultVersion = languageVersion46 // Language version when default specified
static let previewVersion = 9999m // Language version when preview specified
static let defaultVersion = languageVersion47 // Language version when default specified
static let latestVersion = defaultVersion // Language version when latest specified
static let latestMajorVersion = languageVersion46 // Language version when latestmajor specified

static let validOptions = [| "preview"; "default"; "latest"; "latestmajor" |]
static let languageVersions = set [| latestVersion |]
static let languageVersions = set [| languageVersion46; languageVersion47 |]

static let features = dict [|
// Add new LanguageVersions here ...
LanguageFeature.LanguageVersion47, 4.7m
LanguageFeature.LanguageVersion46, 4.6m
LanguageFeature.SingleUnderscorePattern, previewVersion
LanguageFeature.WildCardInForLoop, previewVersion
LanguageFeature.RelaxWhitespace, previewVersion
LanguageFeature.NameOf, previewVersion
LanguageFeature.ImplicitYield, previewVersion
LanguageFeature.OpenStaticClasses, previewVersion
LanguageFeature.LanguageVersion46, languageVersion46
LanguageFeature.LanguageVersion47, languageVersion47
LanguageFeature.PreviewVersion, previewVersion
LanguageFeature.SingleUnderscorePattern, languageVersion47
LanguageFeature.WildCardInForLoop, languageVersion47
LanguageFeature.RelaxWhitespace, languageVersion47
LanguageFeature.NameOf, languageVersion47
LanguageFeature.ImplicitYield, languageVersion47
LanguageFeature.OpenStaticClasses, languageVersion47
|]

let specified =
Expand Down Expand Up @@ -88,7 +90,6 @@ type LanguageVersion (specifiedVersion) =
/// Get a list of valid versions for help text
member __.ValidVersions = [|
for v in languageVersions |> Seq.sort do
let label = if v = defaultVersion || v = latestVersion then "(Default)" else ""
yield sprintf "%M %s" v label
let label = if v = defaultVersion then " (Default)" else ""
yield sprintf "%M%s" v label
|]

18 changes: 10 additions & 8 deletions src/fsharp/LanguageFeatures.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ module internal FSharp.Compiler.Features
/// LanguageFeature enumeration
[<RequireQualifiedAccess>]
type LanguageFeature =
| LanguageVersion46 = 0
| LanguageVersion47 = 1
| SingleUnderscorePattern = 2
| WildCardInForLoop = 3
| RelaxWhitespace = 4
| NameOf = 5
| ImplicitYield = 6
| OpenStaticClasses = 7
| PreviewVersion = 0
| LanguageVersion46 = 1
| LanguageVersion47 = 2
| SingleUnderscorePattern = 3
| WildCardInForLoop = 4
| RelaxWhitespace = 5
| NameOf = 6
| ImplicitYield = 7
| OpenStaticClasses = 8


/// LanguageVersion management
type LanguageVersion =
Expand Down
10 changes: 5 additions & 5 deletions tests/fsharp/tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1824,25 +1824,25 @@ module VersionTests =
let ``member-selfidentifier-version4.6``() = singleTestBuildAndRunVersion "core/members/self-identifier/version46" FSC_BUILDONLY "4.6"

[<Test>]
let ``member-selfidentifier-version4.7``() = singleTestBuildAndRunVersion "core/members/self-identifier/version47" FSC_BUILDONLY "preview"
let ``member-selfidentifier-version4.7``() = singleTestBuildAndRun "core/members/self-identifier/version47" FSC_BUILDONLY

[<Test>]
let ``indent-version4.6``() = singleTestBuildAndRunVersion "core/indent/version46" FSC_BUILDONLY "4.6"

[<Test>]
let ``indent-version4.7``() = singleTestBuildAndRunVersion "core/indent/version47" FSC_BUILDONLY "preview"
let ``indent-version4.7``() = singleTestBuildAndRun "core/indent/version47" FSC_BUILDONLY

[<Test>]
let ``nameof-version4.6``() = singleTestBuildAndRunVersion "core/nameof/version46" FSC_BUILDONLY "4.6"

[<Test>]
let ``nameof-version4.7``() = singleTestBuildAndRunVersion "core/nameof/version47" FSC_BUILDONLY "preview"
let ``nameof-version4.7``() = singleTestBuildAndRun "core/nameof/version47" FSC_BUILDONLY

[<Test>]
let ``nameof-execute``() = singleTestBuildAndRunVersion "core/nameof/version47" FSC_BASIC "preview"
let ``nameof-execute``() = singleTestBuildAndRun "core/nameof/version47" FSC_BASIC

[<Test>]
let ``nameof-fsi``() = singleTestBuildAndRunVersion "core/nameof/version47" FSI_BASIC "preview"
let ``nameof-fsi``() = singleTestBuildAndRun "core/nameof/version47" FSI_BASIC

#if !FSHARP_SUITE_DRIVES_CORECLR_TESTS
module ToolsTests =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ preview
default
latest
latestmajor
4.6 (Default)
4.6
4.7 (Default)
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ preview
default
latest
latestmajor
4.6 (Default)
4.6
4.7 (Default)
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
SOURCE=E_NameOfIntConst.fs SCFLAGS="--langversion:preview" # E_NameOfIntConst.fs
SOURCE=E_NameOfStringConst.fs SCFLAGS="--langversion:preview" # E_NameOfStringConst.fs
SOURCE=E_NameOfAppliedFunction.fs SCFLAGS="--langversion:preview" # E_NameOfAppliedFunction.fs
SOURCE=E_NameOfIntegerAppliedFunction.fs SCFLAGS="--langversion:preview" # E_NameOfIntegerAppliedFunction.fs
SOURCE=E_NameOfPartiallyAppliedFunction.fs SCFLAGS="--langversion:preview" # E_NameOfPartiallyAppliedFunction.fs
SOURCE=E_NameOfDictLookup.fs SCFLAGS="--langversion:preview" # E_NameOfDictLookup.fs
SOURCE=E_NameOfAdditionExpr.fs SCFLAGS="--langversion:preview" # E_NameOfAdditionExpr.fs
SOURCE=E_NameOfParameterAppliedFunction.fs SCFLAGS="--langversion:preview" # E_NameOfParameterAppliedFunction.fs
SOURCE=E_NameOfAsAFunction.fs SCFLAGS="--langversion:preview" # E_NameOfAsAFunction.fs
SOURCE=E_NameOfWithPipe.fs SCFLAGS="--langversion:preview" # E_NameOfWithPipe.fs
SOURCE=E_NameOfUnresolvableName.fs SCFLAGS="--langversion:preview" # E_NameOfUnresolvableName.fs
SOURCE=E_NameOfIntConst.fs # E_NameOfIntConst.fs
SOURCE=E_NameOfStringConst.fs # E_NameOfStringConst.fs
SOURCE=E_NameOfAppliedFunction.fs # E_NameOfAppliedFunction.fs
SOURCE=E_NameOfIntegerAppliedFunction.fs # E_NameOfIntegerAppliedFunction.fs
SOURCE=E_NameOfPartiallyAppliedFunction.fs # E_NameOfPartiallyAppliedFunction.fs
SOURCE=E_NameOfDictLookup.fs # E_NameOfDictLookup.fs
SOURCE=E_NameOfAdditionExpr.fs # E_NameOfAdditionExpr.fs
SOURCE=E_NameOfParameterAppliedFunction.fs # E_NameOfParameterAppliedFunction.fs
SOURCE=E_NameOfAsAFunction.fs # E_NameOfAsAFunction.fs
SOURCE=E_NameOfWithPipe.fs # E_NameOfWithPipe.fs
SOURCE=E_NameOfUnresolvableName.fs # E_NameOfUnresolvableName.fs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
SOURCE=version46/W_IfThenElse01.fs SCFLAGS="--langversion:4.6 --test:ErrorRanges" # version46 W_IfThenElse01.fs
SOURCE=version46/W_IfThenElse02.fs SCFLAGS="--langversion:4.6 --test:ErrorRanges" # version46 W_IfThenElse02.fs
SOURCE=version46/W_IfThenElse03.fs SCFLAGS="--langversion:4.6 --test:ErrorRanges" # version46 W_IfThenElse03.fs
SOURCE=version47/W_IfThenElse01.fs SCFLAGS="--langversion:preview --test:ErrorRanges" # version47 W_IfThenElse01.fs
SOURCE=version47/W_IfThenElse02.fs SCFLAGS="--langversion:preview --test:ErrorRanges" # version47 W_IfThenElse02.fs
SOURCE=version47/W_IfThenElse03.fs SCFLAGS="--langversion:preview --test:ErrorRanges" # version47 W_IfThenElse03.fs
SOURCE=version47/W_IfThenElse01.fs SCFLAGS="--test:ErrorRanges" # W_IfThenElse01.fs
SOURCE=version47/W_IfThenElse02.fs SCFLAGS="--test:ErrorRanges" # W_IfThenElse02.fs
SOURCE=version47/W_IfThenElse03.fs SCFLAGS="--test:ErrorRanges" # W_IfThenElse03.fs

SOURCE=IfThenElse04.fs SCFLAGS="--test:ErrorRanges --warnaserror" # IfThenElse04.fs
SOURCE=IfThenElse05.fs SCFLAGS="--test:ErrorRanges --warnaserror" # IfThenElse05.fs
Expand Down
6 changes: 3 additions & 3 deletions tests/fsharpqa/Source/Warnings/env.lst
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@
SOURCE=version46/WarnIfDiscardedInList.fs SCFLAGS="--langversion:4.6" #version46/WarnIfDiscardedInList
SOURCE=version46/WarnIfDiscardedInList2.fs SCFLAGS="--langversion:4.6" #version46/WarnIfDiscardedInList2
SOURCE=version46/WarnIfDiscardedInList3.fs SCFLAGS="--langversion:4.6" #version46/WarnIfDiscardedInList3
SOURCE=version47/WarnIfDiscardedInList.fs SCFLAGS="--langversion:preview" #version47/WarnIfDiscardedInList
SOURCE=version47/WarnIfDiscardedInList2.fs SCFLAGS="--langversion:preview" #version47/WarnIfDiscardedInList2
SOURCE=version47/WarnIfDiscardedInList3.fs SCFLAGS="--langversion:preview" #version47/WarnIfDiscardedInList3
SOURCE=version47/WarnIfDiscardedInList.fs #version47/WarnIfDiscardedInList
SOURCE=version47/WarnIfDiscardedInList2.fs #version47/WarnIfDiscardedInList2
SOURCE=version47/WarnIfDiscardedInList3.fs #version47/WarnIfDiscardedInList3
SOURCE=WarnOnlyOnLastExpression.fs
SOURCE=WarnIfPossiblePropertySetter.fs
SOURCE=DoCannotHaveVisibilityDeclarations.fs
Expand Down

0 comments on commit f5f7f0f

Please sign in to comment.