Skip to content

integrate some quality-of-life changes from upstream #931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
107 changes: 107 additions & 0 deletions Language-Version-History.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
Features Added in F# Language Versions
====================

# [F# 1.0](https://docs.microsoft.com/en-us/archive/blogs/dsyme/welcome-to-dons-f-blog)

- Discriminated unions
- Records
- Tuples
- Pattern matching
- Type abbreviations
- Object expressions
- Structs
- Signature files
- Imperative programming
- Modules (no functors)
- Nested modules
- .NET Interoperability

# [F# 1.1](https://docs.microsoft.com/en-us/archive/blogs/dsyme/a-taste-of-whats-new-in-f-1-1)

- Interactive environment
- Object programming
- Encapsulation Extensions

# [F# 2.0](https://fsharp.org/specs/language-spec/2.0/FSharpSpec-2.0-April-2012.pdf)

- Active patterns
- Units of measure
- Sequence expressions
- Asynchronous programming
- Agent programming
- Extension members
- Named arguments
- Optional arguments
- Array slicing
- Quotations
- Native interoperability
- Computation expressions

# [F# 3.0](https://fsharp.org/specs/language-spec/3.0/FSharpSpec-3.0-final.pdf)

- Type providers
- LINQ query expressions
- CLIMutable attribute
- Triple-quoted strings
- Auto-properties
- Provided units-of-measure

# [F# 3.1](https://fsharp.org/specs/language-spec/3.1/FSharpSpec-3.1-final.pdf)

- Named union type fields
- Extensions to array slicing
- Type inference enhancements

# [F# 4.0](https://fsharp.org/specs/language-spec/4.0/FSharpSpec-4.0-final.pdf)

- `printf` on unitized values
- Extension property initializers
- Non-null provided types
- Primary constructors as functions
- Static parameters for provided methods
- `printf` interpolation
- Extended `#if` grammar
- Multiple interface instantiations
- Optional type args
- Params dictionaries

# [F# 4.1](https://fsharp.org/specs/language-spec/4.1/FSharpSpec-4.1-latest.pdf)

- Struct tuples which inter-operate with C# tuples
- Struct annotations for Records
- Struct annotations for Single-case Discriminated Unions
- Underscores in numeric literals
- Caller info argument attributes
- Result type and some basic Result functions
- Mutually referential types and modules within the same file
- Implicit `Module` syntax on modules with shared name as type
- Byref returns, supporting consuming C# `ref`-returning methods
- Error message improvements
- Support for `fixed`

# [F# 4.5](https://docs.microsoft.com/en-us/dotnet/fsharp/whats-new/fsharp-45)

- Versioning alignment of binary, package, and language
- Support for `Span<'T>` and related types
- Ability to produce `byref` returns
- The `voidptr` type
- The `inref<'T>` and `outref<'T>` types to represent readonly and write-only `byref`s
- `IsByRefLike` structs
- `IsReadOnly` structs
- Extension method support for `byref<'T>`/`inref<'T>`/`outref<'T>`
- `match!` keyword in computation expressions
- Relaxed upcast with `yield` in F# sequence/list/array expressions
- Relaxed indentation with list and array expressions
- Enumeration cases emitted as public

# [F# 4.6](https://docs.microsoft.com/en-us/dotnet/fsharp/whats-new/fsharp-46)

- Anonymous records
- `ValueOption` module functions

# [F# 4.7](https://docs.microsoft.com/en-us/dotnet/fsharp/whats-new/fsharp-47)

- Compiler support for `LangVersion`
- Implicit `yield`s
- No more required double underscore (wildcard identifier)
- Indentation relaxations for parameters passed to constructors and static methods
1 change: 1 addition & 0 deletions clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ DEAD_DIRS=(
"tests/fsharp/tests.fs"
"tests/fsharp/typecheck"
"tests/fsharpqa"
"tests/scripts"
"VisualFSharp.sln"
"vsintegration"
)
Expand Down
5 changes: 3 additions & 2 deletions eng/Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -363,16 +363,17 @@ try {

if ($testFSharpQA -and -not $noVisualStudio) {
Push-Location "$RepoRoot\tests\fsharpqa\source"
$nugetPackages = Get-PackagesDir
$resultsRoot = "$ArtifactsDir\TestResults\$configuration"
$resultsLog = "test-net40-fsharpqa-results.log"
$errorLog = "test-net40-fsharpqa-errors.log"
$failLog = "test-net40-fsharpqa-errors"
$perlPackageRoot = "$env:USERPROFILE\.nuget\packages\StrawberryPerl\5.28.0.1";
$perlPackageRoot = "$nugetPackages\StrawberryPerl\5.28.0.1";
$perlExe = "$perlPackageRoot\bin\perl.exe"
Create-Directory $resultsRoot
UpdatePath
$env:HOSTED_COMPILER = 1
$env:CSC_PIPE = "$env:USERPROFILE\.nuget\packages\Microsoft.Net.Compilers\2.7.0\tools\csc.exe"
$env:CSC_PIPE = "$nugetPackages\Microsoft.Net.Compilers\2.7.0\tools\csc.exe"
$env:FSCOREDLLPATH = "$ArtifactsDir\bin\fsc\$configuration\net472\FSharp.Core.dll"
$env:LINK_EXE = "$RepoRoot\tests\fsharpqa\testenv\bin\link\link.exe"
$env:OSARCH = $env:PROCESSOR_ARCHITECTURE
Expand Down
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<ProductDependencies>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.20113.5">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.20124.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>15f00efd583eab4372b2e9ca25bd80ace5b119ad</Sha>
<Sha>0b8ce7c1c078eefb4cbc4d7e67ffc02f1f73382d</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
1 change: 0 additions & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
<SystemSecurityClaimsVersion>4.3.0</SystemSecurityClaimsVersion>
<SystemSecurityCryptographyAlgorithmsVersion>4.3.0</SystemSecurityCryptographyAlgorithmsVersion>
<SystemSecurityPrincipalVersion>4.3.0</SystemSecurityPrincipalVersion>
<SystemThreadingTasksDataflowPackageVersion>4.6.0</SystemThreadingTasksDataflowPackageVersion>
<SystemThreadingTasksParallelVersion>4.3.0</SystemThreadingTasksParallelVersion>
<SystemThreadingTasksDataflow>4.11.0</SystemThreadingTasksDataflow>
<SystemThreadingThreadVersion>4.3.0</SystemThreadingThreadVersion>
Expand Down
20 changes: 16 additions & 4 deletions fcs/FSharp.Compiler.Service/FSharp.Compiler.Service.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -525,11 +525,23 @@
<Compile Include="$(FSharpSourcesRoot)/fsharp/DotNetFrameworkDependencies.fs">
<Link>Driver\DotNetFrameworkDependencies.fs</Link>
</Compile>
<Compile Include="$(FSharpSourcesRoot)/fsharp/Interactive.DependencyManager/DependencyManager.fsi">
<Link>Driver/DependencyManager.fsi</Link>
<Compile Include="$(FSharpSourcesRoot)/fsharp/Interactive.DependencyManager/AssemblyResolveHandler.fsi">
<Link>Driver\AssemblyResolveHandler.fsi</Link>
</Compile>
<Compile Include="$(FSharpSourcesRoot)/fsharp/Interactive.DependencyManager/DependencyManager.fs">
<Link>Driver/DependencyManager.fs</Link>
<Compile Include="$(FSharpSourcesRoot)/fsharp/Interactive.DependencyManager/AssemblyResolveHandler.fs">
<Link>Driver\AssemblyResolveHandler.fs</Link>
</Compile>
<Compile Include="$(FSharpSourcesRoot)/fsharp/Interactive.DependencyManager/NativeDllResolveHandler.fsi">
<Link>Driver\NativeDllResolveHandler.fsi</Link>
</Compile>
<Compile Include="$(FSharpSourcesRoot)/fsharp/Interactive.DependencyManager/NativeDllResolveHandler.fs">
<Link>Driver\NativeDllResolveHandler.fs</Link>
</Compile>
<Compile Include="$(FSharpSourcesRoot)/fsharp/Interactive.DependencyManager/DependencyProvider.fsi">
<Link>Driver/DependencyProvider.fsi</Link>
</Compile>
<Compile Include="$(FSharpSourcesRoot)/fsharp/Interactive.DependencyManager/DependencyProvider.fs">
<Link>Driver/DependencyProvider.fs</Link>
</Compile>
<Compile Include="$(FSharpSourcesRoot)/fsharp/CompileOps.fsi">
<Link>Driver/CompileOps.fsi</Link>
Expand Down
11 changes: 11 additions & 0 deletions fcs/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
#### 34.1.1

From dotnet/fsharp:3777cd4d8..836da28c0:

* Slight tweaks to error messages around numeric literals (Thanks @Happypig375)
* Deny taking native address of an immutable local value (Thanks @TIHan)
* Fixes to reported ranges for wildcard self-identifiers, module abbreviations, nested modules, attributes, nested types, and fields (Thanks @auduchinok)
* Better compiler error recovery for errors in constructor expressions (Thanks @auduchinok)
* Fix handling of F# Options in C# members with regards to nullable type interop (Thanks @TIHan)
* Move dependency handling of native dlls to the DependencyManager (Thanks @KevinRansom)

#### 34.1.0

From dotnet/fsharp:3af8959b6..9d69b49b7:
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20113.5",
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20124.2",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
}
}
81 changes: 53 additions & 28 deletions src/fsharp/CompileOps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2199,7 +2199,7 @@ type TcConfigBuilder =
mutable productNameForBannerText: string
/// show the MS (c) notice, e.g. with help or fsi?
mutable showBanner: bool

/// show times between passes?
mutable showTimes: bool
mutable showLoadedAssemblies: bool
Expand Down Expand Up @@ -2229,7 +2229,7 @@ type TcConfigBuilder =
mutable emitDebugInfoInQuotations: bool

mutable exename: string option

// If true - the compiler will copy FSharp.Core.dll along the produced binaries
mutable copyFSharpCore: CopyFSharpCoreFlag

Expand Down Expand Up @@ -2390,9 +2390,24 @@ type TcConfigBuilder =
noConditionalErasure = false
pathMap = PathMap.empty
langVersion = LanguageVersion("default")
dependencyProvider = new DependencyProvider()
dependencyProvider = Unchecked.defaultof<DependencyProvider>
}

// Directories to start probing in
// Algorithm:
// Search for native libraries using:
// 1. Include directories
// 2. compilerToolPath directories
// 3. reference dll's
// 4. The implicit include directory
member private tcConfigB.nativeProbingRoots () =
seq {
yield! tcConfigB.includes
yield! tcConfigB.compilerToolPaths
yield! (tcConfigB.referencedDLLs |> Seq.map(fun ref -> Path.GetDirectoryName(ref.Text)))
yield tcConfigB.implicitIncludeDir
} |> Seq.distinct

static member CreateNew(legacyReferenceResolver, defaultFSharpBinariesDir, reduceMemoryUsage, implicitIncludeDir,
isInteractive, isInvalidationSupported, defaultCopyFSharpCore, tryGetMetadataSnapshot) =

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

{ TcConfigBuilder.Initial with
implicitIncludeDir = implicitIncludeDir
defaultFSharpBinariesDir = defaultFSharpBinariesDir
reduceMemoryUsage = reduceMemoryUsage
legacyReferenceResolver = legacyReferenceResolver
isInteractive = isInteractive
isInvalidationSupported = isInvalidationSupported
copyFSharpCore = defaultCopyFSharpCore
tryGetMetadataSnapshot = tryGetMetadataSnapshot
useFsiAuxLib = isInteractive
}
let tcConfigBuilder =
{ TcConfigBuilder.Initial with
implicitIncludeDir = implicitIncludeDir
defaultFSharpBinariesDir = defaultFSharpBinariesDir
reduceMemoryUsage = reduceMemoryUsage
legacyReferenceResolver = legacyReferenceResolver
isInteractive = isInteractive
isInvalidationSupported = isInvalidationSupported
copyFSharpCore = defaultCopyFSharpCore
tryGetMetadataSnapshot = tryGetMetadataSnapshot
useFsiAuxLib = isInteractive
}
tcConfigBuilder.dependencyProvider <- new DependencyProvider(NativeResolutionProbe(tcConfigBuilder.nativeProbingRoots))
tcConfigBuilder

member tcConfigB.ResolveSourceFile(m, nm, pathLoadedFrom) =
use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind BuildPhase.Parameter
Expand Down Expand Up @@ -4964,10 +4982,13 @@ let ProcessMetaCommandsFromInput
if not canHaveScriptMetaCommands then
errorR(HashReferenceNotAllowedInNonScript m)

let reportError errorType error =
match errorType with
| ErrorReportType.Warning -> warning(Error(error,m))
| ErrorReportType.Error -> errorR(Error(error, m))
let reportError =
let report errorType err msg =
let error = err, msg
match errorType with
| ErrorReportType.Warning -> warning(Error(error, m))
| ErrorReportType.Error -> errorR(Error(error, m))
ResolvingErrorReport (report)

match args with
| [path] ->
Expand Down Expand Up @@ -5257,10 +5278,13 @@ module ScriptPreprocessClosure =
match packageManagerLines with
| [] -> ()
| (_, _, m)::_ ->
let reportError errorType error =
match errorType with
| ErrorReportType.Warning -> warning(Error(error,m))
| ErrorReportType.Error -> errorR(Error(error, m))
let reportError =
let report errorType err msg =
let error = err, msg
match errorType with
| ErrorReportType.Warning -> warning(Error(error, m))
| ErrorReportType.Error -> errorR(Error(error, m))
ResolvingErrorReport (report)

match origTcConfig.packageManagerLines |> Map.tryFind packageManagerKey with
| Some oldDependencyManagerLines when oldDependencyManagerLines = packageManagerLines -> ()
Expand All @@ -5273,22 +5297,23 @@ module ScriptPreprocessClosure =
| dependencyManager ->
let inline snd3 (_, b, _) = b
let packageManagerTextLines = packageManagerLines |> List.map snd3
match tcConfig.dependencyProvider.Resolve(dependencyManager, tcConfig.implicitIncludeDir, mainFile, scriptName, ".fsx", packageManagerTextLines, reportError, executionTfm) with
| true, _references, generatedScripts, additionalIncludeFolders ->
let result = tcConfig.dependencyProvider.Resolve(dependencyManager, ".fsx", packageManagerTextLines, reportError, executionTfm, tcConfig.implicitIncludeDir, mainFile, scriptName)
match result.Success with
| true ->
// Resolution produced no errors
if not (Seq.isEmpty additionalIncludeFolders) then
if not (Seq.isEmpty result.Roots) then
let tcConfigB = tcConfig.CloneOfOriginalBuilder
for folder in additionalIncludeFolders do
for folder in result.Roots do
tcConfigB.AddIncludePath(m, folder, "")
tcConfigB.packageManagerLines <- tcConfigB.packageManagerLines |> Map.map(fun _ l -> l |> List.map(fun (_, p, m) -> true, p, m))
tcConfig <- TcConfig.Create(tcConfigB, validate=false)
for script in generatedScripts do
for script in result.SourceFiles do
let scriptText = File.ReadAllText script
loadScripts.Add script |> ignore
let iSourceText = SourceText.ofString scriptText
yield! loop (ClosureSource(script, m, iSourceText, true))

| false, _, _, _ ->
| false ->
// Resolution produced errors update packagerManagerLines entries to note these failure
// failed resolutions will no longer be considered
let tcConfigB = tcConfig.CloneOfOriginalBuilder
Expand Down
2 changes: 1 addition & 1 deletion src/fsharp/FSComp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ lexUnexpectedChar,"Unexpected character '%s'"
1153,lexInvalidFloat,"Invalid floating point number"
1154,lexOusideDecimal,"This number is outside the allowable range for decimal literals"
1155,lexOusideThirtyTwoBitFloat,"This number is outside the allowable range for 32-bit floats"
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)."
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)."
1157,lexInvalidByteLiteral,"This is not a valid byte literal"
1158,lexInvalidCharLiteral,"This is not a valid character literal"
1159,lexThisUnicodeOnlyInStringLiterals,"This Unicode encoding is only valid in string literals"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# FSharp.Build resource strings
cantReferenceSystemPackage,"PackageManager can not reference the System Package '%s'"
requiresAValue,"%s requires a value"
unableToApplyImplicitArgument,"Unable to apply implicit argument number %d"
notUsed,"Not used."
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ $(PACKAGEREFERENCES)
<ItemGroup>
<ResolvedReferenceLines Remove='*' />
<ResolvedReferenceLines
Condition="'$(SCRIPTEXTENSION)'=='.fsx' and '%(InteractiveResolvedFile.NugetPackageId)'!='FSharp.Core'"
Condition="'$(SCRIPTEXTENSION)'=='.csx' or '%(InteractiveResolvedFile.NugetPackageId)'!='FSharp.Core'"
Include='%(InteractiveResolvedFile.NugetPackageId),%(InteractiveResolvedFile.NugetPackageVersion),%(InteractiveResolvedFile.PackageRoot),%(InteractiveResolvedFile.FullPath),%(InteractiveResolvedFile.IsNotImplementationReference),%(InteractiveResolvedFile.InitializeSourcePath),%(NativeIncludeRoots.Path)'
KeepDuplicates="false" />
</ItemGroup>
Expand Down
Loading