| Index: pkg/analyzer/test/src/summary/summary_test.dart
|
| diff --git a/pkg/analyzer/test/src/summary/summary_test.dart b/pkg/analyzer/test/src/summary/summary_test.dart
|
| index 28e64775fb08926c81d36aa33a5e117ab8278ff8..f73451bc8e712c14047f289c6200afbe45fbb4f2 100644
|
| --- a/pkg/analyzer/test/src/summary/summary_test.dart
|
| +++ b/pkg/analyzer/test/src/summary/summary_test.dart
|
| @@ -368,12 +368,10 @@ abstract class SummaryTest {
|
| } else {
|
| expect(reference.name, expectedName);
|
| }
|
| - if (checkAstDerivedData) {
|
| - if (expectedPrefix == null) {
|
| - expect(reference.prefixReference, 0);
|
| - } else {
|
| - checkPrefix(reference.prefixReference, expectedPrefix);
|
| - }
|
| + if (expectedPrefix == null) {
|
| + expect(reference.prefixReference, 0);
|
| + } else {
|
| + checkPrefix(reference.prefixReference, expectedPrefix);
|
| }
|
| expect(referenceResolution.kind, expectedKind);
|
| expect(referenceResolution.unit, expectedTargetUnit);
|
| @@ -419,6 +417,43 @@ enum E {
|
| prelinked.importDependencies[0], absUri('/foo.dart'), 'foo.dart');
|
| }
|
|
|
| + fail_type_reference_to_nonexistent_file_via_prefix() {
|
| + // TODO(paulberry): this test currently fails because there is not enough
|
| + // information in the element model to figure out that the unresolved
|
| + // reference `p.C` uses the prefix `p`.
|
| + UnlinkedTypeRef typeRef = serializeTypeText('p.C',
|
| + otherDeclarations: 'import "foo.dart" as p;', allowErrors: true);
|
| + checkUnresolvedTypeRef(typeRef, 'p', 'C');
|
| + }
|
| +
|
| + fail_type_reference_to_type_visible_via_multiple_import_prefixes() {
|
| + // TODO(paulberry): this test currently fails because the element model
|
| + // doesn't record enough information to track which prefix is used to refer
|
| + // to a type.
|
| + addNamedSource('/lib1.dart', 'class C');
|
| + addNamedSource('/lib2.dart', 'export "lib1.dart";');
|
| + addNamedSource('/lib3.dart', 'export "lib1.dart";');
|
| + addNamedSource('/lib4.dart', 'export "lib1.dart";');
|
| + serializeLibraryText('''
|
| +import 'lib2.dart';
|
| +import 'lib3.dart' as a;
|
| +import 'lib4.dart' as b;
|
| +C c2;
|
| +a.C c3;
|
| +b.C c4;''');
|
| + // Note: it is important that each reference to class C records the prefix
|
| + // used to find it; otherwise it's possible that relinking might produce an
|
| + // incorrect result after a change to lib2.dart, lib3.dart, or lib4.dart.
|
| + checkTypeRef(
|
| + findVariable('c2').type, absUri('/lib1.dart'), 'lib1.dart', 'C');
|
| + checkTypeRef(
|
| + findVariable('c3').type, absUri('/lib1.dart'), 'lib1.dart', 'C',
|
| + expectedPrefix: 'a');
|
| + checkTypeRef(
|
| + findVariable('c4').type, absUri('/lib1.dart'), 'lib1.dart', 'C',
|
| + expectedPrefix: 'b');
|
| + }
|
| +
|
| /**
|
| * Find the class with the given [className] in the summary, and return its
|
| * [UnlinkedClass] data structure. If [unit] is not given, the class is
|
| @@ -2435,12 +2470,6 @@ void set f(value) {}''';
|
| expectedTargetUnit: 1);
|
| }
|
|
|
| - test_type_reference_to_nonexistent_file_via_prefix() {
|
| - UnlinkedTypeRef typeRef = serializeTypeText('p.C',
|
| - otherDeclarations: 'import "foo.dart" as p;', allowErrors: true);
|
| - checkUnresolvedTypeRef(typeRef, 'p', 'C');
|
| - }
|
| -
|
| test_type_reference_to_part() {
|
| addNamedSource('/a.dart', 'part of foo; class C { C(); }');
|
| serializeLibraryText('library foo; part "a.dart"; C c;');
|
|
|