mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 21:51:18 +00:00
98bcbb0dae
as bound errors in checked mode. Added tests. R=srdjan@google.com Review URL: https://codereview.chromium.org//246293008 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35284 260f80e4-7a28-3924-810f-c04153c831b5
33 lines
628 B
Dart
33 lines
628 B
Dart
// Copyright (c) 2014, 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";
|
|
|
|
isCheckedMode() {
|
|
try {
|
|
var i = 1;
|
|
String s = i;
|
|
return false;
|
|
} catch (e) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
class A<T extends num> { }
|
|
|
|
class B<T> {
|
|
test() {
|
|
new A() as A<T>; /// static type warning
|
|
}
|
|
}
|
|
|
|
main () {
|
|
var b = new B<String>();
|
|
if (isCheckedMode()) {
|
|
Expect.throws(() => b.test(), (e) => e is TypeError);
|
|
} else {
|
|
b.test();
|
|
}
|
|
}
|