fix(ngcc): properly detect origin of constructor param types (#33901)

The ReflectionHost supports enumeration of constructor parameters, and one
piece of information it returns describes the origin of the parameter's
type. Parameter types come in two flavors: local (the type is not imported
from anywhere) or non-local (the type comes via an import).

ngcc incorrectly classified all type parameters as 'local', because in the
source files that ngcc processes the type parameter is a real ts.Identifer.
However, that identifier may still have come from an import and thus might
be non-local.

This commit changes ngcc's ReflectionHost(s) to properly recognize and
report these non-local type references.

Fixes #33677

PR Close #33901
This commit is contained in:
Alex Rickabaugh
2019-11-18 11:53:25 -08:00
parent c68200cf42
commit 29b8666b10
4 changed files with 50 additions and 27 deletions

View File

@ -1560,9 +1560,6 @@ runInEachFileSystem(() => {
expect(decorators.length).toEqual(1);
expect(decorators[0].import).toBe(mockImportInfo);
const typeIdentifier = spy.calls.mostRecent().args[0] as ts.Identifier;
expect(typeIdentifier.text).toBe('Inject');
});
});