fix(compiler): report errors properly in G3 in certain conditions (#20041)

Condition: static analysis error, given:
- noResolve:true
- generateCodeForLibraries: false
- CompilerHost.getSourceFile throws on non existent files

All of these are true in G3.
PR Close #20041
This commit is contained in:
Tobias Bosch
2017-10-30 16:03:22 -07:00
committed by Matias Niemelä
parent 951bd33b09
commit 54480f7dfc
2 changed files with 46 additions and 25 deletions

View File

@ -456,13 +456,13 @@ class AngularCompilerProgram implements Program {
};
let rootNames = this.rootNames;
let rootNames = [...this.rootNames];
if (this.options.generateCodeForLibraries !== false) {
// if we should generateCodeForLibraries, never include
// generated files in the program as otherwise we will
// ovewrite them and typescript will report the error
// TS5055: Cannot write file ... because it would overwrite input file.
rootNames = this.rootNames.filter(fn => !GENERATED_FILES.test(fn));
rootNames = rootNames.filter(fn => !GENERATED_FILES.test(fn));
}
if (this.options.noResolve) {
this.rootNames.forEach(rootName => {