mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(compiler-cli): prevent recursive scope checks for invalid NgModule imports
Avoid recursive local scope lookups when invalid NgModule imports create import cycles.
This commit is contained in:
committed by
Pawel Kozlowski
parent
12b3a1a755
commit
fcd0bb0db8
@@ -11492,6 +11492,30 @@ runInEachFileSystem((os: string) => {
|
||||
`The pipe 'TestPipe' appears in 'imports', but is not standalone`,
|
||||
);
|
||||
});
|
||||
|
||||
it('should not recurse when a non-standalone component is both declared and imported', () => {
|
||||
env.write(
|
||||
'/test.ts',
|
||||
`
|
||||
import {Component, NgModule} from '@angular/core';
|
||||
|
||||
@Component({standalone: false, template: ''})
|
||||
export class TestComp {}
|
||||
|
||||
@NgModule({
|
||||
declarations: [TestComp],
|
||||
imports: [TestComp],
|
||||
})
|
||||
export class TestModule {}
|
||||
`,
|
||||
);
|
||||
|
||||
const diags = env.driveDiagnostics();
|
||||
expect(diags.length).toBe(1);
|
||||
expect(diags[0].messageText).toContain(
|
||||
`The component 'TestComp' appears in 'imports', but is not standalone`,
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user