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

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

Issue 2779003004: Don't disable downward inference inside initializers used for top-level inference. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « pkg/analyzer/test/src/summary/top_level_inference_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.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
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
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 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/src/summary/top_level_inference_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698