Skip to content

strictTemplates implies fullTemplateTypeCheck#34195

Closed
JoostK wants to merge 2 commits intoangular:masterfrom
JoostK:ngtsc-ttc-option-compat
Closed

strictTemplates implies fullTemplateTypeCheck#34195
JoostK wants to merge 2 commits intoangular:masterfrom
JoostK:ngtsc-ttc-option-compat

Conversation

@JoostK
Copy link
Copy Markdown
Member

@JoostK JoostK commented Dec 2, 2019

See individual commits.

@JoostK JoostK added action: review The PR is still awaiting reviews from at least one requested reviewer refactoring Issue that involves refactoring or code-cleanup target: patch This PR is targeted for the next patch release comp: ivy area: compiler Issues related to `ngc`, Angular's template compiler labels Dec 2, 2019
@JoostK JoostK requested a review from a team December 2, 2019 20:40
@ngbot ngbot bot modified the milestone: needsTriage Dec 2, 2019
@JoostK JoostK requested a review from IgorMinar December 2, 2019 21:05
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We could emit this as a diagnostic in getNgOptionDiagnostics. I've never done an option diagnostic though - might be worth a shot.

@JoostK JoostK force-pushed the ngtsc-ttc-option-compat branch 2 times, most recently from e08f2df to 9d1251e Compare December 5, 2019 21:17
@JoostK JoostK added action: merge The PR is ready for merge by the caretaker action: presubmit The PR is in need of a google3 presubmit and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 5, 2019
@AndrewKushnir
Copy link
Copy Markdown
Contributor

Presubmit

Copy link
Copy Markdown
Contributor

@IgorMinar IgorMinar left a comment

Choose a reason for hiding this comment

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

I suggest we clean up the docs a bit more. See individual commits.

thanks for making this change.

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 find this condition very misleading and confusing. I always have even before this change.

How about:

const templateTypeCheck = (strictTemplates || !!this.options.fullTemplateTypeCheck) && this.options.ivyTemplateTypeCheck !== false;

if (!templateTypeCheck) {
  return [];
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You are not alone, it confuses me just as much as it confuses you :-)

Your suggestion, however, is not equivalent to the current logic. Currently, even if "ivyTemplateTypeCheck" is false will typechecking still be enabled if "fullTemplateTypeCheck"/"strictTemplates" is set. Your suggestion as I interpret it would not behave the same, as having "ivyTemplateTypeCheck" set to false would completely disable type-checking under all circumstances.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm okay with the behavior change. If you're curious, the logic worked this way because fullTemplateTypeCheck is easy to control as an option of the ng_module build rule. So I could set ivyTemplateTypeCheck to false in bazel/g3, and then set fullTemplateTypeCheck via the ng_module option when I wanted to test type-checking in g3 projects.

This logic predates the strictTemplates though - now setting fullTemplateTypeCheck isn't enough. So I'm happy to change it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@alxhub Can we get rid of ivyTemplateTypeCheck entirely? non-fTTC should be at the same level asa it was in VE, so there's shouldn't be a special flag for disabling TTC in g3?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I've been looking into what it would take to do this in g3, and there's a number of issues preventing it at the moment. So I think we should wait for now.

@JoostK JoostK added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Dec 6, 2019
@AndrewKushnir AndrewKushnir removed action: presubmit The PR is in need of a google3 presubmit action: merge The PR is ready for merge by the caretaker labels Dec 6, 2019
@JoostK JoostK force-pushed the ngtsc-ttc-option-compat branch from 9d1251e to d918d11 Compare December 6, 2019 22:04
@JoostK JoostK added action: review The PR is still awaiting reviews from at least one requested reviewer and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Dec 6, 2019
@JoostK
Copy link
Copy Markdown
Member Author

JoostK commented Dec 6, 2019

@IgorMinar thanks for the review, your suggestions have been applied.

It is now an error if '"fullTemplateTypeCheck"' is disabled while
`"strictTemplates"` is enabled, as enabling the latter implies that the
former is also enabled.
Previously, it was required that both `fullTemplateTypeCheck` and
`strictTemplates` had to be enabled for strict mode to be enabled. This
is strange, as `strictTemplates` implies `fullTemplateTypeCheck`. This
commit makes setting the `fullTemplateTypeCheck` flag optional so that
strict mode can be enabled by just setting `strictTemplates`.
@JoostK JoostK force-pushed the ngtsc-ttc-option-compat branch from d918d11 to 25abc5a Compare December 19, 2019 20:51
@JoostK JoostK added action: merge The PR is ready for merge by the caretaker action: presubmit The PR is in need of a google3 presubmit and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 19, 2019
@alxhub
Copy link
Copy Markdown
Member

alxhub commented Dec 20, 2019

Presubmit
Ivy Presubmit

@alxhub alxhub dismissed IgorMinar’s stale review January 6, 2020 19:07

Comments have been addressed!

@alxhub alxhub closed this in 2e82357 Jan 6, 2020
alxhub pushed a commit that referenced this pull request Jan 6, 2020
…34195)

Previously, it was required that both `fullTemplateTypeCheck` and
`strictTemplates` had to be enabled for strict mode to be enabled. This
is strange, as `strictTemplates` implies `fullTemplateTypeCheck`. This
commit makes setting the `fullTemplateTypeCheck` flag optional so that
strict mode can be enabled by just setting `strictTemplates`.

PR Close #34195
alxhub pushed a commit that referenced this pull request Jan 6, 2020
)

It is now an error if '"fullTemplateTypeCheck"' is disabled while
`"strictTemplates"` is enabled, as enabling the latter implies that the
former is also enabled.

PR Close #34195
alxhub pushed a commit that referenced this pull request Jan 6, 2020
…34195)

Previously, it was required that both `fullTemplateTypeCheck` and
`strictTemplates` had to be enabled for strict mode to be enabled. This
is strange, as `strictTemplates` implies `fullTemplateTypeCheck`. This
commit makes setting the `fullTemplateTypeCheck` flag optional so that
strict mode can be enabled by just setting `strictTemplates`.

PR Close #34195
@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 Feb 6, 2020
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 action: presubmit The PR is in need of a google3 presubmit area: compiler Issues related to `ngc`, Angular's template compiler cla: yes refactoring Issue that involves refactoring or code-cleanup 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