fix(compiler): template type checking not reporting diagnostics for incompatible type comparisons#52322
Closed
crisbeto wants to merge 1 commit intoangular:mainfrom
Closed
fix(compiler): template type checking not reporting diagnostics for incompatible type comparisons#52322crisbeto wants to merge 1 commit intoangular:mainfrom
crisbeto wants to merge 1 commit intoangular:mainfrom
Conversation
crisbeto
commented
Oct 23, 2023
Member
Author
There was a problem hiding this comment.
Note that this diagnostic isn't the best, but it's a side-effect of us having to use if instead of switch to represent the expression. We can't do much about it for now, but it'll be fixed automatically once we go back to using switch statements in the TCB.
…ncompatible type comparisons In angular#52110 the compiler was changed to produce `if` statements when type checking `@switch` in order to avoid a bug in the TypeScript compiler. In order to avoid duplicate diagnostics, the main `@switch` expression was ignored in each of the `@case` comparisons. This appears to have caused a regression where comparing incompatible types wasn't being reported anymore. These changes resolve the issue by wrapping the expression in parentheses which allows the compiler to report comparison diagnostics while ignoring diagnostics in the expression itself. Fixes angular#52315.
6bd2ee8 to
5f453db
Compare
JoostK
approved these changes
Oct 23, 2023
Contributor
|
This PR was merged into the repository by commit dc3f7cb. |
dylhunn
pushed a commit
that referenced
this pull request
Oct 23, 2023
…ncompatible type comparisons (#52322) In #52110 the compiler was changed to produce `if` statements when type checking `@switch` in order to avoid a bug in the TypeScript compiler. In order to avoid duplicate diagnostics, the main `@switch` expression was ignored in each of the `@case` comparisons. This appears to have caused a regression where comparing incompatible types wasn't being reported anymore. These changes resolve the issue by wrapping the expression in parentheses which allows the compiler to report comparison diagnostics while ignoring diagnostics in the expression itself. Fixes #52315. PR Close #52322
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
ChellappanRajan
pushed a commit
to ChellappanRajan/angular
that referenced
this pull request
Jan 23, 2024
…ncompatible type comparisons (angular#52322) In angular#52110 the compiler was changed to produce `if` statements when type checking `@switch` in order to avoid a bug in the TypeScript compiler. In order to avoid duplicate diagnostics, the main `@switch` expression was ignored in each of the `@case` comparisons. This appears to have caused a regression where comparing incompatible types wasn't being reported anymore. These changes resolve the issue by wrapping the expression in parentheses which allows the compiler to report comparison diagnostics while ignoring diagnostics in the expression itself. Fixes angular#52315. PR Close angular#52322
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In #52110 the compiler was changed to produce
ifstatements when type checking@switchin order to avoid a bug in the TypeScript compiler. In order to avoid duplicate diagnostics, the main@switchexpression was ignored in each of the@casecomparisons. This appears to have caused a regression where comparing incompatible types wasn't being reported anymore.These changes resolve the issue by wrapping the expression in parentheses which allows the compiler to report comparison diagnostics while ignoring diagnostics in the expression itself.
Fixes #52315.