Skip to content

Commit f09e4aa

Browse files
committed
Fix 631
1 parent ba78ba3 commit f09e4aa

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

src/fsharp/fsi/fsi.fs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,14 +1513,11 @@ module internal MagicAssemblyResolution =
15131513

15141514
let Install(tcConfigB, tcImports: TcImports, fsiDynamicCompiler: FsiDynamicCompiler, fsiConsoleOutput: FsiConsoleOutput) =
15151515

1516-
let rangeStdin = rangeN Lexhelp.stdinMockFilename 0
1517-
15181516
#if TODO_REWORK_ASSEMBLY_LOAD
15191517
ignore tcConfigB
15201518
ignore tcImports
15211519
ignore fsiDynamicCompiler
15221520
ignore fsiConsoleOutput
1523-
ignore rangeStdin
15241521
{ new System.IDisposable with
15251522
member x.Dispose() = () }
15261523
#else
@@ -2317,7 +2314,7 @@ let internal DriveFsiEventLoop (fsi: FsiEvaluationSessionHostConfig, fsiConsoleO
23172314

23182315
/// The primary type, representing a full F# Interactive session, reading from the given
23192316
/// text input, writing to the given text output and error writers.
2320-
type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], inReader:TextReader, outWriter:TextWriter, errorWriter: TextWriter, fsiCollectible: bool, msbuildEnabled: bool) =
2317+
type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], inReader:TextReader, outWriter:TextWriter, errorWriter: TextWriter, fsiCollectible: bool, msbuildEnabled: bool, checker: FSharpChecker) =
23212318
#if DYNAMIC_CODE_REWRITES_CONSOLE_WRITE
23222319
do
23232320
Microsoft.FSharp.Core.Printf.setWriter outWriter
@@ -2457,10 +2454,6 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i
24572454

24582455
let fsiConsoleInput = FsiConsoleInput(fsi, fsiOptions, inReader, outWriter)
24592456

2460-
/// The single, global interactive checker that can be safely used in conjunction with other operations
2461-
/// on the FsiEvaluationSession.
2462-
let checker = FSharpChecker.Create()
2463-
24642457
let (tcGlobals,frameworkTcImports,nonFrameworkResolutions,unresolvedReferences) =
24652458
try
24662459
let tcConfig = tcConfigP.Get()
@@ -2721,8 +2714,12 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i
27212714
GC.KeepAlive fsiInterruptController.EventHandlers
27222715

27232716

2724-
static member Create(fsiConfig, argv, inReader, outWriter, errorWriter, ?collectible, ?msbuildEnabled) =
2725-
new FsiEvaluationSession(fsiConfig, argv, inReader, outWriter, errorWriter, defaultArg collectible false, defaultArg msbuildEnabled true)
2717+
static member Create(fsiConfig, argv, inReader, outWriter, errorWriter, ?collectible, ?msbuildEnabled, ?checker) =
2718+
/// The single, global interactive checker that can be safely used in conjunction with other operations
2719+
/// on the FsiEvaluationSession.
2720+
let checker = match checker with None -> FSharpChecker.Create() | Some c -> c
2721+
2722+
new FsiEvaluationSession(fsiConfig, argv, inReader, outWriter, errorWriter, defaultArg collectible false, defaultArg msbuildEnabled true, checker)
27262723

27272724
static member GetDefaultConfiguration(fsiObj:obj) = FsiEvaluationSession.GetDefaultConfiguration(fsiObj, true)
27282725

src/fsharp/fsi/fsi.fsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ type FsiEvaluationSession =
124124
/// <param name="inReader">Read input from the given reader</param>
125125
/// <param name="outWriter">Write output to the given writer</param>
126126
/// <param name="collectible">Optionally make the dynamic assmbly for the session collectible</param>
127-
static member Create : fsiConfig: FsiEvaluationSessionHostConfig * argv:string[] * inReader:TextReader * outWriter:TextWriter * errorWriter: TextWriter * ?collectible: bool * ?msbuildEnabled: bool -> FsiEvaluationSession
127+
static member Create : fsiConfig: FsiEvaluationSessionHostConfig * argv:string[] * inReader:TextReader * outWriter:TextWriter * errorWriter: TextWriter * ?collectible: bool * ?msbuildEnabled: bool * ?checker: FSharpChecker -> FsiEvaluationSession
128128

129129
/// A host calls this to request an interrupt on the evaluation thread.
130130
member Interrupt : unit -> unit

0 commit comments

Comments
 (0)