Chromium Code Reviews| 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 3973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3984 } | 3984 } |
| 3985 | 3985 |
| 3986 void test_unboundVariable() { | 3986 void test_unboundVariable() { |
| 3987 checkFile(''' | 3987 checkFile(''' |
| 3988 void main() { | 3988 void main() { |
| 3989 dynamic y = /*error:UNDEFINED_IDENTIFIER*/unboundVariable; | 3989 dynamic y = /*error:UNDEFINED_IDENTIFIER*/unboundVariable; |
| 3990 } | 3990 } |
| 3991 '''); | 3991 '''); |
| 3992 } | 3992 } |
| 3993 | 3993 |
| 3994 void test_universalFunctionSubtyping() { | |
| 3995 checkFile(r''' | |
| 3996 T foo<T>(T x) => x; | |
| 3997 | |
| 3998 void takesDtoD(dynamic f(dynamic x)) {} | |
| 3999 | |
| 4000 void test() { | |
| 4001 // here we currently infer an instantiation. | |
| 4002 takesDtoD(/*pass should be error:INVALID_ASSIGNMENT*/foo); | |
|
Leaf
2016/12/02 01:59:10
I think if you make it
dynamic foo<T>(dynamic x)
Jennifer Messerly
2016/12/02 03:24:00
hmmm, tried it and it's still too smart to infer.
| |
| 4003 } | |
| 4004 | |
| 4005 class A { | |
| 4006 dynamic method(dynamic x) => x; | |
| 4007 } | |
| 4008 | |
| 4009 class B extends A { | |
| 4010 /*error:INVALID_METHOD_OVERRIDE*/T method<T>(T x) => x; | |
| 4011 } | |
| 4012 '''); | |
| 4013 } | |
| 4014 | |
| 3994 void test_voidSubtyping() { | 4015 void test_voidSubtyping() { |
| 3995 // Regression test for https://github.com/dart-lang/sdk/issues/25069 | 4016 // Regression test for https://github.com/dart-lang/sdk/issues/25069 |
| 3996 checkFile(''' | 4017 checkFile(''' |
| 3997 typedef int Foo(); | 4018 typedef int Foo(); |
| 3998 void foo() {} | 4019 void foo() {} |
| 3999 void main () { | 4020 void main () { |
| 4000 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); | 4021 Foo x = /*error:INVALID_ASSIGNMENT,info:USE_OF_VOID_RESULT*/foo(); |
| 4001 } | 4022 } |
| 4002 '''); | 4023 '''); |
| 4003 } | 4024 } |
| 4004 } | 4025 } |
| OLD | NEW |