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 '../../../reflective_tests.dart'; | 7 import '../../../reflective_tests.dart'; |
8 import 'strong_test_helper.dart'; | 8 import 'strong_test_helper.dart'; |
9 | 9 |
10 void main() { | 10 void main() { |
(...skipping 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2157 var /*error:IMPLICIT_DYNAMIC_VARIABLE*/x1 = (<dynamic>[])[0]; | 2157 var /*error:IMPLICIT_DYNAMIC_VARIABLE*/x1 = (<dynamic>[])[0]; |
2158 var /*error:IMPLICIT_DYNAMIC_VARIABLE*/x2, | 2158 var /*error:IMPLICIT_DYNAMIC_VARIABLE*/x2, |
2159 x3 = 42, | 2159 x3 = 42, |
2160 /*error:IMPLICIT_DYNAMIC_VARIABLE*/x4; | 2160 /*error:IMPLICIT_DYNAMIC_VARIABLE*/x4; |
2161 dynamic y0; | 2161 dynamic y0; |
2162 dynamic y1 = (<dynamic>[])[0]; | 2162 dynamic y1 = (<dynamic>[])[0]; |
2163 '''); | 2163 '''); |
2164 check(implicitDynamic: false); | 2164 check(implicitDynamic: false); |
2165 } | 2165 } |
2166 | 2166 |
2167 void test_constantGenericTypeArg_infer() { | |
2168 // Regression test for https://github.com/dart-lang/sdk/issues/26141 | |
2169 checkFile(''' | |
2170 abstract class Equality<Q> {} | |
2171 abstract class EqualityBase<R> implements Equality<R> { | |
2172 final C<R> c = /*info:INFERRED_TYPE_ALLOCATION*/const C(); | |
2173 const EqualityBase(); | |
2174 } | |
2175 class DefaultEquality<S> extends EqualityBase<S> { | |
2176 const DefaultEquality(); | |
2177 } | |
2178 class SetEquality<T> implements Equality<T> { | |
2179 final Equality<T> field = const DefaultEquality(); | |
2180 const SetEquality([Equality<T> inner = const DefaultEquality()]); | |
2181 } | |
2182 class C<Q> { | |
2183 final List<Q> list = /*info:INFERRED_TYPE_LITERAL*/const []; | |
2184 final Map<Q, Iterable<Q>> m = /*info:INFERRED_TYPE_LITERAL*/const {}; | |
2185 const C(); | |
2186 } | |
2187 main() { | |
2188 const SetEquality<String>(); | |
2189 } | |
2190 '''); | |
2191 } | |
2192 | |
2193 void test_constantGenericTypeArg_explict() { | |
2194 // Regression test for https://github.com/dart-lang/sdk/issues/26141 | |
2195 checkFile(''' | |
2196 abstract class Equality<R> {} | |
2197 abstract class EqualityBase<R> implements Equality<R> { | |
2198 final C<R> c = const C<R>(); | |
2199 const EqualityBase(); | |
2200 } | |
2201 class DefaultEquality<S> extends EqualityBase<S> { | |
2202 const DefaultEquality(); | |
2203 } | |
2204 class SetEquality<T> implements Equality<T> { | |
2205 final Equality<T> field = const DefaultEquality<T>(); | |
2206 const SetEquality([Equality<T> inner = const DefaultEquality<T>()]); | |
2207 } | |
2208 class C<Q> { | |
2209 final List<Q> list = const <Q>[]; | |
2210 final Map<Q, Iterable<Q>> m = const <Q, Iterable<Q>>{}; | |
2211 const C(); | |
2212 } | |
2213 main() { | |
2214 const SetEquality<String>(); | |
2215 } | |
2216 '''); | |
2217 } | |
2218 | |
2219 void test_invalidOverrides_baseClassOverrideToChildInterface() { | 2167 void test_invalidOverrides_baseClassOverrideToChildInterface() { |
2220 checkFile(''' | 2168 checkFile(''' |
2221 class A {} | 2169 class A {} |
2222 class B {} | 2170 class B {} |
2223 | 2171 |
2224 abstract class I { | 2172 abstract class I { |
2225 m(A a); | 2173 m(A a); |
2226 } | 2174 } |
2227 | 2175 |
2228 class Base { | 2176 class Base { |
(...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3609 // Regression test for https://github.com/dart-lang/sdk/issues/25069 | 3557 // Regression test for https://github.com/dart-lang/sdk/issues/25069 |
3610 checkFile(''' | 3558 checkFile(''' |
3611 typedef int Foo(); | 3559 typedef int Foo(); |
3612 void foo() {} | 3560 void foo() {} |
3613 void main () { | 3561 void main () { |
3614 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); | 3562 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); |
3615 } | 3563 } |
3616 '''); | 3564 '''); |
3617 } | 3565 } |
3618 } | 3566 } |
OLD | NEW |