44module internal FSharp.Compiler.ParseAndCheckInputs
55
66open System
7+ open System.Collections .Concurrent
78open System.Diagnostics
89open System.IO
910open System.Collections .Generic
@@ -1394,13 +1395,11 @@ let CheckOneInput
13941395 )
13951396 }
13961397
1397- type FsiBackedInfo =
1398- Import.ImportMap * string list option * ModuleOrNamespaceType *
1399- bool * ParsedImplFileInput * TcState * ModuleOrNamespaceType
1398+ type FsiBackedInfo = ModuleOrNamespaceType
14001399
1401- let mutable asts = Dictionary < string, ParsedInput>()
1400+ let mutable asts = ConcurrentDictionary < string, ParsedInput>()
14021401
1403- let mutable fsiBackedInfos = Dictionary < string, FsiBackedInfo >()
1402+ let mutable fsiBackedInfos = ConcurrentDictionary < string, ModuleOrNamespaceType >()
14041403
14051404/// Typecheck a single file (or interactive entry into F# Interactive)
14061405let CheckOneInputAux '
@@ -1463,6 +1462,11 @@ let CheckOneInputAux'
14631462 let m = qualNameOfFile.Range
14641463 TcOpenModuleOrNamespaceDecl tcSink tcGlobals amap m tcEnv ( prefixPath, m)
14651464
1465+
1466+ // Save info needed for type-checking .fs file later on
1467+ printfn $" [{Thread.CurrentThread.ManagedThreadId}] Saving fsiBackedInfos for {file.FileName}"
1468+ fsiBackedInfos[ file.FileName] <- sigFileType
1469+
14661470 printfn $" Finished Processing Sig {file.FileName}"
14671471 return fun tcState ->
14681472 printfn $" Applying Sig {file.FileName}"
@@ -1482,56 +1486,8 @@ let CheckOneInputAux'
14821486 tcsCreatesGeneratedProvidedTypes = tcState.tcsCreatesGeneratedProvidedTypes || createsGeneratedProvidedTypes
14831487 }
14841488 partialResult, tcState
1485-
1486- // Create dedicated state & some data for the .fs file type-checking later on - save it in a dict
1487- let fsTcState =
1488- // let hadSig = true
1489- // Add dummy .fs results
1490- // Adjust the TcState as if it has been checked, which makes the signature for the file available later
1491- // in the compilation order.
1492- let tcStateForImplFile = tcState
1493- let fsName = file.FileName.TrimEnd( 'i' )
1494- // let fsQualifiedName = asts[fsName].QualifiedName
1495- // let qualNameOfFile = fsQualifiedName
1496- let priorErrors = checkForErrors ()
1497- //
1498- // // Add dummy TcState so that others can use this file through the .fsi stuff, without type-checking .fs
1499- // // Don't use it for this file's type-checking - it will cause duplicates
1500- // let ccuSigForFile, tcState =
1501- // AddCheckResultsToTcState
1502- // (tcGlobals, amap, hadSig, prefixPathOpt, tcSink, tcState.tcsTcImplEnv, qualNameOfFile, sigFileType)
1503- // tcState
1504-
1505- // Save info needed for type-checking .fs file later on
1506- // TODO Remove most of this
1507- let fsiBackedInfo : FsiBackedInfo =
1508- let ast = asts[ fsName]
1509- let file =
1510- match ast with
1511- | ParsedInput.ImplFile parsedImplFileInput -> parsedImplFileInput
1512- | ParsedInput.SigFile _ -> failwith " Unexpected SigFile"
1513- amap, conditionalDefines, sigFileType, priorErrors, file, tcStateForImplFile, sigFileType
1514-
1515- fsiBackedInfos[ file.FileName] <- fsiBackedInfo
1516-
1517- printfn $" Finished Applying Sig {file.FileName}"
1518- tcState
1519- //
1520- // let _, finalTcState =
1521- // match dummyFsPartialResult with
1522- // | amap, _conditionalDefines, rootSig, _priorErrors, file, tcStateForImplFile, _ccuSigForFile ->
1523- // AddDummyCheckResultsToTcState(
1524- // tcGlobals,
1525- // amap,
1526- // file.QualifiedName,
1527- // prefixPathOpt,
1528- // tcSink,
1529- // fsTcState,
1530- // tcStateForImplFile,
1531- // rootSig
1532- // )
15331489
1534- fsiPartialResult, fsTcState
1490+ fsiPartialResult, tcState
15351491
15361492 | ParsedInput.ImplFile file ->
15371493 printfn $" Processing Impl {file.FileName}"
0 commit comments