| 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 3267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3278 | 3278 |
| 3279 // Recursive cases: these infer in declaration order. | 3279 // Recursive cases: these infer in declaration order. |
| 3280 expect(fns[7].type.toString(), '() → dynamic'); | 3280 expect(fns[7].type.toString(), '() → dynamic'); |
| 3281 expect(fns[8].type.toString(), '() → dynamic'); | 3281 expect(fns[8].type.toString(), '() → dynamic'); |
| 3282 expect(fns[9].type.toString(), '() → Stream<int>'); | 3282 expect(fns[9].type.toString(), '() → Stream<int>'); |
| 3283 } | 3283 } |
| 3284 | 3284 |
| 3285 test_inferParameterType_setter_fromField() async { | 3285 test_inferParameterType_setter_fromField() async { |
| 3286 var mainUnit = await checkFileElement(''' | 3286 var mainUnit = await checkFileElement(''' |
| 3287 class C extends D { | 3287 class C extends D { |
| 3288 /*error:INVALID_FIELD_OVERRIDE*/set foo(x) {} | 3288 set foo(x) {} |
| 3289 } | 3289 } |
| 3290 class D { | 3290 class D { |
| 3291 int foo; | 3291 int foo; |
| 3292 } | 3292 } |
| 3293 '''); | 3293 '''); |
| 3294 var f = mainUnit.getType('C').accessors[0]; | 3294 var f = mainUnit.getType('C').accessors[0]; |
| 3295 expect(f.type.toString(), '(int) → void'); | 3295 expect(f.type.toString(), '(int) → void'); |
| 3296 } | 3296 } |
| 3297 | 3297 |
| 3298 test_inferParameterType_setter_fromSetter() async { | 3298 test_inferParameterType_setter_fromSetter() async { |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3698 '''); | 3698 '''); |
| 3699 } | 3699 } |
| 3700 | 3700 |
| 3701 test_inferTypeOnOverriddenFields2() async { | 3701 test_inferTypeOnOverriddenFields2() async { |
| 3702 await checkFileElement(''' | 3702 await checkFileElement(''' |
| 3703 class A { | 3703 class A { |
| 3704 int x = 2; | 3704 int x = 2; |
| 3705 } | 3705 } |
| 3706 | 3706 |
| 3707 class B extends A { | 3707 class B extends A { |
| 3708 /*error:INVALID_FIELD_OVERRIDE*/get x => 3; | 3708 get x => 3; |
| 3709 } | 3709 } |
| 3710 | 3710 |
| 3711 foo() { | 3711 foo() { |
| 3712 String y = /*error:INVALID_ASSIGNMENT*/new B().x; | 3712 String y = /*error:INVALID_ASSIGNMENT*/new B().x; |
| 3713 int z = new B().x; | 3713 int z = new B().x; |
| 3714 } | 3714 } |
| 3715 '''); | 3715 '''); |
| 3716 } | 3716 } |
| 3717 | 3717 |
| 3718 test_inferTypeOnOverriddenFields4() async { | 3718 test_inferTypeOnOverriddenFields4() async { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3838 } | 3838 } |
| 3839 | 3839 |
| 3840 test_inferTypesOnGenericInstantiations_4() async { | 3840 test_inferTypesOnGenericInstantiations_4() async { |
| 3841 await checkFileElement(''' | 3841 await checkFileElement(''' |
| 3842 class A<T> { | 3842 class A<T> { |
| 3843 T x; | 3843 T x; |
| 3844 } | 3844 } |
| 3845 | 3845 |
| 3846 class B<E> extends A<E> { | 3846 class B<E> extends A<E> { |
| 3847 E y; | 3847 E y; |
| 3848 /*error:INVALID_FIELD_OVERRIDE*/get x => y; | 3848 get x => y; |
| 3849 } | 3849 } |
| 3850 | 3850 |
| 3851 foo() { | 3851 foo() { |
| 3852 int y = /*error:INVALID_ASSIGNMENT*/new B<String>().x; | 3852 int y = /*error:INVALID_ASSIGNMENT*/new B<String>().x; |
| 3853 String z = new B<String>().x; | 3853 String z = new B<String>().x; |
| 3854 } | 3854 } |
| 3855 '''); | 3855 '''); |
| 3856 } | 3856 } |
| 3857 | 3857 |
| 3858 test_inferTypesOnGenericInstantiations_5() async { | 3858 test_inferTypesOnGenericInstantiations_5() async { |
| (...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5160 await super.test_unsafeBlockClosureInference_methodCall_implicitTypeParam(); | 5160 await super.test_unsafeBlockClosureInference_methodCall_implicitTypeParam(); |
| 5161 } | 5161 } |
| 5162 | 5162 |
| 5163 @failingTest | 5163 @failingTest |
| 5164 @override | 5164 @override |
| 5165 test_unsafeBlockClosureInference_methodCall_implicitTypeParam_comment() async
{ | 5165 test_unsafeBlockClosureInference_methodCall_implicitTypeParam_comment() async
{ |
| 5166 await super | 5166 await super |
| 5167 .test_unsafeBlockClosureInference_methodCall_implicitTypeParam_comment()
; | 5167 .test_unsafeBlockClosureInference_methodCall_implicitTypeParam_comment()
; |
| 5168 } | 5168 } |
| 5169 } | 5169 } |
| OLD | NEW |