| Index: pkg/analyzer/test/src/summary/linker_test.dart
|
| diff --git a/pkg/analyzer/test/src/summary/linker_test.dart b/pkg/analyzer/test/src/summary/linker_test.dart
|
| index becb90d96d70c49d89dade76ec61d60debd64cd1..38838767ffd7480b17d673a9b2d95ed4b711e8d1 100644
|
| --- a/pkg/analyzer/test/src/summary/linker_test.dart
|
| +++ b/pkg/analyzer/test/src/summary/linker_test.dart
|
| @@ -597,4 +597,47 @@ class D extends C {
|
| FunctionElementForLink_FunctionTypedParam hTypeElement = hType.element;
|
| expect(hTypeElement.typeParameterContext, same(f));
|
| }
|
| +
|
| + void test_typeParameter_isTypeParameterInScope_direct() {
|
| + createLinker('class C<T, U> {}');
|
| + ClassElementForLink_Class c = testLibrary.getContainedName('C');
|
| + TypeParameterElementForLink t = c.typeParameters[0];
|
| + TypeParameterElementForLink u = c.typeParameters[1];
|
| + expect(c.isTypeParameterInScope(t), true);
|
| + expect(c.isTypeParameterInScope(u), true);
|
| + }
|
| +
|
| + void test_typeParameter_isTypeParameterInScope_indirect() {
|
| + createLinker('class C<T, U> { f<V, W>() {} }');
|
| + ClassElementForLink_Class c = testLibrary.getContainedName('C');
|
| + MethodElementForLink f = c.methods[0];
|
| + TypeParameterElementForLink t = c.typeParameters[0];
|
| + TypeParameterElementForLink u = c.typeParameters[1];
|
| + expect(f.isTypeParameterInScope(t), true);
|
| + expect(f.isTypeParameterInScope(u), true);
|
| + }
|
| +
|
| + void test_typeParameter_isTypeParameterInScope_reversed() {
|
| + createLinker('class C<T, U> { f<V, W>() {} }');
|
| + ClassElementForLink_Class c = testLibrary.getContainedName('C');
|
| + MethodElementForLink f = c.methods[0];
|
| + TypeParameterElementForLink v = f.typeParameters[0];
|
| + TypeParameterElementForLink w = f.typeParameters[1];
|
| + expect(c.isTypeParameterInScope(v), false);
|
| + expect(c.isTypeParameterInScope(w), false);
|
| + }
|
| +
|
| + void test_typeParameter_isTypeParameterInScope_unrelated() {
|
| + createLinker('class C<T, U> {} class D<V, W> {}');
|
| + ClassElementForLink_Class c = testLibrary.getContainedName('C');
|
| + ClassElementForLink_Class d = testLibrary.getContainedName('D');
|
| + TypeParameterElementForLink t = c.typeParameters[0];
|
| + TypeParameterElementForLink u = c.typeParameters[1];
|
| + TypeParameterElementForLink v = d.typeParameters[0];
|
| + TypeParameterElementForLink w = d.typeParameters[1];
|
| + expect(c.isTypeParameterInScope(v), false);
|
| + expect(c.isTypeParameterInScope(w), false);
|
| + expect(d.isTypeParameterInScope(t), false);
|
| + expect(d.isTypeParameterInScope(u), false);
|
| + }
|
| }
|
|
|