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

Already on GitHub? Sign in to your account

Improve local compilation specific errors #54230

Closed
wants to merge 8 commits into from

Conversation

pmvald
Copy link
Member

@pmvald pmvald commented Feb 3, 2024

As per request from customers, we need to have more clear and actionable error messages for local compilation.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

…ed symbol errors in local compilation mode

A single error code is created to unify the common error pattern in local compilation mode where an imported const cannot be resolved, but needs to be resolved. This mainly happens for Angular decorator fields such as @Component.template.

The error messages are also upgraded to be more centered around this unifying theme.
…OMPILATION_UNRESOLVED_CONST

The trailing error message comes from tracing the chain of DymaicValue which leads to a mostly useless error that highlights the same symbol as the original message and emits the error message "Unknown reference". This error message is removed in the favour of the original message which suffices.
@pmvald pmvald marked this pull request as ready for review February 5, 2024 02:19
@pullapprove pullapprove bot requested a review from atscott February 5, 2024 02:20
@pmvald pmvald changed the title Lcm errors2 Improve local compilation specific errors Feb 5, 2024
@pmvald pmvald added action: review The PR is still awaiting reviews from at least one requested reviewer area: compiler Issues related to `ngc`, Angular's template compiler target: minor This PR is targeted for the next minor release labels Feb 5, 2024
@ngbot ngbot bot modified the milestone: Backlog Feb 5, 2024
Copy link
Contributor

@jessicajaniuk jessicajaniuk left a comment

Choose a reason for hiding this comment

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

reviewed-for: public-api

Copy link
Member

@devversion devversion left a comment

Choose a reason for hiding this comment

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

LGTM. Feel free to add merge ready when addressed

…TION_UNRESOLVED_CONST` in common scenarios

A helper `validateLocalCompilationUnresolvedConst` is added to encapsulate a common pattern which leads to the error `LOCAL_COMPILATION_UNRESOLVED_CONST`.
…styles array for the error LOCAL_COMPILATION_UNRESOLVED_CONST

Currently the whole array is highlighted.
…LATION_UNRESOLVED_CONST when an unresolved symbol used for @component.styles

Currently the correct error message is shown only if @component.styles is an array with some unresolved element. This change supports the new case of string type for the @component.styles field.
… event name in local compilation mode

Currently the error is a generic error "selector must be a string ...". This commit makes the error more specific to local compilation and adds some action items.
…argument in local compilation mode

Currently the error is a generic error "selector must be a string ...". This commit makes the error more specific to local compilation and adds some action items.
…rtAs in local compilation mode

    Currently the error is a generic error "exportAs must be a string ...". This commit makes the error more specific to local compilation and adds some action items.
@pmvald pmvald removed the action: review The PR is still awaiting reviews from at least one requested reviewer label Feb 6, 2024
@pmvald pmvald added the action: merge The PR is ready for merge by the caretaker label Feb 6, 2024
Copy link
Member

@alxhub alxhub left a comment

Choose a reason for hiding this comment

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

Reviewed-for: public-api

jessicajaniuk pushed a commit that referenced this pull request Feb 6, 2024
…OMPILATION_UNRESOLVED_CONST (#54230)

The trailing error message comes from tracing the chain of DymaicValue which leads to a mostly useless error that highlights the same symbol as the original message and emits the error message "Unknown reference". This error message is removed in the favour of the original message which suffices.

PR Close #54230
jessicajaniuk pushed a commit that referenced this pull request Feb 6, 2024
…TION_UNRESOLVED_CONST` in common scenarios (#54230)

A helper `validateLocalCompilationUnresolvedConst` is added to encapsulate a common pattern which leads to the error `LOCAL_COMPILATION_UNRESOLVED_CONST`.

PR Close #54230
jessicajaniuk pushed a commit that referenced this pull request Feb 6, 2024
…styles array for the error LOCAL_COMPILATION_UNRESOLVED_CONST (#54230)

Currently the whole array is highlighted.

PR Close #54230
jessicajaniuk pushed a commit that referenced this pull request Feb 6, 2024
…LATION_UNRESOLVED_CONST when an unresolved symbol used for @component.styles (#54230)

Currently the correct error message is shown only if @component.styles is an array with some unresolved element. This change supports the new case of string type for the @component.styles field.

PR Close #54230
jessicajaniuk pushed a commit that referenced this pull request Feb 6, 2024
… event name in local compilation mode (#54230)

Currently the error is a generic error "selector must be a string ...". This commit makes the error more specific to local compilation and adds some action items.

PR Close #54230
jessicajaniuk pushed a commit that referenced this pull request Feb 6, 2024
…argument in local compilation mode (#54230)

Currently the error is a generic error "selector must be a string ...". This commit makes the error more specific to local compilation and adds some action items.

PR Close #54230
@jessicajaniuk
Copy link
Contributor

This PR was merged into the repository by commit f39cb06.

jessicajaniuk pushed a commit that referenced this pull request Feb 6, 2024
…rtAs in local compilation mode (#54230)

    Currently the error is a generic error "exportAs must be a string ...". This commit makes the error more specific to local compilation and adds some action items.

PR Close #54230
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.

None yet

4 participants