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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(compiler-cli): produce template diagnostics error messages #17125

Merged
merged 1 commit into from Jun 1, 2017

Conversation

Projects
None yet
5 participants
@chuckjaz
Member

chuckjaz commented May 30, 2017

Refactoring the compiler to use transformers moves the code generation
after type-checking which suppresses the errors TypeScript would
generate in the user code.

TypeChecker currently produces the same factory code that was
generated prior the switch to transfomers getting back the same
diagnostics as before. The refactoring will allow the code to
diverge from the factory code to allow better diagnostic error
messages that was previously possible by type-checking the factories.

What kind of change does this PR introduce? (check one with "x")

[x] Feature

What is the new behavior?

TypeScript can be used to diagnose type errors in templates without requiring the factories to be in TypeScript.

Does this PR introduce a breaking change? (check one with "x")

[ ] Yes
[x] No

@googlebot googlebot added the cla: yes label May 30, 2017

@mary-poppins

This comment has been minimized.

Show comment
Hide comment
@mary-poppins

mary-poppins May 30, 2017

The angular.io preview for fafc7c9 is available here.

mary-poppins commented May 30, 2017

The angular.io preview for fafc7c9 is available here.

getDiagnostics(fileName?: string): Diagnostic[] {
return fileName ?
this.diagnosticsByFileName.get(fileName) || [] :
([] as Diagnostic[]).concat(...Array.from(this.diagnosticsByFileName.values()));

This comment has been minimized.

@tbosch

tbosch Jun 1, 2017

Member

why the concat?

@tbosch

tbosch Jun 1, 2017

Member

why the concat?

This comment has been minimized.

@chuckjaz

chuckjaz Jun 1, 2017

Member

It is a quick way to flatten the Diagnostic[][] into a Diagnostic[].

@chuckjaz

chuckjaz Jun 1, 2017

Member

It is a quick way to flatten the Diagnostic[][] into a Diagnostic[].

@tbosch

tbosch approved these changes Jun 1, 2017

feat(compiler-cli): produce template diagnostics error messages
Refactoring the compiler to use transformers moves the code generation
after type-checking which suppresses the errors TypeScript would
generate in the user code.

`TypeChecker` currently produces the same factory code that was
generated prior the switch to transfomers, getting back the same
diagnostics as before. The refactoring will allow the code to
diverge from the factory code and allow better diagnostic error
messages than was previously possible by type-checking the factories.
@mary-poppins

This comment has been minimized.

Show comment
Hide comment
@mary-poppins

mary-poppins Jun 1, 2017

The angular.io preview for b7bde49 is available here.

mary-poppins commented Jun 1, 2017

The angular.io preview for b7bde49 is available here.

@vicb vicb merged commit 230255f into angular:master Jun 1, 2017

4 checks passed

ci/circleci Your tests passed on CircleCI!
Details
cla/google All necessary CLAs are signed
code-review/pullapprove Approved by all reviewer groups.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

asnowwolf added a commit to asnowwolf/angular that referenced this pull request Aug 11, 2017

feat(compiler-cli): produce template diagnostics error messages (#17125)
Refactoring the compiler to use transformers moves the code generation
after type-checking which suppresses the errors TypeScript would
generate in the user code.

`TypeChecker` currently produces the same factory code that was
generated prior the switch to transfomers, getting back the same
diagnostics as before. The refactoring will allow the code to
diverge from the factory code and allow better diagnostic error
messages than was previously possible by type-checking the factories.

juleskremer added a commit to juleskremer/angular that referenced this pull request Aug 28, 2017

feat(compiler-cli): produce template diagnostics error messages (#17125)
Refactoring the compiler to use transformers moves the code generation
after type-checking which suppresses the errors TypeScript would
generate in the user code.

`TypeChecker` currently produces the same factory code that was
generated prior the switch to transfomers, getting back the same
diagnostics as before. The refactoring will allow the code to
diverge from the factory code and allow better diagnostic error
messages than was previously possible by type-checking the factories.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment