OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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.static_type_analyzer_test; | 5 library analyzer.test.generated.static_type_analyzer_test; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 } | 120 } |
121 main() { | 121 main() { |
122 print(C.m); | 122 print(C.m); |
123 } | 123 } |
124 '''; | 124 '''; |
125 resolveTestUnit(code); | 125 resolveTestUnit(code); |
126 expectFunctionType('m);', '() → void'); | 126 expectFunctionType('m);', '() → void'); |
127 } | 127 } |
128 | 128 |
129 void test_staticMethods_classTypeParameters_genericMethod() { | 129 void test_staticMethods_classTypeParameters_genericMethod() { |
130 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | |
131 options.enableGenericMethods = true; | |
132 resetWithOptions(options); | |
133 String code = r''' | 130 String code = r''' |
134 class C<T> { | 131 class C<T> { |
135 static void m<S>(S s) { | 132 static void m<S>(S s) { |
136 void f<U>(S s, U u) {} | 133 void f<U>(S s, U u) {} |
137 print(f); | 134 print(f); |
138 } | 135 } |
139 } | 136 } |
140 main() { | 137 main() { |
141 print(C.m); | 138 print(C.m); |
142 } | 139 } |
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1676 void _setType(FormalParameter parameter, DartType type) { | 1673 void _setType(FormalParameter parameter, DartType type) { |
1677 SimpleIdentifier identifier = parameter.identifier; | 1674 SimpleIdentifier identifier = parameter.identifier; |
1678 Element element = identifier.staticElement; | 1675 Element element = identifier.staticElement; |
1679 if (element is! ParameterElement) { | 1676 if (element is! ParameterElement) { |
1680 element = new ParameterElementImpl.forNode(identifier); | 1677 element = new ParameterElementImpl.forNode(identifier); |
1681 identifier.staticElement = element; | 1678 identifier.staticElement = element; |
1682 } | 1679 } |
1683 (element as ParameterElementImpl).type = type; | 1680 (element as ParameterElementImpl).type = type; |
1684 } | 1681 } |
1685 } | 1682 } |
OLD | NEW |