Skip to content

Commit 66d5073

Browse files
authored
Merge pull request #931 from baronfel/integrate
integrate some quality-of-life changes from upstream
2 parents a22b011 + 5b4d376 commit 66d5073

Some content is hidden

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

46 files changed

+1135
-605
lines changed

Language-Version-History.md

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
Features Added in F# Language Versions
2+
====================
3+
4+
# [F# 1.0](https://docs.microsoft.com/en-us/archive/blogs/dsyme/welcome-to-dons-f-blog)
5+
6+
- Discriminated unions
7+
- Records
8+
- Tuples
9+
- Pattern matching
10+
- Type abbreviations
11+
- Object expressions
12+
- Structs
13+
- Signature files
14+
- Imperative programming
15+
- Modules (no functors)
16+
- Nested modules
17+
- .NET Interoperability
18+
19+
# [F# 1.1](https://docs.microsoft.com/en-us/archive/blogs/dsyme/a-taste-of-whats-new-in-f-1-1)
20+
21+
- Interactive environment
22+
- Object programming
23+
- Encapsulation Extensions
24+
25+
# [F# 2.0](https://fsharp.org/specs/language-spec/2.0/FSharpSpec-2.0-April-2012.pdf)
26+
27+
- Active patterns
28+
- Units of measure
29+
- Sequence expressions
30+
- Asynchronous programming
31+
- Agent programming
32+
- Extension members
33+
- Named arguments
34+
- Optional arguments
35+
- Array slicing
36+
- Quotations
37+
- Native interoperability
38+
- Computation expressions
39+
40+
# [F# 3.0](https://fsharp.org/specs/language-spec/3.0/FSharpSpec-3.0-final.pdf)
41+
42+
- Type providers
43+
- LINQ query expressions
44+
- CLIMutable attribute
45+
- Triple-quoted strings
46+
- Auto-properties
47+
- Provided units-of-measure
48+
49+
# [F# 3.1](https://fsharp.org/specs/language-spec/3.1/FSharpSpec-3.1-final.pdf)
50+
51+
- Named union type fields
52+
- Extensions to array slicing
53+
- Type inference enhancements
54+
55+
# [F# 4.0](https://fsharp.org/specs/language-spec/4.0/FSharpSpec-4.0-final.pdf)
56+
57+
- `printf` on unitized values
58+
- Extension property initializers
59+
- Non-null provided types
60+
- Primary constructors as functions
61+
- Static parameters for provided methods
62+
- `printf` interpolation
63+
- Extended `#if` grammar
64+
- Multiple interface instantiations
65+
- Optional type args
66+
- Params dictionaries
67+
68+
# [F# 4.1](https://fsharp.org/specs/language-spec/4.1/FSharpSpec-4.1-latest.pdf)
69+
70+
- Struct tuples which inter-operate with C# tuples
71+
- Struct annotations for Records
72+
- Struct annotations for Single-case Discriminated Unions
73+
- Underscores in numeric literals
74+
- Caller info argument attributes
75+
- Result type and some basic Result functions
76+
- Mutually referential types and modules within the same file
77+
- Implicit `Module` syntax on modules with shared name as type
78+
- Byref returns, supporting consuming C# `ref`-returning methods
79+
- Error message improvements
80+
- Support for `fixed`
81+
82+
# [F# 4.5](https://docs.microsoft.com/en-us/dotnet/fsharp/whats-new/fsharp-45)
83+
84+
- Versioning alignment of binary, package, and language
85+
- Support for `Span<'T>` and related types
86+
- Ability to produce `byref` returns
87+
- The `voidptr` type
88+
- The `inref<'T>` and `outref<'T>` types to represent readonly and write-only `byref`s
89+
- `IsByRefLike` structs
90+
- `IsReadOnly` structs
91+
- Extension method support for `byref<'T>`/`inref<'T>`/`outref<'T>`
92+
- `match!` keyword in computation expressions
93+
- Relaxed upcast with `yield` in F# sequence/list/array expressions
94+
- Relaxed indentation with list and array expressions
95+
- Enumeration cases emitted as public
96+
97+
# [F# 4.6](https://docs.microsoft.com/en-us/dotnet/fsharp/whats-new/fsharp-46)
98+
99+
- Anonymous records
100+
- `ValueOption` module functions
101+
102+
# [F# 4.7](https://docs.microsoft.com/en-us/dotnet/fsharp/whats-new/fsharp-47)
103+
104+
- Compiler support for `LangVersion`
105+
- Implicit `yield`s
106+
- No more required double underscore (wildcard identifier)
107+
- Indentation relaxations for parameters passed to constructors and static methods

clean.sh

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ DEAD_DIRS=(
2424
"tests/fsharp/tests.fs"
2525
"tests/fsharp/typecheck"
2626
"tests/fsharpqa"
27+
"tests/scripts"
2728
"VisualFSharp.sln"
2829
"vsintegration"
2930
)

eng/Build.ps1

+3-2
Original file line numberDiff line numberDiff line change
@@ -363,16 +363,17 @@ try {
363363

364364
if ($testFSharpQA -and -not $noVisualStudio) {
365365
Push-Location "$RepoRoot\tests\fsharpqa\source"
366+
$nugetPackages = Get-PackagesDir
366367
$resultsRoot = "$ArtifactsDir\TestResults\$configuration"
367368
$resultsLog = "test-net40-fsharpqa-results.log"
368369
$errorLog = "test-net40-fsharpqa-errors.log"
369370
$failLog = "test-net40-fsharpqa-errors"
370-
$perlPackageRoot = "$env:USERPROFILE\.nuget\packages\StrawberryPerl\5.28.0.1";
371+
$perlPackageRoot = "$nugetPackages\StrawberryPerl\5.28.0.1";
371372
$perlExe = "$perlPackageRoot\bin\perl.exe"
372373
Create-Directory $resultsRoot
373374
UpdatePath
374375
$env:HOSTED_COMPILER = 1
375-
$env:CSC_PIPE = "$env:USERPROFILE\.nuget\packages\Microsoft.Net.Compilers\2.7.0\tools\csc.exe"
376+
$env:CSC_PIPE = "$nugetPackages\Microsoft.Net.Compilers\2.7.0\tools\csc.exe"
376377
$env:FSCOREDLLPATH = "$ArtifactsDir\bin\fsc\$configuration\net472\FSharp.Core.dll"
377378
$env:LINK_EXE = "$RepoRoot\tests\fsharpqa\testenv\bin\link\link.exe"
378379
$env:OSARCH = $env:PROCESSOR_ARCHITECTURE

eng/Version.Details.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<ProductDependencies>
44
</ProductDependencies>
55
<ToolsetDependencies>
6-
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.20113.5">
6+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.20124.2">
77
<Uri>https://github.com/dotnet/arcade</Uri>
8-
<Sha>15f00efd583eab4372b2e9ca25bd80ace5b119ad</Sha>
8+
<Sha>0b8ce7c1c078eefb4cbc4d7e67ffc02f1f73382d</Sha>
99
</Dependency>
1010
</ToolsetDependencies>
1111
</Dependencies>

eng/Versions.props

-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
<SystemSecurityClaimsVersion>4.3.0</SystemSecurityClaimsVersion>
9090
<SystemSecurityCryptographyAlgorithmsVersion>4.3.0</SystemSecurityCryptographyAlgorithmsVersion>
9191
<SystemSecurityPrincipalVersion>4.3.0</SystemSecurityPrincipalVersion>
92-
<SystemThreadingTasksDataflowPackageVersion>4.6.0</SystemThreadingTasksDataflowPackageVersion>
9392
<SystemThreadingTasksParallelVersion>4.3.0</SystemThreadingTasksParallelVersion>
9493
<SystemThreadingTasksDataflow>4.11.0</SystemThreadingTasksDataflow>
9594
<SystemThreadingThreadVersion>4.3.0</SystemThreadingThreadVersion>

fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj

+16-4
Original file line numberDiff line numberDiff line change
@@ -525,11 +525,23 @@
525525
<Compile Include="$(FSharpSourcesRoot)/fsharp/DotNetFrameworkDependencies.fs">
526526
<Link>Driver\DotNetFrameworkDependencies.fs</Link>
527527
</Compile>
528-
<Compile Include="$(FSharpSourcesRoot)/fsharp/Interactive.DependencyManager/DependencyManager.fsi">
529-
<Link>Driver/DependencyManager.fsi</Link>
528+
<Compile Include="$(FSharpSourcesRoot)/fsharp/Interactive.DependencyManager/AssemblyResolveHandler.fsi">
529+
<Link>Driver\AssemblyResolveHandler.fsi</Link>
530530
</Compile>
531-
<Compile Include="$(FSharpSourcesRoot)/fsharp/Interactive.DependencyManager/DependencyManager.fs">
532-
<Link>Driver/DependencyManager.fs</Link>
531+
<Compile Include="$(FSharpSourcesRoot)/fsharp/Interactive.DependencyManager/AssemblyResolveHandler.fs">
532+
<Link>Driver\AssemblyResolveHandler.fs</Link>
533+
</Compile>
534+
<Compile Include="$(FSharpSourcesRoot)/fsharp/Interactive.DependencyManager/NativeDllResolveHandler.fsi">
535+
<Link>Driver\NativeDllResolveHandler.fsi</Link>
536+
</Compile>
537+
<Compile Include="$(FSharpSourcesRoot)/fsharp/Interactive.DependencyManager/NativeDllResolveHandler.fs">
538+
<Link>Driver\NativeDllResolveHandler.fs</Link>
539+
</Compile>
540+
<Compile Include="$(FSharpSourcesRoot)/fsharp/Interactive.DependencyManager/DependencyProvider.fsi">
541+
<Link>Driver/DependencyProvider.fsi</Link>
542+
</Compile>
543+
<Compile Include="$(FSharpSourcesRoot)/fsharp/Interactive.DependencyManager/DependencyProvider.fs">
544+
<Link>Driver/DependencyProvider.fs</Link>
533545
</Compile>
534546
<Compile Include="$(FSharpSourcesRoot)/fsharp/CompileOps.fsi">
535547
<Link>Driver/CompileOps.fsi</Link>

fcs/RELEASE_NOTES.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
#### 34.1.1
2+
3+
From dotnet/fsharp:3777cd4d8..836da28c0:
4+
5+
* Slight tweaks to error messages around numeric literals (Thanks @Happypig375)
6+
* Deny taking native address of an immutable local value (Thanks @TIHan)
7+
* Fixes to reported ranges for wildcard self-identifiers, module abbreviations, nested modules, attributes, nested types, and fields (Thanks @auduchinok)
8+
* Better compiler error recovery for errors in constructor expressions (Thanks @auduchinok)
9+
* Fix handling of F# Options in C# members with regards to nullable type interop (Thanks @TIHan)
10+
* Move dependency handling of native dlls to the DependencyManager (Thanks @KevinRansom)
11+
112
#### 34.1.0
213

314
From dotnet/fsharp:3af8959b6..9d69b49b7:

global.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111
},
1212
"msbuild-sdks": {
13-
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20113.5",
13+
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20124.2",
1414
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
1515
}
1616
}

src/fsharp/CompileOps.fs

+53-28
Original file line numberDiff line numberDiff line change
@@ -2199,7 +2199,7 @@ type TcConfigBuilder =
21992199
mutable productNameForBannerText: string
22002200
/// show the MS (c) notice, e.g. with help or fsi?
22012201
mutable showBanner: bool
2202-
2202+
22032203
/// show times between passes?
22042204
mutable showTimes: bool
22052205
mutable showLoadedAssemblies: bool
@@ -2229,7 +2229,7 @@ type TcConfigBuilder =
22292229
mutable emitDebugInfoInQuotations: bool
22302230

22312231
mutable exename: string option
2232-
2232+
22332233
// If true - the compiler will copy FSharp.Core.dll along the produced binaries
22342234
mutable copyFSharpCore: CopyFSharpCoreFlag
22352235

@@ -2390,9 +2390,24 @@ type TcConfigBuilder =
23902390
noConditionalErasure = false
23912391
pathMap = PathMap.empty
23922392
langVersion = LanguageVersion("default")
2393-
dependencyProvider = new DependencyProvider()
2393+
dependencyProvider = Unchecked.defaultof<DependencyProvider>
23942394
}
23952395

2396+
// Directories to start probing in
2397+
// Algorithm:
2398+
// Search for native libraries using:
2399+
// 1. Include directories
2400+
// 2. compilerToolPath directories
2401+
// 3. reference dll's
2402+
// 4. The implicit include directory
2403+
member private tcConfigB.nativeProbingRoots () =
2404+
seq {
2405+
yield! tcConfigB.includes
2406+
yield! tcConfigB.compilerToolPaths
2407+
yield! (tcConfigB.referencedDLLs |> Seq.map(fun ref -> Path.GetDirectoryName(ref.Text)))
2408+
yield tcConfigB.implicitIncludeDir
2409+
} |> Seq.distinct
2410+
23962411
static member CreateNew(legacyReferenceResolver, defaultFSharpBinariesDir, reduceMemoryUsage, implicitIncludeDir,
23972412
isInteractive, isInvalidationSupported, defaultCopyFSharpCore, tryGetMetadataSnapshot) =
23982413

@@ -2401,17 +2416,20 @@ type TcConfigBuilder =
24012416
if (String.IsNullOrEmpty defaultFSharpBinariesDir) then
24022417
failwith "Expected a valid defaultFSharpBinariesDir"
24032418

2404-
{ TcConfigBuilder.Initial with
2405-
implicitIncludeDir = implicitIncludeDir
2406-
defaultFSharpBinariesDir = defaultFSharpBinariesDir
2407-
reduceMemoryUsage = reduceMemoryUsage
2408-
legacyReferenceResolver = legacyReferenceResolver
2409-
isInteractive = isInteractive
2410-
isInvalidationSupported = isInvalidationSupported
2411-
copyFSharpCore = defaultCopyFSharpCore
2412-
tryGetMetadataSnapshot = tryGetMetadataSnapshot
2413-
useFsiAuxLib = isInteractive
2414-
}
2419+
let tcConfigBuilder =
2420+
{ TcConfigBuilder.Initial with
2421+
implicitIncludeDir = implicitIncludeDir
2422+
defaultFSharpBinariesDir = defaultFSharpBinariesDir
2423+
reduceMemoryUsage = reduceMemoryUsage
2424+
legacyReferenceResolver = legacyReferenceResolver
2425+
isInteractive = isInteractive
2426+
isInvalidationSupported = isInvalidationSupported
2427+
copyFSharpCore = defaultCopyFSharpCore
2428+
tryGetMetadataSnapshot = tryGetMetadataSnapshot
2429+
useFsiAuxLib = isInteractive
2430+
}
2431+
tcConfigBuilder.dependencyProvider <- new DependencyProvider(NativeResolutionProbe(tcConfigBuilder.nativeProbingRoots))
2432+
tcConfigBuilder
24152433

24162434
member tcConfigB.ResolveSourceFile(m, nm, pathLoadedFrom) =
24172435
use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind BuildPhase.Parameter
@@ -4964,10 +4982,13 @@ let ProcessMetaCommandsFromInput
49644982
if not canHaveScriptMetaCommands then
49654983
errorR(HashReferenceNotAllowedInNonScript m)
49664984

4967-
let reportError errorType error =
4968-
match errorType with
4969-
| ErrorReportType.Warning -> warning(Error(error,m))
4970-
| ErrorReportType.Error -> errorR(Error(error, m))
4985+
let reportError =
4986+
let report errorType err msg =
4987+
let error = err, msg
4988+
match errorType with
4989+
| ErrorReportType.Warning -> warning(Error(error, m))
4990+
| ErrorReportType.Error -> errorR(Error(error, m))
4991+
ResolvingErrorReport (report)
49714992

49724993
match args with
49734994
| [path] ->
@@ -5257,10 +5278,13 @@ module ScriptPreprocessClosure =
52575278
match packageManagerLines with
52585279
| [] -> ()
52595280
| (_, _, m)::_ ->
5260-
let reportError errorType error =
5261-
match errorType with
5262-
| ErrorReportType.Warning -> warning(Error(error,m))
5263-
| ErrorReportType.Error -> errorR(Error(error, m))
5281+
let reportError =
5282+
let report errorType err msg =
5283+
let error = err, msg
5284+
match errorType with
5285+
| ErrorReportType.Warning -> warning(Error(error, m))
5286+
| ErrorReportType.Error -> errorR(Error(error, m))
5287+
ResolvingErrorReport (report)
52645288

52655289
match origTcConfig.packageManagerLines |> Map.tryFind packageManagerKey with
52665290
| Some oldDependencyManagerLines when oldDependencyManagerLines = packageManagerLines -> ()
@@ -5273,22 +5297,23 @@ module ScriptPreprocessClosure =
52735297
| dependencyManager ->
52745298
let inline snd3 (_, b, _) = b
52755299
let packageManagerTextLines = packageManagerLines |> List.map snd3
5276-
match tcConfig.dependencyProvider.Resolve(dependencyManager, tcConfig.implicitIncludeDir, mainFile, scriptName, ".fsx", packageManagerTextLines, reportError, executionTfm) with
5277-
| true, _references, generatedScripts, additionalIncludeFolders ->
5300+
let result = tcConfig.dependencyProvider.Resolve(dependencyManager, ".fsx", packageManagerTextLines, reportError, executionTfm, tcConfig.implicitIncludeDir, mainFile, scriptName)
5301+
match result.Success with
5302+
| true ->
52785303
// Resolution produced no errors
5279-
if not (Seq.isEmpty additionalIncludeFolders) then
5304+
if not (Seq.isEmpty result.Roots) then
52805305
let tcConfigB = tcConfig.CloneOfOriginalBuilder
5281-
for folder in additionalIncludeFolders do
5306+
for folder in result.Roots do
52825307
tcConfigB.AddIncludePath(m, folder, "")
52835308
tcConfigB.packageManagerLines <- tcConfigB.packageManagerLines |> Map.map(fun _ l -> l |> List.map(fun (_, p, m) -> true, p, m))
52845309
tcConfig <- TcConfig.Create(tcConfigB, validate=false)
5285-
for script in generatedScripts do
5310+
for script in result.SourceFiles do
52865311
let scriptText = File.ReadAllText script
52875312
loadScripts.Add script |> ignore
52885313
let iSourceText = SourceText.ofString scriptText
52895314
yield! loop (ClosureSource(script, m, iSourceText, true))
52905315

5291-
| false, _, _, _ ->
5316+
| false ->
52925317
// Resolution produced errors update packagerManagerLines entries to note these failure
52935318
// failed resolutions will no longer be considered
52945319
let tcConfigB = tcConfig.CloneOfOriginalBuilder

src/fsharp/FSComp.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ lexUnexpectedChar,"Unexpected character '%s'"
10211021
1153,lexInvalidFloat,"Invalid floating point number"
10221022
1154,lexOusideDecimal,"This number is outside the allowable range for decimal literals"
10231023
1155,lexOusideThirtyTwoBitFloat,"This number is outside the allowable range for 32-bit floats"
1024-
1156,lexInvalidNumericLiteral,"This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0b0001 (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger)."
1024+
1156,lexInvalidNumericLiteral,"This is not a valid numeric literal. Valid numeric literals include 1, 0x1, 0o1, 0b1, 1l (int), 1u (uint32), 1L (int64), 1UL (uint64), 1s (int16), 1y (sbyte), 1uy (byte), 1.0 (float), 1.0f (float32), 1.0m (decimal), 1I (BigInteger)."
10251025
1157,lexInvalidByteLiteral,"This is not a valid byte literal"
10261026
1158,lexInvalidCharLiteral,"This is not a valid character literal"
10271027
1159,lexThisUnicodeOnlyInStringLiterals,"This Unicode encoding is only valid in string literals"
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
# FSharp.Build resource strings
2+
cantReferenceSystemPackage,"PackageManager can not reference the System Package '%s'"
3+
requiresAValue,"%s requires a value"
4+
unableToApplyImplicitArgument,"Unable to apply implicit argument number %d"
25
notUsed,"Not used."

src/fsharp/FSharp.DependencyManager.Nuget/FSharp.DependencyManager.ProjectFile.fs

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ $(PACKAGEREFERENCES)
187187
<ItemGroup>
188188
<ResolvedReferenceLines Remove='*' />
189189
<ResolvedReferenceLines
190-
Condition="'$(SCRIPTEXTENSION)'=='.fsx' and '%(InteractiveResolvedFile.NugetPackageId)'!='FSharp.Core'"
190+
Condition="'$(SCRIPTEXTENSION)'=='.csx' or '%(InteractiveResolvedFile.NugetPackageId)'!='FSharp.Core'"
191191
Include='%(InteractiveResolvedFile.NugetPackageId),%(InteractiveResolvedFile.NugetPackageVersion),%(InteractiveResolvedFile.PackageRoot),%(InteractiveResolvedFile.FullPath),%(InteractiveResolvedFile.IsNotImplementationReference),%(InteractiveResolvedFile.InitializeSourcePath),%(NativeIncludeRoots.Path)'
192192
KeepDuplicates="false" />
193193
</ItemGroup>

0 commit comments

Comments
 (0)