Skip to content

Commit 3e65c3c

Browse files
committed
FSI files still don't work
1 parent c8098dc commit 3e65c3c

File tree

3 files changed

+38
-15
lines changed

3 files changed

+38
-15
lines changed

src/Compiler/Driver/ParseAndCheckInputs.fs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,6 +1420,7 @@ let CheckOneInputAux'
14201420

14211421
match inp with
14221422
| ParsedInput.SigFile file ->
1423+
printfn $"Processing Sig {file.FileName}"
14231424
let qualNameOfFile = file.QualifiedName
14241425

14251426
// Check if we've seen this top module signature before.
@@ -1451,7 +1452,9 @@ let CheckOneInputAux'
14511452
let m = qualNameOfFile.Range
14521453
TcOpenModuleOrNamespaceDecl tcSink tcGlobals amap m tcEnv (prefixPath, m)
14531454

1455+
printfn $"Finished Processing Sig {file.FileName}"
14541456
return fun tcState ->
1457+
printfn $"Applying Sig {file.FileName}"
14551458
let fsiPartialResult, tcState =
14561459
let rootSigs = Zmap.add qualNameOfFile sigFileType tcState.tcsRootSigs
14571460

@@ -1489,9 +1492,15 @@ let CheckOneInputAux'
14891492
// tcState
14901493

14911494
// TODO Do we
1492-
let _, _, _, ccuSigForFile = fsiPartialResult
1495+
let _, _, _, _ = fsiPartialResult
1496+
1497+
let ccuSigForFile, _ =
1498+
AddCheckResultsToTcState
1499+
(tcGlobals, amap, true, prefixPathOpt, tcSink, tcState.tcsTcImplEnv, qualNameOfFile, sigFileType)
1500+
tcState
14931501

14941502
// Save info needed for type-checking .fs file later on
1503+
// TODO Remove most of this
14951504
let fsiBackedInfo: FsiBackedInfo =
14961505
let ast = asts[fsName]
14971506
let file =
@@ -1500,8 +1509,9 @@ let CheckOneInputAux'
15001509
| ParsedInput.SigFile _ -> failwith "Unexpected SigFile"
15011510
amap, conditionalDefines, sigFileType, priorErrors, file, tcStateForImplFile, ccuSigForFile
15021511

1503-
fsiBackedInfos[fsName] <- fsiBackedInfo
1512+
fsiBackedInfos[file.FileName] <- fsiBackedInfo
15041513

1514+
printfn $"Finished Applying Sig {file.FileName}"
15051515
tcState
15061516
//
15071517
// let _, finalTcState =
@@ -1521,6 +1531,7 @@ let CheckOneInputAux'
15211531
fsiPartialResult, fsTcState
15221532

15231533
| ParsedInput.ImplFile file ->
1534+
printfn $"Processing Impl {file.FileName}"
15241535
let qualNameOfFile = file.QualifiedName
15251536

15261537
// Check if we've got an interface for this fragment
@@ -1590,7 +1601,9 @@ let CheckOneInputAux'
15901601
file
15911602
)
15921603

1604+
printfn $"Finished Processing Impl {file.FileName}"
15931605
return fun tcState ->
1606+
printfn $"Applying Impl {file.FileName}"
15941607
let ccuSigForFile, fsTcState =
15951608
AddCheckResultsToTcState
15961609
(tcGlobals, amap, false, prefixPathOpt, tcSink, tcState.tcsTcImplEnv, qualNameOfFile, implFile.Signature)
@@ -1603,6 +1616,7 @@ let CheckOneInputAux'
16031616
tcsCreatesGeneratedProvidedTypes = fsTcState.tcsCreatesGeneratedProvidedTypes || createsGeneratedProvidedTypes
16041617
}
16051618

1619+
printfn $"Finished applying Impl {file.FileName}"
16061620
partialResult, tcState
16071621

16081622
with e ->

tests/FSharp.Compiler.Service.Tests2/DiamondArgs.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,5 +209,4 @@
209209
--simpleresolution
210210
--refout:C:\projekty\fsharp\heuristic\artifacts\obj\DiamondTest\Debug\net7.0\refint\DiamondTest.dll
211211
C:\projekty\fsharp\heuristic\tests\DiamondTest\A.fsi
212-
C:\projekty\fsharp\heuristic\tests\DiamondTest\A.fs
213-
C:\projekty\fsharp\heuristic\tests\DiamondTest\B1.fs
212+
C:\projekty\fsharp\heuristic\tests\DiamondTest\A.fs

tests/FSharp.Compiler.Service.Tests2/ParallelTypeChecking.fs

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,10 @@ module internal Real =
120120
let deps =
121121
deps
122122
|> Array.map (fun d ->
123-
match fsiXMap.TryGetValue d with
124-
| true, xNode -> xNode.File
125-
| false, _ -> d
123+
match (fsiXMap.TryGetValue d, (node.Name + "i" = d.Name)) with
124+
| (true, xNode), false -> xNode.File
125+
| (false, _), _
126+
| _, true -> d
126127
)
127128
node, deps
128129
)
@@ -161,6 +162,7 @@ module internal Real =
161162

162163
match file.AST with
163164
| ASTOrX.AST _ ->
165+
printfn $"Processing AST {file.Name}"
164166
let! f = CheckOneInput'(
165167
checkForErrors2,
166168
tcConfig,
@@ -173,6 +175,7 @@ module internal Real =
173175
false // skipImpFiles...
174176
)
175177

178+
printfn $"Finished Processing AST {file.Name}"
176179
return
177180
(fun (state : State) ->
178181
let tcState, priorErrors = state
@@ -185,6 +188,8 @@ module internal Real =
185188
partialResult, state
186189
)
187190
| ASTOrX.X fsi ->
191+
printfn $"Processing X {file.Name}"
192+
188193
let hadSig = true
189194
// Add dummy .fs results
190195
// Adjust the TcState as if it has been checked, which makes the signature for the file available later
@@ -198,13 +203,16 @@ module internal Real =
198203
// Add dummy TcState so that others can use this file through the .fsi stuff, without type-checking .fs
199204
// Don't use it for this file's type-checking - it will cause duplicates
200205

201-
let info = fsiBackedInfos[file.Name]
206+
let info = fsiBackedInfos[fsi]
202207
match info with
203208
// TODO Change
204-
| amap, conditionalDefines, rootSig, priorErrors, file, tcStateForImplFile, ccuSigForFile ->
209+
| amap, conditionalDefines, rootSig, priorErrors, filee, tcStateForImplFile, ccuSigForFile ->
210+
printfn $"Finished Processing X {file.Name}"
205211
return
206212
(fun (state : State) ->
213+
printfn $"Applying X state {file.Name}"
207214
let tcState, priorErrors = state
215+
// (tcState.TcEnvFromImpls, EmptyTopAttrs, None, ccuSigForFile), state
208216

209217
let ccuSigForFile, tcState =
210218
AddCheckResultsToTcState
@@ -216,6 +224,7 @@ module internal Real =
216224
// TODO Should we use local _priorErrors or global priorErrors?
217225
let priorOrCurrentErrors = priorErrors || hasErrors
218226
let state : State = tcState, priorOrCurrentErrors
227+
printfn $"Finished applying X state {file.Name}"
219228
partialResult, state
220229
)
221230
}
@@ -233,12 +242,13 @@ module internal Real =
233242

234243
let graph: Graph<File> = graph.Graph
235244
let processFile (file : File) (state : State) : State -> PartialResult * State =
236-
match file.AST with
237-
| ASTOrX.AST ast ->
238-
let parsedInput, logger = inputsWithLoggers[file.Idx]
239-
processFile file (parsedInput, logger) state
240-
| ASTOrX.X fsi ->
241-
fun state -> (tcState.TcEnvFromSignatures, EmptyTopAttrs, None, tcState.CcuSig), state
245+
let parsedInput, logger =
246+
match file.AST with
247+
| ASTOrX.AST ast ->
248+
ast, inputsWithLoggers[file.Idx] |> snd
249+
| ASTOrX.X _ ->
250+
inputs |> List.item 0, diagnosticsLogger
251+
processFile file (parsedInput, logger) state
242252

243253
let folder: State -> SingleResult -> FinalFileResult * State = folder
244254
let qnof = QualifiedNameOfFile.QualifiedNameOfFile (Ident("", Range.Zero))

0 commit comments

Comments
 (0)