dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.07k stars 1.56k forks source link

VM doesn't await future returned by cancel call in await-for. #28974

Open lrhn opened 7 years ago

lrhn commented 7 years ago

Example:

mkStream() async* { try { while (true) yield 0; } finally { throw "error"; } }
main() async {
  try {
    await for (var i in mkStream()) {
      break;
    }
    print("Should not get here!");
  } on String catch (e) {
    print(e);  // Should print "error'.
  }
}

What actually happens is that it prints "Should not get here!" followed by "error" as an uncaught top-level error.

nex3 commented 7 years ago

Looks like the status line here is wrong. It's currently

[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dartium || $runtime == drt) || ($compiler == none || $compiler == app_jit) ]

but the || between the two parenthesized sections should be &&. As it stands, it expects a RuntimeError for dart2js on DRT, which is inaccurate.

lrhn commented 7 years ago

Good catch, that's probably why it made things worse, not better.

ErikCorryGoogle commented 7 years ago

Had to adjust the line again: see https://codereview.chromium.org/2738353004/

kevmoo commented 6 years ago

Fixed in https://github.com/dart-lang/sdk/commit/a259896d7d426bdd55f7f4fa60c12d79edaa60f2 ?

lrhn commented 6 years ago

The issue isn't done until the status file line can be removed.