fix(compiler): support referencing enums in namespaces (#20947)
Due to an overly agressive assert the compiler would generate an internal error when referencing an enum declared in namspace. Fixes #18170 PR Close #20947
This commit is contained in:
parent
3401283399
commit
634d33f5dd
|
@ -65,13 +65,15 @@ export class AotSummaryResolver implements SummaryResolver<StaticSymbol> {
|
||||||
}
|
}
|
||||||
|
|
||||||
resolveSummary(staticSymbol: StaticSymbol): Summary<StaticSymbol>|null {
|
resolveSummary(staticSymbol: StaticSymbol): Summary<StaticSymbol>|null {
|
||||||
staticSymbol.assertNoMembers();
|
const rootSymbol = staticSymbol.members.length ?
|
||||||
let summary = this.summaryCache.get(staticSymbol);
|
this.staticSymbolCache.get(staticSymbol.filePath, staticSymbol.name) :
|
||||||
|
staticSymbol;
|
||||||
|
let summary = this.summaryCache.get(rootSymbol);
|
||||||
if (!summary) {
|
if (!summary) {
|
||||||
this._loadSummaryFile(staticSymbol.filePath);
|
this._loadSummaryFile(staticSymbol.filePath);
|
||||||
summary = this.summaryCache.get(staticSymbol) !;
|
summary = this.summaryCache.get(staticSymbol) !;
|
||||||
}
|
}
|
||||||
return summary || null;
|
return (rootSymbol === staticSymbol && summary) || null;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSymbolsOf(filePath: string): StaticSymbol[]|null {
|
getSymbolsOf(filePath: string): StaticSymbol[]|null {
|
||||||
|
|
|
@ -95,6 +95,15 @@ export function main() {
|
||||||
expect(host.isSourceFile).toHaveBeenCalledWith('someFile.ts');
|
expect(host.isSourceFile).toHaveBeenCalledWith('someFile.ts');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('regression', () => {
|
||||||
|
// #18170
|
||||||
|
it('should support resolving symbol with members ', () => {
|
||||||
|
init();
|
||||||
|
expect(summaryResolver.resolveSummary(symbolCache.get('/src.d.ts', 'Src', ['One', 'Two'])))
|
||||||
|
.toBeNull();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue