Skip to content
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

Merge master to release/dev16.8 #9698

Merged
merged 1 commit into from
Jul 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,10 @@ module internal Utilities =
let succeeded, stdOut, stdErr =
if not (isRunningOnCoreClr) then
// The Desktop build uses "msbuild" to build
executeBuild msbuildExePath (arguments "") workingDir
executeBuild msbuildExePath (arguments "-v:quiet") workingDir
else
// The coreclr uses "dotnet msbuild" to build
executeBuild dotnetHostPath (arguments "msbuild") workingDir
executeBuild dotnetHostPath (arguments "msbuild -v:quiet") workingDir

let outputFile = projectPath + ".resolvedReferences.paths"
let resultOutFile = if succeeded && File.Exists(outputFile) then Some outputFile else None
Expand Down
12 changes: 11 additions & 1 deletion src/fsharp/fsi/fsi.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2290,6 +2290,16 @@ type internal FsiInteractionProcessor
| EndOfFile -> istate,defaultArg lastResult (Completed None) (* drop nextAction on EOF *)
| CtrlC -> istate,CtrlC (* drop nextAction on CtrlC *)

/// Execute a single parsed interaction which may contain multiple items to be executed
/// independently
let executeParsedInteractions (ctok, tcConfig, istate, action, errorLogger: ErrorLogger, lastResult:option<FsiInteractionStepStatus>, cancellationToken: CancellationToken) =
let istate, completed = execParsedInteractions (ctok, tcConfig, istate, action, errorLogger, lastResult, cancellationToken)
match completed with
| Completed _ ->
let istate = fsiDynamicCompiler.CommitDependencyManagerText(ctok, istate, lexResourceManager, errorLogger)
istate, completed
| _ -> istate, completed

/// Execute a single parsed interaction on the parser/execute thread.
let mainThreadProcessAction ctok action istate =
try
Expand All @@ -2314,7 +2324,7 @@ type internal FsiInteractionProcessor

let mainThreadProcessParsedInteractions ctok errorLogger (action, istate) cancellationToken =
istate |> mainThreadProcessAction ctok (fun ctok tcConfig istate ->
execParsedInteractions (ctok, tcConfig, istate, action, errorLogger, None, cancellationToken))
executeParsedInteractions (ctok, tcConfig, istate, action, errorLogger, None, cancellationToken))

let parseExpression (tokenizer:LexFilter.LexFilter) =
reusingLexbufForParsing tokenizer.LexBuffer (fun () ->
Expand Down
2 changes: 1 addition & 1 deletion src/fsharp/fsi/fsi.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<TargetExt>.exe</TargetExt>
<NoWarn>$(NoWarn);45;55;62;75;1204</NoWarn>
<AllowCrossTargeting>true</AllowCrossTargeting>
<OtherFlags>$(OtherFlags) --warnon:1182 --maxerrors:20 --extraoptimizationloops:1</OtherFlags>
<OtherFlags>--warnon:1182 --maxerrors:20 --extraoptimizationloops:1</OtherFlags>
<Win32Resource>fsi.res</Win32Resource>
<NGenBinary>true</NGenBinary>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,39 @@ printfn ""%A"" result

[<Test>]
member __.``Eval script with package manager invalid key``() =
use script = new FSharpScript()
use script = new FSharpScript(additionalArgs=[|"/langversion:preview"|])
let result, _errors = script.Eval(@"#r ""nugt:FSharp.Data""")
match result with
| Ok(_) -> Assert.Fail("expected a failure")
| Error(ex) -> Assert.IsInstanceOf<FsiCompilationException>(ex)

[<Test>]
member __.``Eval script with invalid PackageName should fail immediately``() =
use output = new RedirectConsoleOutput()
use script = new FSharpScript(additionalArgs=[|"/langversion:preview"|])
let mutable found = 0
let outp = System.Collections.Generic.List<string>()
output.OutputProduced.Add(
fun line ->
if line.Contains("error NU1101:") && line.Contains("FSharp.Really.Not.A.Package") then
found <- found + 1
outp.Add(line))
let _result, _errors = script.Eval("""#r "nuget:FSharp.Really.Not.A.Package" """)
Assert.True( (found = 1), "Expected to see output contains 'error NU1101:' and 'FSharp.Really.Not.A.Package'")

[<Test>]
member __.``Eval script with invalid PackageName should fail immediately and resolve one time only``() =
use output = new RedirectConsoleOutput()
use script = new FSharpScript(additionalArgs=[|"/langversion:preview"|])
let mutable foundResolve = 0
output.OutputProduced.Add (fun line -> if line.Contains("Microsoft (R) Build Engine version") then foundResolve <- foundResolve + 1)
let _result, _errors =
script.Eval("""
#r "nuget:FSharp.Really.Not.A.Package"
#r "nuget:FSharp.Really.Not.Another.Package"
""")
Assert.True( (foundResolve = 1), (sprintf "Expected to see 'Microsoft (R) Build Engine version' only once actually resolved %d times" foundResolve))

[<Test>]
member __.``ML - use assembly with ref dependencies``() =
let code = @"
Expand Down