Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ivy: compiler errors are not fully displayed on rebuild #32213

Closed
filipesilva opened this issue Aug 20, 2019 · 2 comments

Comments

@filipesilva
Copy link
Member

@filipesilva filipesilva commented Aug 20, 2019

馃悶 bug report

Affected Package

The issue is caused by package @angular/compiler-cli

Is this a regression?

I don't know

Description

AOT errors are only fully displayed on initial build. On rebuilds, the line numbers and erroneous code are not displayed.

馃敩 Minimal Reproduction

  • npm install -g @angular/cli@next
  • ng new ivy-rebuild-project && cd ivy-rebuild-project
  • introduce an AOT error by replacing selector: 'app-root', with selector: (() => 'app-root')(), in src/app/app.component.ts
  • update Angular Framework versions to 9.0.0-next.2
  • set angularCompilerOptions.enableIvy to true in tsconfig.json if it's not there
  • run yarn ngc -p tsconfig.app.json -w
  • wait for the build error message, see that it contains all information
  • remove the AOT error and save the file
  • wait for the successful build
  • re-introduce the error
  • wait for the build error message, see that it contains partial information

馃敟 Exception or Error


kamik@RED-X1C6 MINGW64 /d/sandbox/snapshot-project (master)
$ yarn ngc -p tsconfig.app.json -w
yarn run v1.12.3
$ D:\sandbox\snapshot-project\node_modules\.bin\ngc -p tsconfig.app.json -w
src/app/app.component.ts(4,13): error TS-991010: selector must be a string

Compilation failed. Watching for file changes.

src/app/app.component.ts:4:13 - error NG1010: selector must be a string

4   selector: (() => 'app-root')(),
              ~~~~~~~~~~~~~~~~~~~~


File change detected. Starting incremental compilation.

Compilation complete. Watching for file changes.

File change detected. Starting incremental compilation.

src/app/app.component.ts(4,13): error TS-991010: selector must be a string

Compilation failed. Watching for file changes.

Note that the first build had errors with line numbers and example, but the second one did not.

馃實 Your Environment

Angular Version:


Angular CLI: 8.3.0-rc.0
Node: 10.16.0
OS: win32 x64
Angular: 9.0.0-next.2
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.0-rc.0
@angular-devkit/build-angular     0.803.0-rc.0
@angular-devkit/build-optimizer   0.803.0-rc.0
@angular-devkit/build-webpack     0.803.0-rc.0
@angular-devkit/core              8.3.0-rc.0
@angular-devkit/schematics        8.3.0-rc.0
@angular/cli                      8.3.0-rc.0
@ngtools/webpack                  8.3.0-rc.0
@schematics/angular               8.3.0-rc.0
@schematics/update                0.803.0-rc.0
rxjs                              6.4.0
typescript                        3.5.3
webpack                           4.39.2

Anything else relevant?

@alxhub

This comment has been minimized.

Copy link
Contributor

@alxhub alxhub commented Aug 20, 2019

It would appear that the watch mode uses a different method to print out ts.Diagnostics. This should be a trivial fix.

@IgorMinar

This comment has been minimized.

Copy link
Member

@IgorMinar IgorMinar commented Nov 16, 2019

@alxhub says that #33862 should fix this one as well

@IgorMinar IgorMinar modified the milestones: v9-candidates, v9-blockers Nov 16, 2019
alxhub added a commit to alxhub/angular that referenced this issue Nov 16, 2019
Previously, the ngtsc compiler attempted to reuse analysis work from the
previous program during an incremental build. To do this, it had to prove
that the work was safe to reuse - that no changes made to the new program
would invalidate the previous analysis.

The implementation of this had a significant design flaw: if the previous
program had errors, the previous analysis would be missing significant
information, and the dependency graph extracted from it would not be
sufficient to determine which files should be re-analyzed to fill in the
gaps. This often meant that the build output after an error was resolved
would be wholly incorrect.

This commit switches ngtsc to take a simpler approach to incremental
rebuilds. Instead of attempting to reuse prior analysis work, the entire
program is re-analyzed with each compilation. This is actually not as
expensive as one might imagine - analysis is a fairly small part of overall
compilation time.

Based on the dependency graph extracted during this analysis, the compiler
then can make accurate decisions on whether to emit specific files. A new
suite of tests is added to validate behavior in the presence of source code
level errors.

This new approach is dramatically simpler than the previous algorithm, and
should always produce correct results for a semantically correct program.s

Fixes angular#32388
Fixes angular#32214
Fixes angular#32213
alxhub added a commit to alxhub/angular that referenced this issue Nov 16, 2019
This commit changes the reporting of watch mode diagnostics for ngtsc to use
the same formatting as non-watch mode diagnostics. This prints rich and
contextual errors even in watch mode, which previously was not the case.

Fixes angular#32213
alxhub added a commit to alxhub/angular that referenced this issue Nov 18, 2019
This commit changes the reporting of watch mode diagnostics for ngtsc to use
the same formatting as non-watch mode diagnostics. This prints rich and
contextual errors even in watch mode, which previously was not the case.

Fixes angular#32213
alxhub added a commit to alxhub/angular that referenced this issue Nov 19, 2019
This commit changes the reporting of watch mode diagnostics for ngtsc to use
the same formatting as non-watch mode diagnostics. This prints rich and
contextual errors even in watch mode, which previously was not the case.

Fixes angular#32213
alxhub added a commit that referenced this issue Nov 20, 2019
This commit changes the reporting of watch mode diagnostics for ngtsc to use
the same formatting as non-watch mode diagnostics. This prints rich and
contextual errors even in watch mode, which previously was not the case.

Fixes #32213

PR Close #33862
@alxhub alxhub closed this in 97fbdab Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can鈥檛 perform that action at this time.