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 2991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3002 void test_optionalParams() { | 3002 void test_optionalParams() { |
3003 // Regression test for https://github.com/dart-lang/sdk/issues/26155 | 3003 // Regression test for https://github.com/dart-lang/sdk/issues/26155 |
3004 checkFile(r''' | 3004 checkFile(r''' |
3005 void takesF(void f(int x)) { | 3005 void takesF(void f(int x)) { |
3006 takesF(/*info:INFERRED_TYPE_CLOSURE,info:INFERRED_TYPE_CLOSURE*/([x]) { bool z = x.isEven; }); | 3006 takesF(/*info:INFERRED_TYPE_CLOSURE,info:INFERRED_TYPE_CLOSURE*/([x]) { bool z = x.isEven; }); |
3007 takesF(/*info:INFERRED_TYPE_CLOSURE*/(y) { bool z = y.isEven; }); | 3007 takesF(/*info:INFERRED_TYPE_CLOSURE*/(y) { bool z = y.isEven; }); |
3008 } | 3008 } |
3009 '''); | 3009 '''); |
3010 } | 3010 } |
3011 | 3011 |
3012 void test_overrideNarrowsType() { | |
3013 addFile(r''' | |
3014 class A {} | |
3015 class B extends A {} | |
3016 | |
3017 abstract class C { | |
3018 m(A a); | |
3019 n(B b); | |
3020 } | |
3021 abstract class D extends C { | |
3022 /*error:INVALID_METHOD_OVERRIDE*/m(/*error:INVALID_METHOD_OVERRIDE_NORMAL_PARA M_TYPE*/B b); | |
Jennifer Messerly
2016/08/10 23:50:48
we should probably let error_verifier's messages r
| |
3023 n(A a); | |
3024 } | |
3025 '''); | |
3026 check(implicitCasts: false); | |
Jennifer Messerly
2016/08/10 23:50:48
This bug wasn't visible until we turn off implicit
| |
3027 } | |
3028 | |
3012 void test_privateOverride() { | 3029 void test_privateOverride() { |
3013 addFile( | 3030 addFile( |
3014 ''' | 3031 ''' |
3015 import 'main.dart' as main; | 3032 import 'main.dart' as main; |
3016 | 3033 |
3017 class Base { | 3034 class Base { |
3018 var f1; | 3035 var f1; |
3019 var _f2; | 3036 var _f2; |
3020 var _f3; | 3037 var _f3; |
3021 get _f4 => null; | 3038 get _f4 => null; |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3730 // Regression test for https://github.com/dart-lang/sdk/issues/25069 | 3747 // Regression test for https://github.com/dart-lang/sdk/issues/25069 |
3731 checkFile(''' | 3748 checkFile(''' |
3732 typedef int Foo(); | 3749 typedef int Foo(); |
3733 void foo() {} | 3750 void foo() {} |
3734 void main () { | 3751 void main () { |
3735 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); | 3752 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); |
3736 } | 3753 } |
3737 '''); | 3754 '''); |
3738 } | 3755 } |
3739 } | 3756 } |
OLD | NEW |