Skip to content

refactor(compiler-cli): add makeTemplateDiagnostic wrapper - #42937

Closed
danieltre23 wants to merge 1 commit into
angular:masterfrom
danieltre23:template-diagnostic
Closed

danieltre23 wants to merge 1 commit into
angular:masterfrom
danieltre23:template-diagnostic

Conversation

@danieltre23

@danieltre23 danieltre23 commented Jul 22, 2021 •

Copy link
Copy Markdown
Contributor

Add a makeTemplateDiagnostic wrapper in the TemplateTypeChecker. This requiers less parameters to create template diagnostics, since the TemplateTypeChecker can get the templateId and mapping from it's scope with the ts.ClassDeclartion. The TemplateTypeChecker is often used to determine if a diagnostic should be produced, so it makes sense to have a function in it that helps create them.

Refs #42966

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?

Currently to create a template diagnostic you need to pass the templateId and it's mapping as parameters.

What is the new behavior?

The wrapper function takes the ts.ClassDeclaration and gets the templateId and mapping from it to create the template diagnostic.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@danieltre23 danieltre23 added the target: minor This PR is targeted for the next minor release label Jul 22, 2021
@google-cla

google-cla Bot commented Jul 22, 2021

Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla google-cla Bot added the cla: no label Jul 22, 2021
@danieltre23
danieltre23 force-pushed the template-diagnostic branch from 3777a11 to e6ab28f Compare July 22, 2021 21:19
@google-cla google-cla Bot added cla: yes and removed cla: no labels Jul 22, 2021
@danieltre23
danieltre23 force-pushed the template-diagnostic branch from e6ab28f to ffc7bd2 Compare July 22, 2021 21:27
@dylhunn dylhunn added area: compiler Issues related to `ngc`, Angular's template compiler area: dev-infra Issues related to Angular's own dev infra (build, test, CI, releasing) labels Jul 22, 2021
@ngbot ngbot Bot modified the milestone: Backlog Jul 22, 2021

@atscott atscott left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is minor detail when working with the compiler:

We typically mark these as a refactor rather than feat because there's no publicly facing feature that can be used so we want to avoid adding this to the changelog.

@atscott

atscott commented Jul 22, 2021

Copy link
Copy Markdown
Contributor

I think you could also make the commit message a bit more clear in terms of what's going to be using this new method and defend why it's appropriate to be placed here (i.e. it makes sense for the template type checker to have this method because users of the TemplateTypeChecker could use the typing information available there to determine if a diagnostic should be produced).

Try to provide the whole context in your commit message so if someone were to look at this in isolation, it would still make sense.

@dgp1130 dgp1130 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree with @atscott's comments, but looks good beyond that.

Apologies for the feat() commit message, that was my suggestion as I totally forgot that refactor() existed. Is there any recommendation for whether to target minor or patch with this? It's only needed in minor for future changes, but I'd rather not diverge patch more than we need to.

@danieltre23
danieltre23 force-pushed the template-diagnostic branch from ffc7bd2 to 4f67cf5 Compare July 23, 2021 15:43
@danieltre23 danieltre23 changed the title feat(compiler-cli): add makeTemplateDiagnostic wrapper refactor(compiler-cli): add makeTemplateDiagnostic wrapper Jul 23, 2021
@danieltre23
danieltre23 requested a review from atscott July 23, 2021 15:53
@atscott

atscott commented Jul 23, 2021

Copy link
Copy Markdown
Contributor

Is there any recommendation for whether to target minor or patch with this?

We often merge these types of things to patch to avoid diverging the two branches.

@atscott atscott left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍 LGTM

@atscott

atscott commented Jul 23, 2021

Copy link
Copy Markdown
Contributor

presubmit (unrelated failures, forcing green)

@dgp1130 dgp1130 added target: patch This PR is targeted for the next patch release and removed target: minor This PR is targeted for the next minor release labels Jul 23, 2021
@dgp1130

dgp1130 commented Jul 23, 2021

Copy link
Copy Markdown
Contributor

Targetting patch to avoid unnecessary divergence per @atscott's comment.

@danieltre23
danieltre23 force-pushed the template-diagnostic branch 2 times, most recently from fa257c7 to a1a2d90 Compare July 26, 2021 21:16
@danieltre23
danieltre23 force-pushed the template-diagnostic branch from a1a2d90 to 722e81f Compare July 26, 2021 21:26
Add a `makeTemplateDiagnostic` wrapper in the `TemplateTypeChecker`. This requiers less parameters to create template diagnostics, since the `TemplateTypeChecker` can get the templateId and mapping from it's scope with the `ts.ClassDeclartion`. The `TemplateTypeChecker` is often used to determine if a diagnostic should be produced, so it makes sense to have a function in it that helps create them.

Refs angular#42966
@danieltre23
danieltre23 force-pushed the template-diagnostic branch from 722e81f to f0960f3 Compare July 26, 2021 21:44
@dgp1130 dgp1130 added the action: merge The PR is ready for merge by the caretaker label Jul 26, 2021
dylhunn pushed a commit that referenced this pull request Jul 27, 2021
Add a `makeTemplateDiagnostic` wrapper in the `TemplateTypeChecker`. This requiers less parameters to create template diagnostics, since the `TemplateTypeChecker` can get the templateId and mapping from it's scope with the `ts.ClassDeclartion`. The `TemplateTypeChecker` is often used to determine if a diagnostic should be produced, so it makes sense to have a function in it that helps create them.

Refs #42966

PR Close #42937
@dylhunn dylhunn closed this in 057e577 Jul 27, 2021
@dylhunn

dylhunn commented Jul 27, 2021

Copy link
Copy Markdown
Contributor

This PR must be rolled back, as it caused the patch branch to go red.

dylhunn added a commit to dylhunn/angular that referenced this pull request Jul 27, 2021
@dylhunn

dylhunn commented Jul 27, 2021

Copy link
Copy Markdown
Contributor

#42971 rolls this back in patch branch only.

dylhunn added a commit that referenced this pull request Jul 27, 2021
@angular-automatic-lock-bot

Copy link
Copy Markdown

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 Aug 27, 2021
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 area: dev-infra Issues related to Angular's own dev infra (build, test, CI, releasing) cla: yes target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants