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.inferred_type_test; | 5 library analyzer.test.src.task.strong.inferred_type_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/element/element.dart'; | 10 import 'package:analyzer/dart/element/element.dart'; |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 f(/*info:INFERRED_TYPE_LITERAL*/[/*info:INFERRED_TYPE_LITERAL*/{y: x}]); | 821 f(/*info:INFERRED_TYPE_LITERAL*/[/*info:INFERRED_TYPE_LITERAL*/{y: x}]); |
822 } | 822 } |
823 { | 823 { |
824 int f(int x) => 0; | 824 int f(int x) => 0; |
825 A<int> a = /*info:INFERRED_TYPE_ALLOCATION*/new A(f); | 825 A<int> a = /*info:INFERRED_TYPE_ALLOCATION*/new A(f); |
826 } | 826 } |
827 } | 827 } |
828 '''); | 828 '''); |
829 } | 829 } |
830 | 830 |
| 831 test_downwardsInference_insideTopLevel() async { |
| 832 await checkFileElement(''' |
| 833 class A { |
| 834 B<int> b; |
| 835 } |
| 836 |
| 837 class B<T> { |
| 838 B(T x); |
| 839 } |
| 840 |
| 841 var t1 = new A()..b = /*info:INFERRED_TYPE_ALLOCATION*/new B(1); |
| 842 var t2 = <B<int>>[/*info:INFERRED_TYPE_ALLOCATION*/new B(2)]; |
| 843 var t3 = /*info:INFERRED_TYPE_LITERAL*/[ |
| 844 /*info:INFERRED_TYPE_ALLOCATION*/new |
| 845 /*error:TOP_LEVEL_TYPE_ARGUMENTS*/B(3) |
| 846 ]; |
| 847 '''); |
| 848 } |
| 849 |
831 test_downwardsInferenceAnnotations() async { | 850 test_downwardsInferenceAnnotations() async { |
832 await checkFileElement(''' | 851 await checkFileElement(''' |
833 class Foo { | 852 class Foo { |
834 const Foo(List<String> l); | 853 const Foo(List<String> l); |
835 const Foo.named(List<String> l); | 854 const Foo.named(List<String> l); |
836 } | 855 } |
837 @Foo(/*info:INFERRED_TYPE_LITERAL*/const []) | 856 @Foo(/*info:INFERRED_TYPE_LITERAL*/const []) |
838 class Bar {} | 857 class Bar {} |
839 @Foo.named(/*info:INFERRED_TYPE_LITERAL*/const []) | 858 @Foo.named(/*info:INFERRED_TYPE_LITERAL*/const []) |
840 class Baz {} | 859 class Baz {} |
(...skipping 4151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4992 .test_unsafeBlockClosureInference_functionCall_explicitTypeParam_viaExpr
2(); | 5011 .test_unsafeBlockClosureInference_functionCall_explicitTypeParam_viaExpr
2(); |
4993 } | 5012 } |
4994 | 5013 |
4995 @failingTest | 5014 @failingTest |
4996 @override | 5015 @override |
4997 test_unsafeBlockClosureInference_functionCall_explicitTypeParam_viaExpr2_comme
nt() async { | 5016 test_unsafeBlockClosureInference_functionCall_explicitTypeParam_viaExpr2_comme
nt() async { |
4998 await super | 5017 await super |
4999 .test_unsafeBlockClosureInference_functionCall_explicitTypeParam_viaExpr
2_comment(); | 5018 .test_unsafeBlockClosureInference_functionCall_explicitTypeParam_viaExpr
2_comment(); |
5000 } | 5019 } |
5001 } | 5020 } |
OLD | NEW |