| Index: tests/compiler/dart2js/type_variable_occurrence_test.dart
|
| diff --git a/tests/compiler/dart2js/type_variable_occurrence_test.dart b/tests/compiler/dart2js/type_variable_occurrence_test.dart
|
| index a30a55222f392547d6c155b68ce4a05da0bcfe2a..68162882168fe5d473e74eb1f8cac39e1ffa42a0 100644
|
| --- a/tests/compiler/dart2js/type_variable_occurrence_test.dart
|
| +++ b/tests/compiler/dart2js/type_variable_occurrence_test.dart
|
| @@ -8,8 +8,7 @@ import 'package:expect/expect.dart';
|
| import "package:async_helper/async_helper.dart";
|
| import 'type_test_helper.dart';
|
| import 'package:compiler/src/dart_types.dart';
|
| -import "package:compiler/src/elements/elements.dart"
|
| - show Element, ClassElement;
|
| +import "package:compiler/src/elements/elements.dart" show Element, ClassElement;
|
|
|
| void main() {
|
| testTypeVariableOccurrence();
|
| @@ -54,76 +53,75 @@ testTypeVariableOccurrence() {
|
| void method8({T t}) {}
|
| }
|
| """).then((env) {
|
| -
|
| - ClassElement A = env.getElement('A');
|
| -
|
| - expect(bool expectResult, String memberName) {
|
| - DartType memberType = env.getMemberType(A, memberName);
|
| - TypeVariableType typeVariable = memberType.typeVariableOccurrence;
|
| - if (expectResult) {
|
| - Expect.isNotNull(typeVariable);
|
| - Expect.equals(A, Types.getClassContext(memberType));
|
| - } else {
|
| - Expect.isNull(typeVariable);
|
| - Expect.isNull(Types.getClassContext(memberType));
|
| - }
|
| - }
|
| -
|
| - // int field1;
|
| - expect(false, 'field1');
|
| - // T field2;
|
| - expect(true, 'field2');
|
| - // A<int> field3;
|
| - expect(false, 'field3');
|
| - // A<T> field4;
|
| - expect(true, 'field4');
|
| - // A<A<int>> field5;
|
| - expect(false, 'field5');
|
| - // A<A<T>> field6;
|
| - expect(true, 'field6');
|
| -
|
| - // Typedef1 field7;
|
| - expect(false, 'field7');
|
| - // Typedef1<int> field8;
|
| - expect(false, 'field8');
|
| - // Typedef1<T> field9;
|
| - expect(true, 'field9');
|
| - // Typedef1<Typedef1<T>> field10;
|
| - expect(true, 'field10');
|
| -
|
| - // Typedef2 field11;
|
| - expect(false, 'field11');
|
| - // Typedef2<int> field12;
|
| - expect(false, 'field12');
|
| - // Typedef2<T> field13;
|
| - expect(true, 'field13');
|
| - // Typedef2<Typedef1<T>> field14;
|
| - expect(true, 'field14');
|
| -
|
| - // Typedef3 field15;
|
| - expect(false, 'field15');
|
| - // Typedef3<int> field16;
|
| - expect(false, 'field16');
|
| - // Typedef3<T> field17;
|
| - expect(true, 'field17');
|
| - // Typedef3<Typedef1<T>> field18;
|
| - expect(true, 'field18');
|
| -
|
| - // void method1() {}
|
| - expect(false, 'method1');
|
| - // T method2() => null;
|
| - expect(true, 'method2');
|
| - // A<T> method3() => null;
|
| - expect(true, 'method3');
|
| - // void method4(T t) {}
|
| - expect(true, 'method4');
|
| - // void method5(A<T> t) {}
|
| - expect(true, 'method5');
|
| - // void method6(void foo(T t)) {}
|
| - expect(true, 'method6');
|
| - // void method7([T t]);
|
| - expect(true, 'method7');
|
| - // void method8({T t});
|
| - expect(true, 'method8');
|
| - }));
|
| + ClassElement A = env.getElement('A');
|
| +
|
| + expect(bool expectResult, String memberName) {
|
| + DartType memberType = env.getMemberType(A, memberName);
|
| + TypeVariableType typeVariable = memberType.typeVariableOccurrence;
|
| + if (expectResult) {
|
| + Expect.isNotNull(typeVariable);
|
| + Expect.equals(A, Types.getClassContext(memberType));
|
| + } else {
|
| + Expect.isNull(typeVariable);
|
| + Expect.isNull(Types.getClassContext(memberType));
|
| + }
|
| + }
|
| +
|
| + // int field1;
|
| + expect(false, 'field1');
|
| + // T field2;
|
| + expect(true, 'field2');
|
| + // A<int> field3;
|
| + expect(false, 'field3');
|
| + // A<T> field4;
|
| + expect(true, 'field4');
|
| + // A<A<int>> field5;
|
| + expect(false, 'field5');
|
| + // A<A<T>> field6;
|
| + expect(true, 'field6');
|
| +
|
| + // Typedef1 field7;
|
| + expect(false, 'field7');
|
| + // Typedef1<int> field8;
|
| + expect(false, 'field8');
|
| + // Typedef1<T> field9;
|
| + expect(true, 'field9');
|
| + // Typedef1<Typedef1<T>> field10;
|
| + expect(true, 'field10');
|
| +
|
| + // Typedef2 field11;
|
| + expect(false, 'field11');
|
| + // Typedef2<int> field12;
|
| + expect(false, 'field12');
|
| + // Typedef2<T> field13;
|
| + expect(true, 'field13');
|
| + // Typedef2<Typedef1<T>> field14;
|
| + expect(true, 'field14');
|
| +
|
| + // Typedef3 field15;
|
| + expect(false, 'field15');
|
| + // Typedef3<int> field16;
|
| + expect(false, 'field16');
|
| + // Typedef3<T> field17;
|
| + expect(true, 'field17');
|
| + // Typedef3<Typedef1<T>> field18;
|
| + expect(true, 'field18');
|
| +
|
| + // void method1() {}
|
| + expect(false, 'method1');
|
| + // T method2() => null;
|
| + expect(true, 'method2');
|
| + // A<T> method3() => null;
|
| + expect(true, 'method3');
|
| + // void method4(T t) {}
|
| + expect(true, 'method4');
|
| + // void method5(A<T> t) {}
|
| + expect(true, 'method5');
|
| + // void method6(void foo(T t)) {}
|
| + expect(true, 'method6');
|
| + // void method7([T t]);
|
| + expect(true, 'method7');
|
| + // void method8({T t});
|
| + expect(true, 'method8');
|
| + }));
|
| }
|
|
|