Skip to content

LanguageFeatures/Extension-types/exhaustiveness_map_A02_t02 needs updating for CL 345822 #2502

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

Closed
stereotype441 opened this issue Jan 23, 2024 · 1 comment
Assignees
Labels
bad-test Report tests in need of updates. When closed, the tests should be considered good

Comments

@stereotype441
Copy link
Member

CL 345822 (which addresses dart-lang/language#3534) modifies flow analysis so that recognizes when a single pattern is guaranteed to match because its erased type is either the same as, or a supertype of, the erased type of the matched value. This partially addresses a situation where a switch statement is recognized by the exhaustiveness checker as exhaustive, but not by flow analysis.

Such a situation occurs in LanguageFeatures/Extension-types/exhaustiveness_map_A02_t02:

extension type ET1<K, V>(Map<K, V> _) {}

String test(ET1<bool, bool> m) {
//     ^^^^
// [analyzer] unspecified
// [cfe] unspecified
  switch (m) {
    ...
    case Map():
      return "other";
  }
}

Currently the above code expects an error, because flow analysis cannot tell that the pattern Map() is guaranteed to match the extension type ET1<bool, bool>. After the CL lands, flow analysis will recognize that the Map() pattern is guarnateed to match, so there will be no error.

@sgrekhov sgrekhov self-assigned this Jan 24, 2024
@sgrekhov sgrekhov added the bad-test Report tests in need of updates. When closed, the tests should be considered good label Jan 24, 2024
@sgrekhov
Copy link
Contributor

Fixed by #2503

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bad-test Report tests in need of updates. When closed, the tests should be considered good
Projects
None yet
Development

No branches or pull requests

2 participants