Skip to content
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

Assertion on late error variable in NNBD version of Future.wait is too early #41656

Closed
leafpetersen opened this issue Apr 24, 2020 · 1 comment
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
Milestone

Comments

@leafpetersen
Copy link
Member

The following program causes a late initialization error when run with the NNBD SDK and asserts enabled:

import 'dart:async';

Future test() async {
  try {
    var f1 = Future(() => throw "Error");
    var f2 = Future(() => 3);
    await Future.wait([f1, f2], eagerError : true);
  } catch (_) {
    return -1;
  }
  return 0;
}

void main() async {
  var f = test();
  await f;
}

The assert on line 415 that was added is too early. In the case that eagerError is true and an earlier future has thrown an error, values may have been set to null but error has not yet been set.

@leafpetersen leafpetersen added the area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. label Apr 24, 2020
@leafpetersen leafpetersen self-assigned this Apr 24, 2020
@franklinyow franklinyow added this to the D29 Release milestone Apr 24, 2020
@leafpetersen
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
Projects
None yet
Development

No branches or pull requests

2 participants