diff --git a/packages/language-service/src/typescript_host.ts b/packages/language-service/src/typescript_host.ts index 59facc4b0c..28197c24f5 100644 --- a/packages/language-service/src/typescript_host.ts +++ b/packages/language-service/src/typescript_host.ts @@ -492,7 +492,7 @@ export class TypeScriptServiceHost implements LanguageServiceHost { const type = this.checker.getTypeAtLocation(target); if (type) { const staticSymbol = - this._reflector.getStaticSymbol(sourceFile.fileName, classDeclaration.name.text); + this.reflector.getStaticSymbol(sourceFile.fileName, classDeclaration.name.text); try { if (this.resolver.isDirective(staticSymbol as any)) { const {metadata} = diff --git a/packages/language-service/test/diagnostics_spec.ts b/packages/language-service/test/diagnostics_spec.ts index c0df4daf63..7a4dc1147f 100644 --- a/packages/language-service/test/diagnostics_spec.ts +++ b/packages/language-service/test/diagnostics_spec.ts @@ -52,6 +52,15 @@ describe('diagnostics', () => { includeDiagnostic(diagnostics(template), message, at, len); } + describe('regression', () => { + it('should be able to return diagnostics if reflector gets invalidated', () => { + const fileName = '/app/main.ts'; + ngService.getDiagnostics(fileName); + (ngHost as any)._reflector = null; + ngService.getDiagnostics(fileName); + }); + }); + describe('with $event', () => { it('should accept an event', () => { accept('
Click me!
'); });