Chromium Code Reviews| Index: tests/language/src/CyclicTypeVariableTest.dart |
| diff --git a/tests/language/src/CyclicTypeVariableTest.dart b/tests/language/src/CyclicTypeVariableTest.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f3f95fe22f67997a7c3c2950141cfb594a7a4629 |
| --- /dev/null |
| +++ b/tests/language/src/CyclicTypeVariableTest.dart |
| @@ -0,0 +1,48 @@ |
| +// 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. |
| + |
| +// Tests cyclic reference to type variables in type expressions |
| + |
| +typedef void funcType<T |
| +extends T /// 01: static type error |
| +>(T arg); |
|
gbracha
2012/01/11 23:04:34
We don't have generic functions (or even factories
mmendez
2012/01/12 15:29:50
Unless there is some other countering clause, I th
|
| + |
| + |
| +interface A<S |
|
mmendez
2012/01/12 15:29:50
This should be a warning per the spec.
zundel
2012/01/12 15:33:59
Yes. the 'static type error' is at the warning l
|
| +extends S /// 02: static type error |
| +> { |
| + S field; |
| +} |
| + |
| +interface B<U |
| +extends List<U> /// 03: static type error |
|
gbracha
2012/01/11 23:04:34
This should be perfectly legal.
zundel
2012/01/12 12:53:55
How could you make a legal substitution into this?
|
| +> { |
| + U field; |
| +} |
| + |
| +class C<V |
| +extends V /// 04: static type error |
| +> implements A<V> { |
| + V field; |
| +} |
| + |
| +class D<W |
| +extends List<W> /// 05: static type error |
|
gbracha
2012/01/11 23:04:34
Again, this is perfectly valid.
|
| +> implements B<W>{ |
| + W field; |
| +} |
| + |
| + |
| +class E<X |
| +extends funcType<X> /// 06: static type error |
|
gbracha
2012/01/11 23:04:34
Since functType isn't valid, the point is moot, bu
|
| +> { |
| + X field; |
| +} |
| + |
| +main() { |
| + new C<List<Object>>(); |
| + new D<List<Object>>(); |
| + new E<funcType<Object>>(); |
| + funcType<Object> val = null; |
| +} |