mirror of
https://github.com/dart-lang/sdk
synced 2024-09-19 15:01:29 +00:00
9693e47d89
Tests that have begun failing due to this change are marked with a reference to issue #31402. Change-Id: Id570bf354583a3780087ffc820eefc3619573af4 Reviewed-on: https://dart-review.googlesource.com/22842 Commit-Queue: Paul Berry <paulberry@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
23 lines
514 B
Dart
23 lines
514 B
Dart
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import "package:expect/expect.dart";
|
|
|
|
class A {}
|
|
|
|
class B extends A {}
|
|
|
|
Iterable<B> f(Iterable<A> a) sync* {
|
|
yield* a;
|
|
}
|
|
|
|
void main() {
|
|
B b = new B();
|
|
for (var x in f(<B>[b])) {} // No error
|
|
var iterator = f(<A>[b]).iterator;
|
|
Expect.throwsTypeError(() {
|
|
iterator.moveNext();
|
|
});
|
|
}
|