Skip to content

Commit

Permalink
Merge pull request #7137 from dotnet/merges/release/dev16.3-to-releas…
Browse files Browse the repository at this point in the history
…e/fsharp47

Merge release/dev16.3 to release/fsharp47
  • Loading branch information
dotnet-automerge-bot authored Jul 5, 2019
2 parents cfb414f + 1524916 commit dc19afe
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 13 deletions.
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.19351.4">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19352.7">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>1fb1e240c889cd7f6e10cb1eacd129efa3ddb4b4</Sha>
<Sha>b8c190d95371e658d95a5731f4778bd3da2fa42d</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
2 changes: 1 addition & 1 deletion fcs/download-paket.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$paketurl="https://github.com/fsprojects/Paket/releases/download/5.210.1/paket.exe"
$paketurl="https://github.com/fsprojects/Paket/releases/download/5.215.0/paket.exe"
$paketdir = Join-Path $PSScriptRoot ".paket"
$paketpath = Join-Path $paketdir "paket.exe"

Expand Down
2 changes: 1 addition & 1 deletion fcs/download-paket.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ while [[ -h "$source" ]]; do
done
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"

paketurl=https://github.com/fsprojects/Paket/releases/download/5.210.1/paket.exe
paketurl=https://github.com/fsprojects/Paket/releases/download/5.215.0/paket.exe
paketdir=$scriptroot/.paket
paketpath=$paketdir/paket.exe
if [ ! -e "$paketpath" ]; then
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.19351.4",
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19352.7",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
}
}
13 changes: 12 additions & 1 deletion src/fsharp/service/Reactor.fs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type Reactor() =

// We need to store the culture for the VS thread that is executing now,
// so that when the reactor picks up a thread from the threadpool we can set the culture
let culture = new CultureInfo(CultureInfo.CurrentUICulture.Name)
let mutable culture = CultureInfo(CultureInfo.CurrentUICulture.Name)

let mutable bgOpCts = new CancellationTokenSource()
/// Mailbox dispatch function.
Expand Down Expand Up @@ -131,6 +131,17 @@ type Reactor() =
Debug.Assert(false, String.Format("unexpected failure in reactor loop {0}, restarting", e))
}

member __.SetPreferredUILang(preferredUiLang: string option) =
match preferredUiLang with
| Some s ->
culture <- CultureInfo s
#if FX_RESHAPED_GLOBALIZATION
CultureInfo.CurrentUICulture <- culture
#else
Thread.CurrentThread.CurrentUICulture <- culture
#endif
| None -> ()

// [Foreground Mailbox Accessors] -----------------------------------------------------------
member r.SetBackgroundOp(bgOpOpt) =
Trace.TraceInformation("Reactor: {0:n3} enqueue start background, length {1}", DateTime.Now.TimeOfDay.TotalSeconds, builder.CurrentQueueLength)
Expand Down
3 changes: 3 additions & 0 deletions src/fsharp/service/Reactor.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ type internal IReactorOperations =
[<Sealed>]
type internal Reactor =

/// Allows to specify the language for error messages
member SetPreferredUILang : string option -> unit

/// Set the background building function, which is called repeatedly
/// until it returns 'false'. If None then no background operation is used.
member SetBackgroundOp : ( (* userOpName:*) string * (* opName: *) string * (* opArg: *) string * (CompilationThreadToken -> CancellationToken -> bool)) option -> unit
Expand Down
2 changes: 2 additions & 0 deletions src/fsharp/service/service.fs
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC
keepAssemblyContents,
suggestNamesForErrors)
let parsingOptions = FSharpParsingOptions.FromTcConfig(tcPrior.TcConfig, Array.ofList builder.SourceFiles, options.UseScriptResolutionRules)
reactor.SetPreferredUILang tcPrior.TcConfig.preferredUiLang
bc.RecordTypeCheckFileInProjectResults(fileName, options, parsingOptions, parseResults, fileVersion, tcPrior.TimeStamp, Some checkAnswer, sourceText.GetHashCode())
return checkAnswer
finally
Expand Down Expand Up @@ -636,6 +637,7 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC

// Do the parsing.
let parsingOptions = FSharpParsingOptions.FromTcConfig(builder.TcConfig, Array.ofList (builder.SourceFiles), options.UseScriptResolutionRules)
reactor.SetPreferredUILang tcPrior.TcConfig.preferredUiLang
let parseErrors, parseTreeOpt, anyErrors = ParseAndCheckFile.parseFile (sourceText, filename, parsingOptions, userOpName, suggestNamesForErrors)
let parseResults = FSharpParseFileResults(parseErrors, parseTreeOpt, anyErrors, builder.AllDependenciesDeprecated)
let! checkResults = bc.CheckOneFileImpl(parseResults, sourceText, filename, options, textSnapshotInfo, fileVersion, builder, tcPrior, creationErrors, userOpName)
Expand Down
14 changes: 7 additions & 7 deletions tests/fsharp/Compiler/CompilerAssert.fs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module CompilerAssert =
ProjectId = None
SourceFiles = [|"test.fs"|]
#if !NETCOREAPP
OtherOptions = [||]
OtherOptions = [|"--preferreduilang:en-US";|]
#else
OtherOptions =
// Hack: Currently a hack to get the runtime assemblies for netcore in order to compile.
Expand All @@ -36,8 +36,7 @@ module CompilerAssert =
|> Seq.toArray
|> Array.filter (fun x -> x.ToLowerInvariant().Contains("system.") || x.ToLowerInvariant().EndsWith("netstandard.dll"))
|> Array.map (fun x -> sprintf "-r:%s" x)
Array.append [|"--targetprofile:netcore"; "--noframework"|] assemblies

Array.append [|"--preferreduilang:en-US"; "--targetprofile:netcore"; "--noframework"|] assemblies
#endif
ReferencedProjects = [||]
IsIncompleteTypeCheckEnvironment = false
Expand All @@ -55,25 +54,26 @@ module CompilerAssert =
lock lockObj <| fun () ->
let parseResults, fileAnswer = checker.ParseAndCheckFileInProject("test.fs", 0, SourceText.ofString source, defaultProjectOptions) |> Async.RunSynchronously

Assert.True(parseResults.Errors.Length = 0, sprintf "Parse errors: %A" parseResults.Errors)
Assert.IsEmpty(parseResults.Errors, sprintf "Parse errors: %A" parseResults.Errors)

match fileAnswer with
| FSharpCheckFileAnswer.Aborted _ -> Assert.Fail("Type Checker Aborted")
| FSharpCheckFileAnswer.Succeeded(typeCheckResults) ->

Assert.True(typeCheckResults.Errors.Length = 0, sprintf "Type Check errors: %A" typeCheckResults.Errors)
Assert.IsEmpty(typeCheckResults.Errors, sprintf "Type Check errors: %A" typeCheckResults.Errors)


let TypeCheckSingleError (source: string) (expectedErrorNumber: int) (expectedErrorRange: int * int * int * int) (expectedErrorMsg: string) =
lock lockObj <| fun () ->
let parseResults, fileAnswer = checker.ParseAndCheckFileInProject("test.fs", 0, SourceText.ofString source, defaultProjectOptions) |> Async.RunSynchronously

Assert.True(parseResults.Errors.Length = 0, sprintf "Parse errors: %A" parseResults.Errors)
Assert.IsEmpty(parseResults.Errors, sprintf "Parse errors: %A" parseResults.Errors)

match fileAnswer with
| FSharpCheckFileAnswer.Aborted _ -> Assert.Fail("Type Checker Aborted")
| FSharpCheckFileAnswer.Succeeded(typeCheckResults) ->

Assert.True(typeCheckResults.Errors.Length = 1, sprintf "Expected one type check error: %A" typeCheckResults.Errors)
Assert.AreEqual(1, typeCheckResults.Errors.Length, sprintf "Expected one type check error: %A" typeCheckResults.Errors)
typeCheckResults.Errors
|> Array.iter (fun info ->
Assert.AreEqual(FSharpErrorSeverity.Error, info.Severity)
Expand Down

0 comments on commit dc19afe

Please sign in to comment.