@@ -2137,12 +2137,17 @@ void main() {
21372137 nameWithSingleUnderscore,
21382138 theOnlyThingInTheLibrary;
21392139 Constructor aNonDefaultConstructor, defaultConstructor;
2140- Class Apple , BaseClass , baseForDocComments, ExtraSpecialList , string;
2140+ Class Apple ,
2141+ BaseClass ,
2142+ baseForDocComments,
2143+ ExtraSpecialList ,
2144+ string,
2145+ metaUseResult;
21412146 Method doAwesomeStuff, anotherMethod;
21422147 // ignore: unused_local_variable
21432148 Operator bracketOperator, bracketOperatorOtherClass;
21442149 Parameter doAwesomeStuffParam;
2145- Field forInheriting, action, initializeMe;
2150+ Field forInheriting, action, initializeMe, somethingShadowy ;
21462151
21472152 setUpAll (() async {
21482153 nameWithTwoUnderscores = fakeLibrary.constants
@@ -2153,6 +2158,10 @@ void main() {
21532158 .firstWhere ((e) => e.name == 'dart:core' )
21542159 .allClasses
21552160 .firstWhere ((c) => c.name == 'String' );
2161+ metaUseResult = packageGraph.allLibraries.values
2162+ .firstWhere ((e) => e.name == 'meta' )
2163+ .allClasses
2164+ .firstWhere ((c) => c.name == 'UseResult' );
21562165 baseForDocComments =
21572166 fakeLibrary.classes.firstWhere ((c) => c.name == 'BaseForDocComments' );
21582167 aNonDefaultConstructor = baseForDocComments.constructors.firstWhere (
@@ -2161,6 +2170,8 @@ void main() {
21612170 .firstWhere ((c) => c.name == 'BaseForDocComments' );
21622171 initializeMe = baseForDocComments.allFields
21632172 .firstWhere ((f) => f.name == 'initializeMe' );
2173+ somethingShadowy = baseForDocComments.allFields
2174+ .firstWhere ((f) => f.name == 'somethingShadowy' );
21642175 doAwesomeStuff = baseForDocComments.instanceMethods
21652176 .firstWhere ((m) => m.name == 'doAwesomeStuff' );
21662177 anotherMethod = baseForDocComments.instanceMethods
@@ -2248,12 +2259,23 @@ void main() {
22482259 equals (MatchingLinkResult (aNonDefaultConstructor)));
22492260 });
22502261
2262+ test ('Deprecated lookup styles still function' , () {
2263+ // dart-lang/dartdoc#2683
2264+ expect (bothLookup (baseForDocComments, 'aPrefix.UseResult' ),
2265+ equals (MatchingLinkResult (metaUseResult)));
2266+ });
2267+
22512268 test ('Verify basic linking inside class' , () {
22522269 expect (
22532270 bothLookup (
22542271 baseForDocComments, 'BaseForDocComments.BaseForDocComments' ),
22552272 equals (MatchingLinkResult (defaultConstructor)));
22562273
2274+ // We don't want the parameter on the default constructor, here.
2275+ expect (
2276+ bothLookup (baseForDocComments, 'BaseForDocComments.somethingShadowy' ),
2277+ equals (MatchingLinkResult (somethingShadowy)));
2278+
22572279 expect (bothLookup (doAwesomeStuff, 'aNonDefaultConstructor' ),
22582280 equals (MatchingLinkResult (aNonDefaultConstructor)));
22592281
@@ -2311,8 +2333,7 @@ void main() {
23112333 equals (MatchingLinkResult (theOnlyThingInTheLibrary)));
23122334
23132335 // A name that exists in this package but is not imported.
2314- // TODO(jcollins-g): package-wide lookups are not yet implemented with the new lookup code.
2315- expect (originalLookup (doAwesomeStuff, 'doesStuff' ),
2336+ expect (bothLookup (doAwesomeStuff, 'doesStuff' ),
23162337 equals (MatchingLinkResult (doesStuff)));
23172338
23182339 // A name of a class from an import of a library that exported that name.
@@ -2339,8 +2360,7 @@ void main() {
23392360 equals (MatchingLinkResult (forInheriting)));
23402361
23412362 // Reference to an inherited member in another library via class name.
2342- // TODO(jcollins-g): reference to non-imported symbols isn't implemented yet in new lookup.
2343- expect (originalLookup (doAwesomeStuff, 'ExtendedBaseReexported.action' ),
2363+ expect (bothLookup (doAwesomeStuff, 'ExtendedBaseReexported.action' ),
23442364 equals (MatchingLinkResult (action)));
23452365 });
23462366 });
0 commit comments