OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library analyzer.test.src.task.strong.checker_test; | 5 library analyzer.test.src.task.strong.checker_test; |
6 | 6 |
7 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 7 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
8 | 8 |
9 import 'strong_test_helper.dart'; | 9 import 'strong_test_helper.dart'; |
10 | 10 |
(...skipping 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2087 class DerivedFuture3<T> extends Future<T> { | 2087 class DerivedFuture3<T> extends Future<T> { |
2088 /*=S*/ then/*<S>*/(Object onValue(T t)) => null; | 2088 /*=S*/ then/*<S>*/(Object onValue(T t)) => null; |
2089 } | 2089 } |
2090 | 2090 |
2091 class DerivedFuture4<A> extends Future<A> { | 2091 class DerivedFuture4<A> extends Future<A> { |
2092 /*=B*/ then/*<B>*/(Object onValue(A a)) => null; | 2092 /*=B*/ then/*<B>*/(Object onValue(A a)) => null; |
2093 } | 2093 } |
2094 '''); | 2094 '''); |
2095 } | 2095 } |
2096 | 2096 |
| 2097 void test_genericMethodSuper() { |
| 2098 checkFile(r''' |
| 2099 class A<T> { |
| 2100 A<S> create<S extends T>() => new A<S>(); |
| 2101 } |
| 2102 class B extends A { |
| 2103 A<S> create<S>() => super.create<S>(); |
| 2104 } |
| 2105 class C extends A { |
| 2106 A<S> create<S>() => super.create(); |
| 2107 } |
| 2108 class D extends A<num> { |
| 2109 A<S> create<S extends num>() => super.create<S>(); |
| 2110 } |
| 2111 class E extends A<num> { |
| 2112 A<S> create<S extends num>() => /*error:RETURN_OF_INVALID_TYPE*/super.create<i
nt>(); |
| 2113 } |
| 2114 class F extends A<num> { |
| 2115 create2<S>() => super.create</*error:TYPE_ARGUMENT_NOT_MATCHING_BOUNDS*/S>(); |
| 2116 } |
| 2117 '''); |
| 2118 } |
| 2119 |
| 2120 void test_genericMethodSuperSubstitute() { |
| 2121 checkFile(r''' |
| 2122 class Clonable<T> {} |
| 2123 class G<T> { |
| 2124 create<A extends Clonable<T>, B extends Iterable<A>>() => null; |
| 2125 } |
| 2126 class H extends G<num> { |
| 2127 create2() => super.create<Clonable<int>, List<Clonable<int>>>(); |
| 2128 } |
| 2129 '''); |
| 2130 } |
| 2131 |
2097 void test_getterGetterOverride() { | 2132 void test_getterGetterOverride() { |
2098 checkFile(''' | 2133 checkFile(''' |
2099 class A {} | 2134 class A {} |
2100 class B extends A {} | 2135 class B extends A {} |
2101 class C extends B {} | 2136 class C extends B {} |
2102 | 2137 |
2103 abstract class Base { | 2138 abstract class Base { |
2104 B get f1; | 2139 B get f1; |
2105 B get f2; | 2140 B get f2; |
2106 B get f3; | 2141 B get f3; |
(...skipping 1920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4027 // Regression test for https://github.com/dart-lang/sdk/issues/25069 | 4062 // Regression test for https://github.com/dart-lang/sdk/issues/25069 |
4028 checkFile(''' | 4063 checkFile(''' |
4029 typedef int Foo(); | 4064 typedef int Foo(); |
4030 void foo() {} | 4065 void foo() {} |
4031 void main () { | 4066 void main () { |
4032 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); | 4067 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); |
4033 } | 4068 } |
4034 '''); | 4069 '''); |
4035 } | 4070 } |
4036 } | 4071 } |
OLD | NEW |