Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Side by Side Diff: pkg/analyzer/test/src/task/strong/checker_test.dart

Issue 2167263002: fix #26141, add support for type arguments to constants (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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<R> {}
2171 class DefaultEquality<S> implements Equality<S> {
2172 const DefaultEquality();
2173 }
2174 class SetEquality<T> implements Equality<T> {
2175 final Equality<T> field = const DefaultEquality();
2176 const SetEquality([Equality<T> inner = const DefaultEquality()]);
2177 }
2178 main() {
2179 const SetEquality<String>();
2180 }
2181 ''');
2182 }
2183
2184 void test_constantGenericTypeArg_explict() {
2185 // Regression test for https://github.com/dart-lang/sdk/issues/26141
2186 checkFile('''
2187 abstract class Equality<R> {}
2188 class DefaultEquality<S> implements Equality<S> {
2189 const DefaultEquality();
2190 }
2191 class SetEquality<T> implements Equality<T> {
2192 final Equality<T> field = const DefaultEquality<T>();
2193 const SetEquality([Equality<T> inner = const DefaultEquality<T>()]);
2194 }
2195 main() {
2196 const SetEquality<String>();
2197 }
2198 ''');
2199 }
2200
2167 void test_invalidOverrides_baseClassOverrideToChildInterface() { 2201 void test_invalidOverrides_baseClassOverrideToChildInterface() {
2168 checkFile(''' 2202 checkFile('''
2169 class A {} 2203 class A {}
2170 class B {} 2204 class B {}
2171 2205
2172 abstract class I { 2206 abstract class I {
2173 m(A a); 2207 m(A a);
2174 } 2208 }
2175 2209
2176 class Base { 2210 class Base {
(...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after
3557 // Regression test for https://github.com/dart-lang/sdk/issues/25069 3591 // Regression test for https://github.com/dart-lang/sdk/issues/25069
3558 checkFile(''' 3592 checkFile('''
3559 typedef int Foo(); 3593 typedef int Foo();
3560 void foo() {} 3594 void foo() {}
3561 void main () { 3595 void main () {
3562 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); 3596 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo();
3563 } 3597 }
3564 '''); 3598 ''');
3565 } 3599 }
3566 } 3600 }
OLDNEW
« pkg/analyzer/lib/src/summary/idl.dart ('K') | « pkg/analyzer/lib/src/summary/idl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698