Skip to content

dart2wasm fails inside sync* functions with a switch statement #55839

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
jthlim opened this issue May 25, 2024 · 6 comments
Closed

dart2wasm fails inside sync* functions with a switch statement #55839

jthlim opened this issue May 25, 2024 · 6 comments
Labels
area-dart2wasm Issues for the dart2wasm compiler. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@jthlim
Copy link

jthlim commented May 25, 2024

Using: Dart SDK version: 3.4.1 (stable) (Tue May 21 15:46:25 2024 +0000) on "macos_arm64"

Having a sync* function with a switch in it causes dart2wasm to fail:

Not implemented: switch in sync* at <file location>'

Changing the switch to a series of if/else avoids this issue.

Simple repro:

Iterable<int> test(int n) sync* {
  switch (n) {
    case 0:
    case 1:
      yield n;
  }
}

void main() {
  test(0);
}

flutter build web --wasm

Gives:
Not implemented: switch in sync* at file:////main.dart:9:3

@lrhn
Copy link
Member

lrhn commented May 25, 2024

I believe this is a known missing feature: #51342

@lrhn lrhn added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) area-dart2wasm Issues for the dart2wasm compiler. labels May 25, 2024
@mkustermann
Copy link
Member

This has since been implemented. I believe this has also rolled up to flutter/flutter main channel.

The changes are somewhat big and sync* is a infrequently used feature, so I'm slightly hestitant whether we should cherry pick it. But if the changes cherry-pick cleanly without merge conflicts, I'd be inclined to pick them.

@osa1 Could you see if they cherry-pick cleanly on the stable branch? If so, follow https://github.com/dart-lang/sdk/blob/main/docs/Cherry-picks-to-a-release-channel.md to file a CP request.

@osa1
Copy link
Member

osa1 commented May 27, 2024

@mkustermann we can't cherry pick just the sync* features, we need to cherry pick 8ccb412 and maybe 350954a as well.

@mkustermann
Copy link
Member

@mkustermann we can't cherry pick just the sync* features, we need to cherry pick 8ccb412 and maybe 350954a as well.

Yes. If all 3 on top of each other merge without conflicts, we may consider picking it.

@jthlim
Copy link
Author

jthlim commented May 27, 2024

Appreciate the activity/urgency!

I'm happy to wait for stable or switch to master to test the feature; rather than cause trouble with an out of band release/cherry pick

@osa1
Copy link
Member

osa1 commented May 27, 2024

@mkustermann PTAL: #55847

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-dart2wasm Issues for the dart2wasm compiler. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

4 participants