Files
sdk/tests/language/factory1_test.dart
T
regis@google.com 40276f8c30 Fix result type checking of factory constructors of generic classes in VM.
Add a language test.
Fix some language tests.
Fix runtime library.
Note: This does not yet fix result checking of redirecting factories.
Review URL: https://codereview.chromium.org//11369168

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14769 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-09 23:51:06 +00:00

27 lines
627 B
Dart

// Copyright (c) 2012, 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.
// Dart test program for testing factory generic result types.
class A<T> {
A() { }
factory A.factory() {
return new A<String>();
}
}
class B<T> extends A<T> {
B() { }
factory B.factory() {
return new B<String>();
}
}
main() {
new A<String>.factory();
new A<int>.factory(); /// 00: dynamic type error
new B<String>.factory();
new B<int>.factory(); /// 01: dynamic type error
}