8000 fix(compiler): produce more accurate errors for interpolations by crisbeto · Pull Request #62258 · angular/angular · GitHub
[go: up one dir, main page]

Skip to content

fix(compiler): produce more accurate errors for interpolations #62258

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

Closed
wants to merge 1 commit into from

Conversation

crisbeto
Copy link
Member

Currently when there's a parser error in interpolated text, the compiler reports an error on the entire text node. This can be really noisy in long strings.

These changes switch to reporting the errors on the specific expressions that caused them.

@crisbeto crisbeto requested a review from AndrewKushnir June 25, 2025 08:40
@crisbeto crisbeto added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Jun 25, 2025
@angular-robot angular-robot bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Jun 25, 2025
@ngbot ngbot bot added this to the Backlog milestone Jun 25, 2025
it('should report parsing errors on the specific interpolated expressions', () => {
const errors = parse(
`
bunch of text bunch of text bunch of text bunch of text bunch of text bunch of text
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference, the current code will report 3 errors, each of which covers the entire string including the plain text. With the changes the errors are only reported on interpolations.

Currently when there's a parser error in interpolated text, the compiler reports an error on the entire text node. This can be really noisy in long strings.

These changes switch to reporting the errors on the specific expressions that caused them.
@crisbeto crisbeto force-pushed the interpolation-error-spans branch from b333f43 to 497e71e Compare June 25, 2025 09:12
Copy link
Contributor
@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the improvement @crisbeto 👍

@AndrewKushnir AndrewKushnir removed the action: review The PR is still awaiting reviews from at least one requested reviewer label Jun 25, 2025
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels Jun 25, 2025
@thePunderWoman
Copy link
Contributor

This PR was merged into the repository by commit 089ad0e.

The changes were merged into the following branches: main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0