| 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 // Tests related to the [TypeSystem] class. | 5 // Tests related to the [TypeSystem] class. |
| 6 | 6 |
| 7 library analyzer.test.generated.type_system_test; | 7 library analyzer.test.generated.type_system_test; |
| 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 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 | 1117 |
| 1118 void test_unusedReturnTypeWithUpperBound() { | 1118 void test_unusedReturnTypeWithUpperBound() { |
| 1119 // <T extends num>() -> T | 1119 // <T extends num>() -> T |
| 1120 var t = TypeBuilder.variable('T', bound: numType); | 1120 var t = TypeBuilder.variable('T', bound: numType); |
| 1121 var f = TypeBuilder.function(types: [t], required: [], result: t); | 1121 var f = TypeBuilder.function(types: [t], required: [], result: t); |
| 1122 expect(_inferCall(f, []), [numType]); | 1122 expect(_inferCall(f, []), [numType]); |
| 1123 } | 1123 } |
| 1124 | 1124 |
| 1125 List<DartType> _inferCall(FunctionTypeImpl ft, List<DartType> arguments, | 1125 List<DartType> _inferCall(FunctionTypeImpl ft, List<DartType> arguments, |
| 1126 [DartType returnType]) { | 1126 [DartType returnType]) { |
| 1127 FunctionType inferred = typeSystem.inferGenericFunctionCall(typeProvider, | 1127 FunctionType inferred = typeSystem.inferGenericFunctionCall( |
| 1128 ft, ft.parameters.map((p) => p.type).toList(), arguments, returnType); | 1128 typeProvider, |
| 1129 ft, |
| 1130 ft.parameters.map((p) => p.type).toList(), |
| 1131 arguments, |
| 1132 ft.returnType, |
| 1133 returnType); |
| 1129 return inferred?.typeArguments; | 1134 return inferred?.typeArguments; |
| 1130 } | 1135 } |
| 1131 } | 1136 } |
| 1132 | 1137 |
| 1133 /** | 1138 /** |
| 1134 * Tests GLB, which only exists in strong mode. | 1139 * Tests GLB, which only exists in strong mode. |
| 1135 */ | 1140 */ |
| 1136 @reflectiveTest | 1141 @reflectiveTest |
| 1137 class StrongGreatestLowerBoundTest extends BoundTestBase { | 1142 class StrongGreatestLowerBoundTest extends BoundTestBase { |
| 1138 void setUp() { | 1143 void setUp() { |
| (...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1886 if (types != null) { | 1891 if (types != null) { |
| 1887 f.typeParameters = | 1892 f.typeParameters = |
| 1888 new List<TypeParameterElement>.from(types.map((t) => t.element)); | 1893 new List<TypeParameterElement>.from(types.map((t) => t.element)); |
| 1889 } | 1894 } |
| 1890 return f.type = new FunctionTypeImpl(f); | 1895 return f.type = new FunctionTypeImpl(f); |
| 1891 } | 1896 } |
| 1892 | 1897 |
| 1893 static TypeParameterType variable(String name, {DartType bound}) => | 1898 static TypeParameterType variable(String name, {DartType bound}) => |
| 1894 ElementFactory.typeParameterWithType(name, bound).type; | 1899 ElementFactory.typeParameterWithType(name, bound).type; |
| 1895 } | 1900 } |
| OLD | NEW |