diff --git a/src/compiler/program.ts b/src/compiler/program.ts index c77fa8371185e..a495c61c07d4f 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -958,7 +958,6 @@ namespace ts { getResolvedTypeReferenceDirectives: () => resolvedTypeReferenceDirectives, isSourceFileFromExternalLibrary, isSourceFileDefaultLibrary, - dropDiagnosticsProducingTypeChecker, getSourceFileFromReference, getLibFileFromReference, sourceFileToPackageName, @@ -1558,12 +1557,8 @@ namespace ts { return diagnosticsProducingTypeChecker || (diagnosticsProducingTypeChecker = createTypeChecker(program, /*produceDiagnostics:*/ true)); } - function dropDiagnosticsProducingTypeChecker() { - diagnosticsProducingTypeChecker = undefined!; - } - function getTypeChecker() { - return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = createTypeChecker(program, /*produceDiagnostics:*/ false)); + return noDiagnosticsTypeChecker || (noDiagnosticsTypeChecker = diagnosticsProducingTypeChecker || createTypeChecker(program, /*produceDiagnostics:*/ false)); } function emit(sourceFile?: SourceFile, writeFileCallback?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, transformers?: CustomTransformers, forceDtsEmit?: boolean): EmitResult { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 32a36306a17d5..166cc0c4c25f0 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -3222,7 +3222,6 @@ namespace ts { // For testing purposes only. Should not be used by any other consumers (including the // language service). /* @internal */ getDiagnosticsProducingTypeChecker(): TypeChecker; - /* @internal */ dropDiagnosticsProducingTypeChecker(): void; /* @internal */ getClassifiableNames(): UnderscoreEscapedMap; diff --git a/src/harness/harnessIO.ts b/src/harness/harnessIO.ts index 29cdd9cf614d5..b95a4fdea238a 100644 --- a/src/harness/harnessIO.ts +++ b/src/harness/harnessIO.ts @@ -710,7 +710,7 @@ namespace Harness { // These types are equivalent, but depend on what order the compiler observed // certain parts of the program. - const fullWalker = new TypeWriterWalker(program, /*fullTypeCheck*/ true, !!hasErrorBaseline); + const fullWalker = new TypeWriterWalker(program, !!hasErrorBaseline); // Produce baselines. The first gives the types for all expressions. // The second gives symbols for all identifiers. diff --git a/src/harness/typeWriter.ts b/src/harness/typeWriter.ts index b45f87a19f275..02d3d599ef9a3 100644 --- a/src/harness/typeWriter.ts +++ b/src/harness/typeWriter.ts @@ -39,12 +39,10 @@ namespace Harness { private checker: ts.TypeChecker; - constructor(private program: ts.Program, fullTypeCheck: boolean, private hadErrorBaseline: boolean) { + constructor(private program: ts.Program, private hadErrorBaseline: boolean) { // Consider getting both the diagnostics checker and the non-diagnostics checker to verify // they are consistent. - this.checker = fullTypeCheck - ? program.getDiagnosticsProducingTypeChecker() - : program.getTypeChecker(); + this.checker = program.getDiagnosticsProducingTypeChecker(); } public *getSymbols(fileName: string): IterableIterator {