https://github.com/angular/angular
Revision 305b5a38878ebc92db2f8a004e4174a94c8d792a authored by Alex Rickabaugh on 15 May 2020, 00:52:08 UTC, committed by atscott on 03 June 2020, 20:23:16 UTC
When the compiler encounters a function call within an NgModule imports
section, it attempts to resolve it to an NgModule-annotated class by
looking at the function body and evaluating the statements there. This
evaluation can only understand simple functions which have a single
return statement as their body. If the function the user writes is more
complex than that, the compiler won't be able to understand it and
previously the PartialEvaluator would return a "DynamicValue" for
that import.

With this change, in the event the function body resolution fails the
PartialEvaluator will now attempt to use its foreign function resolvers to
determine the correct result from the function's type signtaure instead. If
the function is annotated with a correct ModuleWithProviders type, the
compiler will be able to understand the import without static analysis of
the function body.

PR Close #37126
1 parent bc54936
History
Tip revision: 305b5a38878ebc92db2f8a004e4174a94c8d792a authored by Alex Rickabaugh on 15 May 2020, 00:52:08 UTC
fix(compiler-cli): use ModuleWithProviders type if static eval fails (#37126)
Tip revision: 305b5a3
File Mode Size
.circleci
.devcontainer
.github
.ng-dev
.vscode
.yarn
aio
dev-infra
docs
goldens
integration
modules
packages
scripts
third_party
tools
.bazelignore -rw-r--r-- 4.3 KB
.bazelrc -rw-r--r-- 6.5 KB
.bazelversion -rw-r--r-- 213 bytes
.clang-format -rw-r--r-- 73 bytes
.editorconfig -rw-r--r-- 245 bytes
.gitattributes -rw-r--r-- 314 bytes
.gitignore -rw-r--r-- 655 bytes
.mailmap -rw-r--r-- 51 bytes
.nvmrc -rw-r--r-- 8 bytes
.pullapprove.yml -rw-r--r-- 35.8 KB
.yarnrc -rw-r--r-- 128 bytes
BUILD.bazel -rw-r--r-- 1.6 KB
CHANGELOG.md -rw-r--r-- 704.7 KB
CODE_OF_CONDUCT.md -rw-r--r-- 1.1 KB
CONTRIBUTING.md -rw-r--r-- 13.5 KB
LICENSE -rw-r--r-- 1.1 KB
README.md -rw-r--r-- 1.2 KB
WORKSPACE -rw-r--r-- 4.3 KB
browser-providers.conf.js -rw-r--r-- 8.9 KB
gulpfile.js -rw-r--r-- 1.2 KB
karma-js.conf.js -rw-r--r-- 7.6 KB
package.json -rw-r--r-- 8.1 KB
shims_for_IE.js -rw-r--r-- 117.0 KB
test-events.js -rw-r--r-- 259 bytes
test-main.js -rw-r--r-- 11.3 KB
tslint.json -rw-r--r-- 2.3 KB
yarn.lock -rw-r--r-- 624.4 KB
yarn.lock.readme.md -rw-r--r-- 1.3 KB

README.md

back to top