@@ -76,7 +76,7 @@ import {
76
76
SemanticDiagnosticsBuilderProgram ,
77
77
SignatureInfo ,
78
78
skipAlias ,
79
- skipTypeChecking ,
79
+ skipTypeCheckingIgnoringNoCheck ,
80
80
some ,
81
81
SourceFile ,
82
82
sourceFileMayBeEmitted ,
@@ -158,6 +158,8 @@ export interface ReusableBuilderProgramState extends BuilderState {
158
158
* emitKind pending for a program with --out
159
159
*/
160
160
programEmitPending ?: BuilderFileEmit ;
161
+ /** If semantic diagnsotic check is pending */
162
+ checkPending ?: true ;
161
163
/*
162
164
* true if semantic diagnostics are ReusableDiagnostic instead of Diagnostic
163
165
*/
@@ -329,6 +331,7 @@ function createBuilderProgramState(
329
331
}
330
332
state . changedFilesSet = new Set ( ) ;
331
333
state . latestChangedDtsFile = compilerOptions . composite ? oldState ?. latestChangedDtsFile : undefined ;
334
+ state . checkPending = state . compilerOptions . noCheck ? true : undefined ;
332
335
333
336
const useOldState = BuilderState . canReuseOldState ( state . referencedMap , oldState ) ;
334
337
const oldCompilerOptions = useOldState ? oldState ! . compilerOptions : undefined ;
@@ -473,6 +476,11 @@ function createBuilderProgramState(
473
476
state . buildInfoEmitPending = true ;
474
477
}
475
478
}
479
+ if (
480
+ useOldState &&
481
+ state . semanticDiagnosticsPerFile . size !== state . fileInfos . size &&
482
+ oldState ! . checkPending !== state . checkPending
483
+ ) state . buildInfoEmitPending = true ;
476
484
return state ;
477
485
478
486
function addFileToChangeSet ( path : Path ) {
@@ -741,7 +749,7 @@ function removeDiagnosticsOfLibraryFiles(state: BuilderProgramStateWithDefinedPr
741
749
const options = state . program . getCompilerOptions ( ) ;
742
750
forEach ( state . program . getSourceFiles ( ) , f =>
743
751
state . program . isSourceFileDefaultLibrary ( f ) &&
744
- ! skipTypeChecking ( f , options , state . program ) &&
752
+ ! skipTypeCheckingIgnoringNoCheck ( f , options , state . program ) &&
745
753
removeSemanticDiagnosticsOf ( state , f . resolvedPath ) ) ;
746
754
}
747
755
}
@@ -986,6 +994,7 @@ function getSemanticDiagnosticsOfFile(
986
994
cancellationToken : CancellationToken | undefined ,
987
995
semanticDiagnosticsPerFile ?: BuilderProgramState [ "semanticDiagnosticsPerFile" ] ,
988
996
) : readonly Diagnostic [ ] {
997
+ if ( state . compilerOptions . noCheck ) return emptyArray ;
989
998
return concatenate (
990
999
getBinderAndCheckerDiagnosticsOfFile ( state , sourceFile , cancellationToken , semanticDiagnosticsPerFile ) ,
991
1000
state . program . getProgramDiagnostics ( sourceFile ) ,
@@ -1084,6 +1093,7 @@ export interface IncrementalBuildInfoBase extends BuildInfo {
1084
1093
// Because this is only output file in the program, we dont need fileId to deduplicate name
1085
1094
latestChangedDtsFile ?: string | undefined ;
1086
1095
errors : true | undefined ;
1096
+ checkPending : true | undefined ;
1087
1097
}
1088
1098
1089
1099
/** @internal */
@@ -1131,6 +1141,7 @@ export function isIncrementalBuildInfo(info: BuildInfo): info is IncrementalBuil
1131
1141
export interface NonIncrementalBuildInfo extends BuildInfo {
1132
1142
root : readonly string [ ] ;
1133
1143
errors : true | undefined ;
1144
+ checkPending : true | undefined ;
1134
1145
}
1135
1146
1136
1147
/** @internal */
@@ -1190,6 +1201,7 @@ function getBuildInfo(state: BuilderProgramStateWithDefinedProgram): BuildInfo {
1190
1201
const buildInfo : NonIncrementalBuildInfo = {
1191
1202
root : arrayFrom ( rootFileNames , r => relativeToBuildInfo ( r ) ) ,
1192
1203
errors : state . hasErrors ? true : undefined ,
1204
+ checkPending : state . checkPending ,
1193
1205
version,
1194
1206
} ;
1195
1207
return buildInfo ;
@@ -1223,6 +1235,7 @@ function getBuildInfo(state: BuilderProgramStateWithDefinedProgram): BuildInfo {
1223
1235
false : // Pending emit is same as deteremined by compilerOptions
1224
1236
state . programEmitPending , // Actual value
1225
1237
errors : state . hasErrors ? true : undefined ,
1238
+ checkPending : state . checkPending ,
1226
1239
version,
1227
1240
} ;
1228
1241
return buildInfo ;
@@ -1313,6 +1326,7 @@ function getBuildInfo(state: BuilderProgramStateWithDefinedProgram): BuildInfo {
1313
1326
emitSignatures,
1314
1327
latestChangedDtsFile,
1315
1328
errors : state . hasErrors ? true : undefined ,
1329
+ checkPending : state . checkPending ,
1316
1330
version,
1317
1331
} ;
1318
1332
return buildInfo ;
@@ -1952,7 +1966,13 @@ export function createBuilderProgram(
1952
1966
while ( true ) {
1953
1967
const affected = getNextAffectedFile ( state , cancellationToken , host ) ;
1954
1968
let result ;
1955
- if ( ! affected ) return undefined ; // Done
1969
+ if ( ! affected ) {
1970
+ if ( state . checkPending && ! state . compilerOptions . noCheck ) {
1971
+ state . checkPending = undefined ;
1972
+ state . buildInfoEmitPending = true ;
1973
+ }
1974
+ return undefined ; // Done
1975
+ }
1956
1976
else if ( affected !== state . program ) {
1957
1977
// Get diagnostics for the affected file if its not ignored
1958
1978
const affectedSourceFile = affected as SourceFile ;
@@ -1984,6 +2004,7 @@ export function createBuilderProgram(
1984
2004
result = diagnostics || emptyArray ;
1985
2005
state . changedFilesSet . clear ( ) ;
1986
2006
state . programEmitPending = getBuilderFileEmit ( state . compilerOptions ) ;
2007
+ if ( ! state . compilerOptions . noCheck ) state . checkPending = undefined ;
1987
2008
state . buildInfoEmitPending = true ;
1988
2009
}
1989
2010
return { result, affected } ;
@@ -2021,6 +2042,10 @@ export function createBuilderProgram(
2021
2042
for ( const sourceFile of state . program . getSourceFiles ( ) ) {
2022
2043
diagnostics = addRange ( diagnostics , getSemanticDiagnosticsOfFile ( state , sourceFile , cancellationToken ) ) ;
2023
2044
}
2045
+ if ( state . checkPending && ! state . compilerOptions . noCheck ) {
2046
+ state . checkPending = undefined ;
2047
+ state . buildInfoEmitPending = true ;
2048
+ }
2024
2049
return diagnostics || emptyArray ;
2025
2050
}
2026
2051
}
@@ -2089,6 +2114,7 @@ export function createBuilderProgramUsingIncrementalBuildInfo(
2089
2114
outSignature : buildInfo . outSignature ,
2090
2115
programEmitPending : buildInfo . pendingEmit === undefined ? undefined : toProgramEmitPending ( buildInfo . pendingEmit , buildInfo . options ) ,
2091
2116
hasErrors : buildInfo . errors ,
2117
+ checkPending : buildInfo . checkPending ,
2092
2118
} ;
2093
2119
}
2094
2120
else {
@@ -2125,6 +2151,7 @@ export function createBuilderProgramUsingIncrementalBuildInfo(
2125
2151
latestChangedDtsFile,
2126
2152
emitSignatures : emitSignatures ?. size ? emitSignatures : undefined ,
2127
2153
hasErrors : buildInfo . errors ,
2154
+ checkPending : buildInfo . checkPending ,
2128
2155
} ;
2129
2156
}
2130
2157
0 commit comments