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:
Chuck Jazdzewski 2017-12-11 11:26:12 -08:00 committed by Jason Aden
parent 3401283399
commit 634d33f5dd
2 changed files with 14 additions and 3 deletions

View File

@ -65,13 +65,15 @@ export class AotSummaryResolver implements SummaryResolver<StaticSymbol> {
}
resolveSummary(staticSymbol: StaticSymbol): Summary<StaticSymbol>|null {
staticSymbol.assertNoMembers();
let summary = this.summaryCache.get(staticSymbol);
const rootSymbol = staticSymbol.members.length ?
this.staticSymbolCache.get(staticSymbol.filePath, staticSymbol.name) :
staticSymbol;
let summary = this.summaryCache.get(rootSymbol);
if (!summary) {
this._loadSummaryFile(staticSymbol.filePath);
summary = this.summaryCache.get(staticSymbol) !;
}
return summary || null;
return (rootSymbol === staticSymbol && summary) || null;
}
getSymbolsOf(filePath: string): StaticSymbol[]|null {

View File

@ -95,6 +95,15 @@ export function main() {
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();
});
});
});
}