dart-sdk/tests/language/sync_star/nested_subtype_test.dart
Clement Skau 90652bc314 [VM] Fixes nested sync* w. diff. types.
Makes the synthetic sync* iterator dynamic to allow the internal,
synthetic sync* code to handle nested iterators of differing types.

Bug: https://github.com/dart-lang/sdk/issues/42234
Change-Id: I309885b27555142cd7f8ab13a5637b35545f1d44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160071
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2020-09-03 11:48:44 +00:00

21 lines
384 B
Dart

// Copyright (c) 2020, the Dart Team. All rights reserved. Use of this
// source code is governed by a BSD-style license that can be found in
// the LICENSE file.
// Regression test for: https://github.com/dart-lang/sdk/issues/42234
Iterable<Object> f() sync* {
yield* g();
}
Iterable<int> g() sync* {
yield 1;
yield 2;
}
main() {
for (var i in f()) {
print(i);
}
}