We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Tested on newest master 3.2.0-77.0.dev.
3.2.0-77.0.dev
When performing a pattern match using a record pattern, the diagnostic warning PATTERN_NEVER_MATCHES_VALUE_TYPE will not be raised when expected to.
When shape of a record does not match:
void f(({int a, int b}) x) { // no pattern_never_matches_value_type raised if (x case (:int f1, :int f2,)) {} }
In fact the type of the matched upon value does not matter, the warning will not be raised even for the following:
void f(int x) { // no pattern_never_matches_value_type raised if (x case (:String hello)) {} }
However when the record is used as a type pattern, the warning is correctly raised:
void f(({int f1,}) x) { // warning is raised if (x case ({int f1, int f2,}) _) {} }
Finally, this doesn't seem to be a general problem with destructuring patterns, because for example a list pattern does raise the warning:
void f(int x) { // warning is raised if (x case [String t]) {} }
Potentially related previous work: #52103
If this is not expected and needs a fix, I would love to dedicate a weekend to dig into this if outside contribution will be welcome here.
The text was updated successfully, but these errors were encountered:
https://dart-review.googlesource.com/c/sdk/+/323685
Sorry, something went wrong.
Issue 53405. Report PATTERN_NEVER_MATCHES_VALUE_TYPE got record patte…
42d8cdf
…rns. Bug: #53405 Change-Id: I139fc620f10f18ab2b44b806ab24fa09e9956f61 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/323685 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
scheglov
No branches or pull requests
Tested on newest master
3.2.0-77.0.dev
.When performing a pattern match using a record pattern, the diagnostic warning PATTERN_NEVER_MATCHES_VALUE_TYPE will not be raised when expected to.
Examples
When shape of a record does not match:
In fact the type of the matched upon value does not matter, the warning will not be raised even for the following:
However when the record is used as a type pattern, the warning is correctly raised:
Finally, this doesn't seem to be a general problem with destructuring patterns, because for example a list pattern does raise the warning:
Potentially related previous work: #52103
If this is not expected and needs a fix, I would love to dedicate a weekend to dig into this if outside contribution will be welcome here.
The text was updated successfully, but these errors were encountered: