@@ -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 ;
@@ -470,9 +473,15 @@ function createBuilderProgramState(
470
473
state . programEmitPending | pendingEmitKind :
471
474
pendingEmitKind ;
472
475
}
476
+ // if (!state.compilerOptions.noCheck)
473
477
state . buildInfoEmitPending = true ;
474
478
}
475
479
}
480
+ if (
481
+ useOldState &&
482
+ state . semanticDiagnosticsPerFile . size !== state . fileInfos . size &&
483
+ oldState ! . checkPending !== state . checkPending
484
+ ) state . buildInfoEmitPending = true ;
476
485
return state ;
477
486
478
487
function addFileToChangeSet ( path : Path ) {
@@ -741,7 +750,7 @@ function removeDiagnosticsOfLibraryFiles(state: BuilderProgramStateWithDefinedPr
741
750
const options = state . program . getCompilerOptions ( ) ;
742
751
forEach ( state . program . getSourceFiles ( ) , f =>
743
752
state . program . isSourceFileDefaultLibrary ( f ) &&
744
- ! skipTypeChecking ( f , options , state . program ) &&
753
+ ! skipTypeCheckingIgnoringNoCheck ( f , options , state . program ) &&
745
754
removeSemanticDiagnosticsOf ( state , f . resolvedPath ) ) ;
746
755
}
747
756
}
@@ -986,6 +995,7 @@ function getSemanticDiagnosticsOfFile(
986
995
cancellationToken ?: CancellationToken ,
987
996
semanticDiagnosticsPerFile ?: BuilderProgramState [ "semanticDiagnosticsPerFile" ] ,
988
997
) : readonly Diagnostic [ ] {
998
+ if ( state . compilerOptions . noCheck ) return emptyArray ;
989
999
return concatenate (
990
1000
getBinderAndCheckerDiagnosticsOfFile ( state , sourceFile , cancellationToken , semanticDiagnosticsPerFile ) ,
991
1001
state . program . getProgramDiagnostics ( sourceFile ) ,
@@ -1084,6 +1094,7 @@ export interface IncrementalBuildInfoBase extends BuildInfo {
1084
1094
// Because this is only output file in the program, we dont need fileId to deduplicate name
1085
1095
latestChangedDtsFile ?: string | undefined ;
1086
1096
errors : true | undefined ;
1097
+ checkPending : true | undefined ;
1087
1098
}
1088
1099
1089
1100
/** @internal */
@@ -1131,6 +1142,7 @@ export function isIncrementalBuildInfo(info: BuildInfo): info is IncrementalBuil
1131
1142
export interface NonIncrementalBuildInfo extends BuildInfo {
1132
1143
root : readonly string [ ] ;
1133
1144
errors : true | undefined ;
1145
+ checkPending : true | undefined ;
1134
1146
}
1135
1147
1136
1148
/** @internal */
@@ -1190,6 +1202,7 @@ function getBuildInfo(state: BuilderProgramStateWithDefinedProgram): BuildInfo {
1190
1202
const buildInfo : NonIncrementalBuildInfo = {
1191
1203
root : arrayFrom ( rootFileNames , r => relativeToBuildInfo ( r ) ) ,
1192
1204
errors : state . hasErrors ? true : undefined ,
1205
+ checkPending : state . checkPending ,
1193
1206
version,
1194
1207
} ;
1195
1208
return buildInfo ;
@@ -1223,6 +1236,7 @@ function getBuildInfo(state: BuilderProgramStateWithDefinedProgram): BuildInfo {
1223
1236
false : // Pending emit is same as deteremined by compilerOptions
1224
1237
state . programEmitPending , // Actual value
1225
1238
errors : state . hasErrors ? true : undefined ,
1239
+ checkPending : state . checkPending ,
1226
1240
version,
1227
1241
} ;
1228
1242
return buildInfo ;
@@ -1313,6 +1327,7 @@ function getBuildInfo(state: BuilderProgramStateWithDefinedProgram): BuildInfo {
1313
1327
emitSignatures,
1314
1328
latestChangedDtsFile,
1315
1329
errors : state . hasErrors ? true : undefined ,
1330
+ checkPending : state . checkPending ,
1316
1331
version,
1317
1332
} ;
1318
1333
return buildInfo ;
@@ -1952,7 +1967,13 @@ export function createBuilderProgram(
1952
1967
while ( true ) {
1953
1968
const affected = getNextAffectedFile ( state , cancellationToken , host ) ;
1954
1969
let result ;
1955
- if ( ! affected ) return undefined ; // Done
1970
+ if ( ! affected ) {
1971
+ if ( state . checkPending && ! state . compilerOptions . noCheck ) {
1972
+ state . checkPending = undefined ;
1973
+ state . buildInfoEmitPending = true ;
1974
+ }
1975
+ return undefined ; // Done
1976
+ }
1956
1977
else if ( affected !== state . program ) {
1957
1978
// Get diagnostics for the affected file if its not ignored
1958
1979
const affectedSourceFile = affected as SourceFile ;
@@ -1984,6 +2005,7 @@ export function createBuilderProgram(
1984
2005
result = diagnostics || emptyArray ;
1985
2006
state . changedFilesSet . clear ( ) ;
1986
2007
state . programEmitPending = getBuilderFileEmit ( state . compilerOptions ) ;
2008
+ if ( ! state . compilerOptions . noCheck ) state . checkPending = undefined ;
1987
2009
state . buildInfoEmitPending = true ;
1988
2010
}
1989
2011
return { result, affected } ;
@@ -2021,6 +2043,10 @@ export function createBuilderProgram(
2021
2043
for ( const sourceFile of state . program . getSourceFiles ( ) ) {
2022
2044
diagnostics = addRange ( diagnostics , getSemanticDiagnosticsOfFile ( state , sourceFile , cancellationToken ) ) ;
2023
2045
}
2046
+ if ( state . checkPending && ! state . compilerOptions . noCheck ) {
2047
+ state . checkPending = undefined ;
2048
+ state . buildInfoEmitPending = true ;
2049
+ }
2024
2050
return diagnostics || emptyArray ;
2025
2051
}
2026
2052
}
@@ -2089,6 +2115,7 @@ export function createBuilderProgramUsingIncrementalBuildInfo(
2089
2115
outSignature : buildInfo . outSignature ,
2090
2116
programEmitPending : buildInfo . pendingEmit === undefined ? undefined : toProgramEmitPending ( buildInfo . pendingEmit , buildInfo . options ) ,
2091
2117
hasErrors : buildInfo . errors ,
2118
+ checkPending : buildInfo . checkPending ,
2092
2119
} ;
2093
2120
}
2094
2121
else {
@@ -2125,6 +2152,7 @@ export function createBuilderProgramUsingIncrementalBuildInfo(
2125
2152
latestChangedDtsFile,
2126
2153
emitSignatures : emitSignatures ?. size ? emitSignatures : undefined ,
2127
2154
hasErrors : buildInfo . errors ,
2155
+ checkPending : buildInfo . checkPending ,
2128
2156
} ;
2129
2157
}
2130
2158
0 commit comments