mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
fix(compiler-cli): extended diagnostics not validating ICUs (#57845)
The visitor that all extended diagnostics are based on hadn't implemented the `visitIcu` method which meant that it wasn't detecting any code inside of them. Fixes #57838. PR Close #57845
This commit is contained in:
parent
d0a71a33b1
commit
f611faadfe
2 changed files with 13 additions and 1 deletions
|
|
@ -228,7 +228,10 @@ class TemplateVisitor<Code extends ErrorCode>
|
|||
visitBoundText(text: TmplAstBoundText): void {
|
||||
this.visitAst(text.value);
|
||||
}
|
||||
visitIcu(icu: TmplAstIcu): void {}
|
||||
visitIcu(icu: TmplAstIcu): void {
|
||||
Object.keys(icu.vars).forEach((key) => this.visit(icu.vars[key]));
|
||||
Object.keys(icu.placeholders).forEach((key) => this.visit(icu.placeholders[key]));
|
||||
}
|
||||
|
||||
visitDeferredBlock(deferred: TmplAstDeferredBlock): void {
|
||||
deferred.visitAll(this);
|
||||
|
|
|
|||
|
|
@ -108,5 +108,14 @@ runInEachFileSystem(() => {
|
|||
|
||||
expect(diags.length).toBe(0);
|
||||
});
|
||||
|
||||
it('should not report a @let declaration that is only used in an ICU', () => {
|
||||
const diags = diagnose(`
|
||||
@let value = 1;
|
||||
<h1 i18n>{value, select, 1 {one} 2 {two} other {other}}</h1>
|
||||
`);
|
||||
|
||||
expect(diags.length).toBe(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue