Skip to content

Commit acff810

Browse files
Copilotabonie
andcommitted
Fix typecheck-only to properly report errors in loaded files
Co-authored-by: abonie <[email protected]>
1 parent ac2f3f0 commit acff810

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

  • src/Compiler/Interactive

src/Compiler/Interactive/fsi.fs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2224,17 +2224,19 @@ type internal FsiDynamicCompiler
22242224
inputs
22252225
))
22262226

2227-
// typeCheckOnly stops processing after type-checking
2228-
// For loaded files, we skip code generation but continue to process the main script
2229-
// For main script, we report errors and stop processing
2227+
// typeCheckOnly: check for errors after type-checking
2228+
// Always abort on errors (for both loaded files and main script)
2229+
diagnosticsLogger.AbortOnError(fsiConsoleOutput)
2230+
2231+
// typeCheckOnly: skip code generation and execution
22302232
if tcConfig.typeCheckOnly then
2233+
// Update state with type-checking results but skip code generation
2234+
let newIState = { istate with tcState = tcState }
2235+
// Only raise StopProcessing for main script, not for loaded files
22312236
if not isLoadedFile then
2232-
diagnosticsLogger.AbortOnError(fsiConsoleOutput)
22332237
raise StopProcessing
2234-
else
2235-
// For loaded files, update state with type-checking results but skip code generation
2236-
let newIState = { istate with tcState = tcState }
2237-
newIState, tcEnvAtEndOfLastInput, []
2238+
2239+
newIState, tcEnvAtEndOfLastInput, []
22382240
else
22392241
let codegenResults, optEnv, fragName =
22402242
ProcessTypedImpl(

0 commit comments

Comments
 (0)