OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.generated.resolver_test; | 5 library analyzer.test.generated.resolver_test; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
10 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
(...skipping 13025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13036 /*=T*/ f/*<T>*/(/*=T*/ e) => null; | 13036 /*=T*/ f/*<T>*/(/*=T*/ e) => null; |
13037 static /*=T*/ g/*<T>*/(/*=T*/ e) => null; | 13037 static /*=T*/ g/*<T>*/(/*=T*/ e) => null; |
13038 static final h = g; | 13038 static final h = g; |
13039 } | 13039 } |
13040 | 13040 |
13041 /*=T*/ topF/*<T>*/(/*=T*/ e) => null; | 13041 /*=T*/ topF/*<T>*/(/*=T*/ e) => null; |
13042 var topG = topF; | 13042 var topG = topF; |
13043 void test/*<S>*/(/*=T*/ pf/*<T>*/(/*=T*/ e)) { | 13043 void test/*<S>*/(/*=T*/ pf/*<T>*/(/*=T*/ e)) { |
13044 var c = new C<int>(); | 13044 var c = new C<int>(); |
13045 /*=T*/ lf/*<T>*/(/*=T*/ e) => null; | 13045 /*=T*/ lf/*<T>*/(/*=T*/ e) => null; |
| 13046 |
| 13047 var lambdaCall = (/*<E>*/(/*=E*/ e) => e)/*<int>*/(3); |
13046 var methodCall = (c.f)/*<int>*/(3); | 13048 var methodCall = (c.f)/*<int>*/(3); |
13047 var staticCall = (C.g)/*<int>*/(3); | 13049 var staticCall = (C.g)/*<int>*/(3); |
13048 var staticFieldCall = (C.h)/*<int>*/(3); | 13050 var staticFieldCall = (C.h)/*<int>*/(3); |
13049 var topFunCall = (topF)/*<int>*/(3); | 13051 var topFunCall = (topF)/*<int>*/(3); |
13050 var topFieldCall = (topG)/*<int>*/(3); | 13052 var topFieldCall = (topG)/*<int>*/(3); |
13051 var localCall = (lf)/*<int>*/(3); | 13053 var localCall = (lf)/*<int>*/(3); |
13052 var paramCall = (pf)/*<int>*/(3); | 13054 var paramCall = (pf)/*<int>*/(3); |
13053 } | 13055 } |
13054 '''); | 13056 '''); |
13055 expect(_findIdentifier('methodCall').staticType.toString(), "int"); | 13057 expect(_findIdentifier('methodCall').staticType.toString(), "int"); |
13056 expect(_findIdentifier('staticCall').staticType.toString(), "int"); | 13058 expect(_findIdentifier('staticCall').staticType.toString(), "int"); |
13057 expect(_findIdentifier('staticFieldCall').staticType.toString(), "int"); | 13059 expect(_findIdentifier('staticFieldCall').staticType.toString(), "int"); |
13058 expect(_findIdentifier('topFunCall').staticType.toString(), "int"); | 13060 expect(_findIdentifier('topFunCall').staticType.toString(), "int"); |
13059 expect(_findIdentifier('topFieldCall').staticType.toString(), "int"); | 13061 expect(_findIdentifier('topFieldCall').staticType.toString(), "int"); |
13060 expect(_findIdentifier('localCall').staticType.toString(), "int"); | 13062 expect(_findIdentifier('localCall').staticType.toString(), "int"); |
13061 expect(_findIdentifier('paramCall').staticType.toString(), "int"); | 13063 expect(_findIdentifier('paramCall').staticType.toString(), "int"); |
| 13064 expect(_findIdentifier('lambdaCall').staticType.toString(), "int"); |
13062 } | 13065 } |
13063 | 13066 |
13064 void fail_genericMethod_functionExpressionInvocation_inferred() { | 13067 void fail_genericMethod_functionExpressionInvocation_inferred() { |
13065 _resolveTestUnit(r''' | 13068 _resolveTestUnit(r''' |
13066 class C<E> { | 13069 class C<E> { |
13067 /*=T*/ f/*<T>*/(/*=T*/ e) => null; | 13070 /*=T*/ f/*<T>*/(/*=T*/ e) => null; |
13068 static /*=T*/ g/*<T>*/(/*=T*/ e) => null; | 13071 static /*=T*/ g/*<T>*/(/*=T*/ e) => null; |
13069 static final h = g; | 13072 static final h = g; |
13070 } | 13073 } |
13071 | 13074 |
13072 /*=T*/ topF/*<T>*/(/*=T*/ e) => null; | 13075 /*=T*/ topF/*<T>*/(/*=T*/ e) => null; |
13073 var topG = topF; | 13076 var topG = topF; |
13074 void test/*<S>*/(/*=T*/ pf/*<T>*/(/*=T*/ e)) { | 13077 void test/*<S>*/(/*=T*/ pf/*<T>*/(/*=T*/ e)) { |
13075 var c = new C<int>(); | 13078 var c = new C<int>(); |
13076 /*=T*/ lf/*<T>*/(/*=T*/ e) => null; | 13079 /*=T*/ lf/*<T>*/(/*=T*/ e) => null; |
| 13080 |
| 13081 var lambdaCall = (/*<E>*/(/*=E*/ e) => e)(3); |
13077 var methodCall = (c.f)(3); | 13082 var methodCall = (c.f)(3); |
13078 var staticCall = (C.g)(3); | 13083 var staticCall = (C.g)(3); |
13079 var staticFieldCall = (C.h)(3); | 13084 var staticFieldCall = (C.h)(3); |
13080 var topFunCall = (topF)(3); | 13085 var topFunCall = (topF)(3); |
13081 var topFieldCall = (topG)(3); | 13086 var topFieldCall = (topG)(3); |
13082 var localCall = (lf)(3); | 13087 var localCall = (lf)(3); |
13083 var paramCall = (pf)(3); | 13088 var paramCall = (pf)(3); |
13084 } | 13089 } |
13085 '''); | 13090 '''); |
13086 expect(_findIdentifier('methodCall').staticType.toString(), "int"); | 13091 expect(_findIdentifier('methodCall').staticType.toString(), "int"); |
13087 expect(_findIdentifier('staticCall').staticType.toString(), "int"); | 13092 expect(_findIdentifier('staticCall').staticType.toString(), "int"); |
13088 expect(_findIdentifier('staticFieldCall').staticType.toString(), "int"); | 13093 expect(_findIdentifier('staticFieldCall').staticType.toString(), "int"); |
13089 expect(_findIdentifier('topFunCall').staticType.toString(), "int"); | 13094 expect(_findIdentifier('topFunCall').staticType.toString(), "int"); |
13090 expect(_findIdentifier('topFieldCall').staticType.toString(), "int"); | 13095 expect(_findIdentifier('topFieldCall').staticType.toString(), "int"); |
13091 expect(_findIdentifier('localCall').staticType.toString(), "int"); | 13096 expect(_findIdentifier('localCall').staticType.toString(), "int"); |
13092 expect(_findIdentifier('paramCall').staticType.toString(), "int"); | 13097 expect(_findIdentifier('paramCall').staticType.toString(), "int"); |
| 13098 expect(_findIdentifier('lambdaCall').staticType.toString(), "int"); |
13093 } | 13099 } |
13094 | 13100 |
13095 void fail_genericMethod_functionInvocation_inferred() { | 13101 void fail_genericMethod_functionInvocation_inferred() { |
13096 _resolveTestUnit(r''' | 13102 _resolveTestUnit(r''' |
13097 class C<E> { | 13103 class C<E> { |
13098 /*=T*/ f/*<T>*/(/*=T*/ e) => null; | 13104 /*=T*/ f/*<T>*/(/*=T*/ e) => null; |
13099 static /*=T*/ g/*<T>*/(/*=T*/ e) => null; | 13105 static /*=T*/ g/*<T>*/(/*=T*/ e) => null; |
13100 static final h = g; | 13106 static final h = g; |
13101 } | 13107 } |
13102 | 13108 |
(...skipping 3577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16680 | 16686 |
16681 void _resolveTestUnit(String code) { | 16687 void _resolveTestUnit(String code) { |
16682 testCode = code; | 16688 testCode = code; |
16683 testSource = addSource(testCode); | 16689 testSource = addSource(testCode); |
16684 LibraryElement library = resolve2(testSource); | 16690 LibraryElement library = resolve2(testSource); |
16685 assertNoErrors(testSource); | 16691 assertNoErrors(testSource); |
16686 verify([testSource]); | 16692 verify([testSource]); |
16687 testUnit = resolveCompilationUnit(testSource, library); | 16693 testUnit = resolveCompilationUnit(testSource, library); |
16688 } | 16694 } |
16689 } | 16695 } |
OLD | NEW |