Skip to content

Commit 63598d0

Browse files
committed
fix avoid non-actionable template type-checker syntax diagnostics
The AOT compiler's internal template type-checking files are not intended to be directly analyzed for diagnostics by the emitting program and are instead analyzed during the template type-checking phase. Previously, only semantic diagnostics were ignored. Now both syntactic and semantic diagnostics are ignored. This change prevents non-actionable diagnostics from being shown during a build. Addresses: angular/angular#42667
1 parent 1e06fd1 commit 63598d0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/lib/ivy/compile-source-files.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,21 +94,24 @@ export async function compileSourceFiles(
9494
}
9595
}
9696

97-
// Collect non-semantic diagnostics
97+
// Collect program level diagnostics
9898
const allDiagnostics: ts.Diagnostic[] = [
9999
...angularCompiler.getOptionDiagnostics(),
100100
...builder.getOptionsDiagnostics(),
101101
...builder.getGlobalDiagnostics(),
102-
...builder.getSyntacticDiagnostics(),
103102
];
104103

105104
// Required to support asynchronous resource loading
106105
// Must be done before creating transformers or getting template diagnostics
107106
await angularCompiler.analyzeAsync();
108107

108+
// Collect source file specific diagnostics
109109
for (const sourceFile of builder.getSourceFiles()) {
110110
if (!ignoreForDiagnostics.has(sourceFile)) {
111-
allDiagnostics.push(...builder.getSemanticDiagnostics(sourceFile));
111+
allDiagnostics.push(
112+
...builder.getSyntacticDiagnostics(sourceFile),
113+
...builder.getSemanticDiagnostics(sourceFile),
114+
);
112115
}
113116

114117
if (sourceFile.isDeclarationFile) {

0 commit comments

Comments
 (0)