-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Awaiting for a Future
returning a class that implements Finalizable
in a for-in
loop causes a crash
#51538
Comments
/cc @dcharkes |
Thanks @halildurmus for the report! I can reproduce this issue. We have some strange interaction going on between the sync transformer and the
We end up with a reachabilityFence of the I'll investigate what the proper solution is. |
Fix underway: https://dart-review.googlesource.com/c/sdk/+/286182 |
Thank you, @dcharkes |
More funny code: import 'dart:ffi';
class Foo implements Finalizable {
Foo? next;
}
Future<Foo> bar() => Future.value(Foo());
void main() async {
for (Foo? element = await bar(); element != null; element = element.next) {
print(element);
}
} But here it's actually correct to use |
This is to avoid a few Dart compiler bugs related to Finalizable objects: - dart-lang/sdk#54414 - dart-lang/sdk#52596 - dart-lang/sdk#51538
This is to avoid a few Dart compiler bugs related to Finalizable objects: - dart-lang/sdk#54414 - dart-lang/sdk#52596 - dart-lang/sdk#51538
* Bump required sdk version to ^3.3.0 This is to avoid a few Dart compiler bugs related to Finalizable objects: - dart-lang/sdk#54414 - dart-lang/sdk#52596 - dart-lang/sdk#51538 * Update CHANGELOG
Running the above program causes this crash:
Dart version:
If class
Foo
does not implement theFinalizable
or the expressionawait bar()
is stored in a variable:... the program no longer crashes.
The text was updated successfully, but these errors were encountered: