Skip to content

Commit 9978a14

Browse files
authored
Enable f sharp70 (#13688)
* Update fsharp to version 7.0 and Package versions * update tets to F# 7.0 * fix fsharpqa tests * fix componentmodel tests * json * FSharp.Compiler.UnitTests * Fix cambridge suite tests * from end slicing * Delete temp * Delete temp2 * merge issue
1 parent 91e80c7 commit 9978a14

File tree

49 files changed

+1071
-853
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1071
-853
lines changed

FSharpBuild.Directory.Build.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
<DisableAutoSetFscCompilerPath>true</DisableAutoSetFscCompilerPath>
1414
</PropertyGroup>
1515

16+
<PropertyGroup Condition="'$(Configuration)' == 'Proto'">
17+
<FSCoreVersion>$(FSCoreShippedVersion)</FSCoreVersion>
18+
</PropertyGroup>
19+
1620
<PropertyGroup>
1721
<FSharpSourcesRoot>$(RepoRoot)src</FSharpSourcesRoot>
1822
<FSharpTestsRoot>$(RepoRoot)tests</FSharpTestsRoot>

eng/Versions.props

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
<PropertyGroup>
1414
<PreReleaseVersionLabel>beta</PreReleaseVersionLabel>
1515
<!-- F# Version components -->
16-
<FSMajorVersion>6</FSMajorVersion>
16+
<FSMajorVersion>7</FSMajorVersion>
1717
<FSMinorVersion>0</FSMinorVersion>
18-
<FSBuildVersion>6</FSBuildVersion>
18+
<FSBuildVersion>0</FSBuildVersion>
1919
<FSRevisionVersion>0</FSRevisionVersion>
2020
<!-- -->
2121
<!-- F# Language version -->
@@ -28,26 +28,27 @@
2828
<FSCoreReleaseNotesVersion>$(FSMajorVersion)-$(FSMinorVersion)-$(FSBuildVersion)</FSCoreReleaseNotesVersion>
2929
<FSCoreVersionPrefix>$(FSMajorVersion).$(FSMinorVersion).$(FSBuildVersion)</FSCoreVersionPrefix>
3030
<FSCoreVersion>$(FSMajorVersion).$(FSMinorVersion).0.0</FSCoreVersion>
31+
<FSCoreShippedVersion>6.0.0.0</FSCoreShippedVersion>
3132
<!-- -->
3233
<!-- FSharp.Compiler.Service version -->
33-
<FCSMajorVersion>41</FCSMajorVersion>
34-
<FCSMinorVersion>0</FCSMinorVersion>
35-
<FCSBuildVersion>6</FCSBuildVersion>
34+
<FCSMajorVersion>42</FCSMajorVersion>
35+
<FCSMinorVersion>7</FCSMinorVersion>
36+
<FCSBuildVersion>100</FCSBuildVersion>
3637
<FCSRevisionVersion>$(FSRevisionVersion)</FCSRevisionVersion>
3738
<FSharpCompilerServicePackageVersion>$(FCSMajorVersion).$(FCSMinorVersion).$(FCSBuildVersion)</FSharpCompilerServicePackageVersion>
3839
<FSharpCompilerServiceVersion>$(FCSMajorVersion).$(FCSMinorVersion).$(FCSBuildVersion).$(FCSRevisionVersion)</FSharpCompilerServiceVersion>
3940
<FSharpCompilerServiceReleaseNotesVersion>$(FCSMajorVersion)$(FCSMinorVersion)$(FCSBuildVersion)</FSharpCompilerServiceReleaseNotesVersion>
4041
<!-- -->
4142
<!-- The current published nuget package -->
42-
<FSharpCoreShippedPackageVersionValue>6.0.3</FSharpCoreShippedPackageVersionValue>
43+
<FSharpCoreShippedPackageVersionValue>6.0.5</FSharpCoreShippedPackageVersionValue>
4344
<!-- -->
4445
<!-- The pattern for specifying the preview package -->
4546
<FSharpCorePreviewPackageVersionValue>$(FSCorePackageVersionValue)-$(PreReleaseVersionLabel).*</FSharpCorePreviewPackageVersionValue>
4647
<!-- -->
4748
<!-- FSharp tools for Visual Studio version number -->
4849
<FSToolsMajorVersion>12</FSToolsMajorVersion>
4950
<FSToolsMinorVersion>0</FSToolsMinorVersion>
50-
<FSToolsBuildVersion>4</FSToolsBuildVersion>
51+
<FSToolsBuildVersion>5</FSToolsBuildVersion>
5152
<FSToolsRevisionVersion>$(FSRevisionVersion)</FSToolsRevisionVersion>
5253
<FSProductVersionPrefix>$(FSToolsMajorVersion).$(FSToolsMinorVersion).$(FSToolsBuildVersion)</FSProductVersionPrefix>
5354
<FSProductVersionReleaseNotesVersion>$(FSToolsMajorVersion)-$(FSToolsMinorVersion)-$(FSToolsBuildVersion)</FSProductVersionReleaseNotesVersion>

src/Compiler/Facilities/LanguageFeatures.fs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,16 @@ type LanguageVersion(versionText) =
6363
static let languageVersion47 = 4.7m
6464
static let languageVersion50 = 5.0m
6565
static let languageVersion60 = 6.0m
66+
static let languageVersion70 = 7.0m
6667
static let previewVersion = 9999m // Language version when preview specified
67-
static let defaultVersion = languageVersion60 // Language version when default specified
68+
static let defaultVersion = languageVersion70 // Language version when default specified
6869
static let latestVersion = defaultVersion // Language version when latest specified
69-
static let latestMajorVersion = languageVersion60 // Language version when latestmajor specified
70+
static let latestMajorVersion = languageVersion70 // Language version when latestmajor specified
7071

7172
static let validOptions = [| "preview"; "default"; "latest"; "latestmajor" |]
7273

7374
static let languageVersions =
74-
set [| languageVersion46; languageVersion47; languageVersion50; languageVersion60 |]
75+
set [| languageVersion46; languageVersion47; languageVersion50; languageVersion60; languageVersion70 |]
7576

7677
static let features =
7778
dict
@@ -110,17 +111,19 @@ type LanguageVersion(versionText) =
110111
LanguageFeature.AttributesToRightOfModuleKeyword, languageVersion60
111112
LanguageFeature.DelegateTypeNameResolutionFix, languageVersion60
112113

114+
// F# 7.0
115+
LanguageFeature.MLCompatRevisions, languageVersion70
116+
LanguageFeature.BetterExceptionPrinting, languageVersion70
117+
LanguageFeature.ReallyLongLists, languageVersion70
118+
LanguageFeature.ErrorOnDeprecatedRequireQualifiedAccess, languageVersion70
119+
LanguageFeature.RequiredPropertiesSupport, languageVersion70
120+
LanguageFeature.InitPropertiesSupport, languageVersion70
121+
LanguageFeature.LowercaseDUWhenRequireQualifiedAccess, languageVersion70
122+
LanguageFeature.InterfacesWithAbstractStaticMembers, languageVersion70
123+
LanguageFeature.SelfTypeConstraints, languageVersion70
124+
113125
// F# preview
114126
LanguageFeature.FromEndSlicing, previewVersion
115-
LanguageFeature.MLCompatRevisions, previewVersion
116-
LanguageFeature.BetterExceptionPrinting, previewVersion
117-
LanguageFeature.ReallyLongLists, previewVersion
118-
LanguageFeature.ErrorOnDeprecatedRequireQualifiedAccess, previewVersion
119-
LanguageFeature.RequiredPropertiesSupport, previewVersion
120-
LanguageFeature.InitPropertiesSupport, previewVersion
121-
LanguageFeature.LowercaseDUWhenRequireQualifiedAccess, previewVersion
122-
LanguageFeature.InterfacesWithAbstractStaticMembers, previewVersion
123-
LanguageFeature.SelfTypeConstraints, previewVersion
124127
]
125128

126129
static let defaultLanguageVersion = LanguageVersion("default")
@@ -138,6 +141,8 @@ type LanguageVersion(versionText) =
138141
| "5" -> languageVersion50
139142
| "6.0"
140143
| "6" -> languageVersion60
144+
| "7.0"
145+
| "7" -> languageVersion70
141146
| _ -> 0m
142147

143148
let specified = getVersionFromString versionText

src/FSharp.Build/FSharp.Build.fsproj

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,7 @@
5656
<None Include="Microsoft.FSharp.Overrides.NetSdk.targets" CopyToOutputDirectory="PreserveNewest" />
5757
</ItemGroup>
5858

59-
<ItemGroup Condition="'$(Configuration)' == 'Proto' and '$(DotNetBuildFromSource)' != 'true'">
60-
<!--
61-
The FSharp.Build built here may be loaded directly into a shipped Visual Studio, to that end, we cannot
62-
rely on new API's just being added to FSharp.Core.
63-
-->
64-
<PackageReference Include="FSharp.Core" Version="$(FSharpCoreShippedPackageVersionValue)" />
65-
</ItemGroup>
66-
67-
<ItemGroup Condition="'$(Configuration)' != 'Proto' or '$(DotNetBuildFromSource)' == 'true'">
59+
<ItemGroup Condition="">
6860
<ProjectReference Include="$(MSBuildThisFileDirectory)..\FSharp.Core\FSharp.Core.fsproj" />
6961
</ItemGroup>
7062

src/FSharp.Core/prim-types.fs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4107,7 +4107,6 @@ namespace Microsoft.FSharp.Collections
41074107
let start = if i < 0 then 0 else i
41084108
PrivateListHelpers.sliceTake (j - start) (PrivateListHelpers.sliceSkip start l)
41094109

4110-
[<Experimental(ExperimentalAttributeMessages.RequiresPreview)>]
41114110
member l.GetReverseIndex(_: int, offset: int) =
41124111
l.Length - offset - 1
41134112

@@ -6901,10 +6900,8 @@ namespace Microsoft.FSharp.Core
69016900
if n >= 0 then PowDecimal x n else 1.0M / PowDecimal x n)
69026901

69036902
[<AutoOpen>]
6904-
[<Experimental(ExperimentalAttributeMessages.RequiresPreview)>]
69056903
module ArrayExtensions =
69066904
type ``[,,,]``<'T> with
6907-
[<Experimental(ExperimentalAttributeMessages.RequiresPreview)>]
69086905
member arr.GetReverseIndex(dim: int, offset: int) =
69096906
let len =
69106907
match dim with
@@ -6917,7 +6914,6 @@ namespace Microsoft.FSharp.Core
69176914
len - offset - 1
69186915

69196916
type ``[,,]``<'T> with
6920-
[<Experimental(ExperimentalAttributeMessages.RequiresPreview)>]
69216917
member arr.GetReverseIndex(dim: int, offset: int) =
69226918
let len =
69236919
match dim with
@@ -6929,7 +6925,6 @@ namespace Microsoft.FSharp.Core
69296925
len - offset - 1
69306926

69316927
type ``[,]``<'T> with
6932-
[<Experimental(ExperimentalAttributeMessages.RequiresPreview)>]
69336928
member arr.GetReverseIndex(dim: int, offset: int) =
69346929
let len =
69356930
match dim with
@@ -6940,11 +6935,9 @@ namespace Microsoft.FSharp.Core
69406935
len - offset - 1
69416936

69426937
type ``[]``<'T> with
6943-
[<Experimental(ExperimentalAttributeMessages.RequiresPreview)>]
69446938
member arr.GetReverseIndex (_: int, offset: int) = arr.Length - offset - 1
69456939

69466940
type String with
6947-
[<Experimental(ExperimentalAttributeMessages.RequiresPreview)>]
69486941
member str.GetReverseIndex (_: int, offset: int) = str.Length - offset - 1
69496942

69506943
namespace Microsoft.FSharp.Control

src/FSharp.Core/prim-types.fsi

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2555,7 +2555,6 @@ namespace Microsoft.FSharp.Collections
25552555
/// <param name="offset">The offset from the end.</param>
25562556
///
25572557
/// <returns>The corresponding index from the start.</returns>
2558-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
25592558
member GetReverseIndex: rank: int * offset: int -> int
25602559

25612560
/// <summary>Returns a list with <c>head</c> as its first element and <c>tail</c> as its subsequent elements</summary>
@@ -4601,7 +4600,6 @@ namespace Microsoft.FSharp.Core
46014600
/// <summary>Contains extension methods to allow the use of F# indexer notation with arrays.
46024601
/// This module is automatically opened in all F# code.</summary>
46034602
[<AutoOpen>]
4604-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
46054603
module ArrayExtensions =
46064604
type ``[,,,]``<'T> with
46074605
/// <summary>Get the index for the element offset elements away from the end of the collection.</summary>
@@ -4610,7 +4608,6 @@ namespace Microsoft.FSharp.Core
46104608
/// <param name="offset">The offset from the end.</param>
46114609
///
46124610
/// <returns>The corresponding index from the start.</returns>
4613-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
46144611
member GetReverseIndex: rank: int * offset: int -> int
46154612

46164613
type ``[,,]``<'T> with
@@ -4620,7 +4617,6 @@ namespace Microsoft.FSharp.Core
46204617
/// <param name="offset">The offset from the end.</param>
46214618
///
46224619
/// <returns>The corresponding index from the start.</returns>
4623-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
46244620
member GetReverseIndex: rank: int * offset: int -> int
46254621

46264622
type ``[,]``<'T> with
@@ -4630,7 +4626,6 @@ namespace Microsoft.FSharp.Core
46304626
/// <param name="offset">The offset from the end.</param>
46314627
///
46324628
/// <returns>The corresponding index from the start.</returns>
4633-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
46344629
member GetReverseIndex: rank: int * offset: int -> int
46354630

46364631
type ``[]``<'T> with
@@ -4640,7 +4635,6 @@ namespace Microsoft.FSharp.Core
46404635
/// <param name="offset">The offset from the end.</param>
46414636
///
46424637
/// <returns>The corresponding index from the start.</returns>
4643-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
46444638
member GetReverseIndex: rank: int * offset: int -> int
46454639

46464640
type System.String with
@@ -4650,7 +4644,6 @@ namespace Microsoft.FSharp.Core
46504644
/// <param name="offset">The offset from the end.</param>
46514645
///
46524646
/// <returns>The corresponding index from the start.</returns>
4653-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
46544647
member GetReverseIndex: rank: int * offset: int -> int
46554648

46564649
/// <summary>A module of compiler intrinsic functions for efficient implementations of F# integer ranges

src/FSharp.Core/tasks.fsi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ namespace Microsoft.FSharp.Control
1515
/// The extra data stored in ResumableStateMachine for tasks
1616
/// </summary>
1717
[<Struct; NoComparison; NoEquality>]
18-
[<Experimental("Experimental library feature, requires '--langversion:preview'")>]
1918
[<CompilerMessage("This construct is for use by compiled F# code and should not be used directly", 1204, IsHidden=true)>]
2019
type TaskStateMachineData<'T> =
2120

tests/FSharp.Compiler.ComponentTests/Conformance/BasicTypeAndModuleDefinitions/ModuleDefinitions/ModuleDefinitions.fs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ module ModuleDefinitions =
244244
let ``Production_OCamlCompat_fsx`` compilation =
245245
compilation
246246
|> withOcamlCompat
247+
|> withLangVersion50
247248
|> verifyCompileAndRun
248249
|> shouldSucceed
249250

@@ -271,13 +272,13 @@ module ModuleDefinitions =
271272
|> verifyCompile
272273
|> shouldFail
273274
|> withDiagnostics [
274-
(Warning 62, Line 14, Col 13, Line 14, Col 19, "This construct is for ML compatibility. The syntax 'module ... = struct .. end' is not used in F# code. Consider using 'module ... = begin .. end'. You can disable this warning by using '--mlcompatibility' or '--nowarn:62'.")
275-
(Warning 62, Line 18, Col 13, Line 18, Col 19, "This construct is for ML compatibility. The syntax 'module ... = struct .. end' is not used in F# code. Consider using 'module ... = begin .. end'. You can disable this warning by using '--mlcompatibility' or '--nowarn:62'.")
276-
(Warning 62, Line 22, Col 13, Line 22, Col 19, "This construct is for ML compatibility. The syntax 'module ... = struct .. end' is not used in F# code. Consider using 'module ... = begin .. end'. You can disable this warning by using '--mlcompatibility' or '--nowarn:62'.")
277-
(Warning 62, Line 26, Col 13, Line 26, Col 19, "This construct is for ML compatibility. The syntax 'module ... = struct .. end' is not used in F# code. Consider using 'module ... = begin .. end'. You can disable this warning by using '--mlcompatibility' or '--nowarn:62'.")
278-
(Warning 62, Line 30, Col 13, Line 30, Col 19, "This construct is for ML compatibility. The syntax 'module ... = struct .. end' is not used in F# code. Consider using 'module ... = begin .. end'. You can disable this warning by using '--mlcompatibility' or '--nowarn:62'.")
279-
(Warning 62, Line 35, Col 13, Line 35, Col 19, "This construct is for ML compatibility. The syntax 'module ... = struct .. end' is not used in F# code. Consider using 'module ... = begin .. end'. You can disable this warning by using '--mlcompatibility' or '--nowarn:62'.")
280-
(Warning 62, Line 39, Col 13, Line 39, Col 19, "This construct is for ML compatibility. The syntax 'module ... = struct .. end' is not used in F# code. Consider using 'module ... = begin .. end'. You can disable this warning by using '--mlcompatibility' or '--nowarn:62'.")
275+
(Error 62, Line 14, Col 13, Line 14, Col 19, "This construct is deprecated. The use of 'module M = struct ... end ' was deprecated in F# 2.0 and is no longer supported. Remove the 'struct' and 'end' and use indentation instead. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'.")
276+
(Error 62, Line 18, Col 13, Line 18, Col 19, "This construct is deprecated. The use of 'module M = struct ... end ' was deprecated in F# 2.0 and is no longer supported. Remove the 'struct' and 'end' and use indentation instead. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'.")
277+
(Error 62, Line 22, Col 13, Line 22, Col 19, "This construct is deprecated. The use of 'module M = struct ... end ' was deprecated in F# 2.0 and is no longer supported. Remove the 'struct' and 'end' and use indentation instead. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'.")
278+
(Error 62, Line 26, Col 13, Line 26, Col 19, "This construct is deprecated. The use of 'module M = struct ... end ' was deprecated in F# 2.0 and is no longer supported. Remove the 'struct' and 'end' and use indentation instead. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'.")
279+
(Error 62, Line 30, Col 13, Line 30, Col 19, "This construct is deprecated. The use of 'module M = struct ... end ' was deprecated in F# 2.0 and is no longer supported. Remove the 'struct' and 'end' and use indentation instead. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'.")
280+
(Error 62, Line 35, Col 13, Line 35, Col 19, "This construct is deprecated. The use of 'module M = struct ... end ' was deprecated in F# 2.0 and is no longer supported. Remove the 'struct' and 'end' and use indentation instead. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'.")
281+
(Error 62, Line 39, Col 13, Line 39, Col 19, "This construct is deprecated. The use of 'module M = struct ... end ' was deprecated in F# 2.0 and is no longer supported. Remove the 'struct' and 'end' and use indentation instead. You can enable this feature by using '--langversion:5.0' and '--mlcompatibility'.")
281282
]
282283

283284
//

tests/FSharp.Compiler.ComponentTests/Conformance/DeclarationElements/UseBindings/UseBindings.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module UseBindings =
1212
let ``UseBindings - UseBindingDiscard01_fs - Current LangVersion`` compilation =
1313
compilation
1414
|> asFsx
15-
|> withOptions ["--langversion:preview"]
15+
|> withLangVersion60
1616
|> compile
1717
|> shouldSucceed
1818
|> ignore
@@ -57,6 +57,6 @@ if ctorCalls <> 1 then
5757
5858
"""
5959
|> asExe
60-
|> withLangVersionPreview
60+
|> withLangVersion60
6161
|> compileAndRun
6262
|> shouldSucceed

tests/FSharp.Compiler.ComponentTests/Conformance/InferenceProcedures/RecursiveSafetyAnalysis/RecursiveSafetyAnalysis.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module RecursiveSafetyAnalysis =
1919
let ``E_CyclicReference01_fs`` compilation =
2020
compilation
2121
|> withOptions ["--mlcompatibility"; "--flaterrors"]
22+
|> withLangVersion50
2223
|> asExe
2324
|> compile
2425
|> shouldFail

0 commit comments

Comments
 (0)