Skip to content

Fixes #2668. Reorder switch expressions to avoid flow analysis secondary issues #2693

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

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,14 @@ int test6(S s) {
}
}


void main() {
S s = F();

var i0 = switch (s) { C _ => 1, F _ => 2 };
// ^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

int i1 = switch (s) { C _ => 1 };
// ^^^^^^
// [analyzer] unspecified
Expand All @@ -91,10 +96,9 @@ void main() {
// [analyzer] unspecified
// [cfe] unspecified

// The same as `i0` but the error is not reported. It's flow analysis issue
// described in #53392. Considered Ok.
var i4 = switch (s) { C _ => 1, F _ => 2 };
// ^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

final i5 = switch (s) { M _ => 1, F _ => 2 };
// ^^^^^^
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ int test6(S s) {

void main() {
S s = F();
var i0 = switch (s) { C() => 1, F() => 2 };
// ^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

int i1 = switch (s) { C() => 1 };
// ^^^^^^
// [analyzer] unspecified
Expand All @@ -90,10 +95,9 @@ void main() {
// [analyzer] unspecified
// [cfe] unspecified

// The same as `i0` but the error is not reported. It's flow analysis issue
// described in #53392. Considered Ok.
var i4 = switch (s) { C() => 1, F() => 2 };
// ^^^^^^
// [analyzer] unspecified
// [cfe] unspecified

final i5 = switch (s) { M() => 1, F() => 2 };
// ^^^^^^
Expand Down