Skip to content

Packages/libraries referrred via prefixed imports are sometimes missing from package graph #2786

Open
@jcollins-g

Description

@jcollins-g

Dartdoc is supposed to add all packages accessible via the import/export graph to the PackageGraph at initialization, but packages containing libraries only referred to via import prefixes seem to be missing from the data structure. This will result in an exception in the link validator if someone is referring to a member of that library via the import prefix.

Fuchsia noticed this error, but used --no-enhanced-reference-lookup to work around it. This probably worked because the old reference lookup system had very buggy/incomplete support for prefixes, and so it seems likely that we just didn't resolve the links that we're now trying to verify.

dartdoc 3.0.0 (/usr/local/google/home/theosiu/dartdoc/bin/dartdoc.dart) failed: NoSuchMethodError: The getter 'library' was called on null.
Receiver: null
Tried calling: library
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:63:5)
#1      PackageGraph.findButDoNotCreateLibraryFor (package:dartdoc/src/model/package_graph.dart:888:27)
#2      new ModelElement.fromElement (package:dartdoc/src/model/model_element.dart:131:17)
#3      Prefix.associatedLibrary (package:dartdoc/src/model/prefix.dart:30:43)
#4      Prefix.canonicalModelElement (package:dartdoc/src/model/prefix.dart:37:40)
#5      Prefix.href (package:dartdoc/src/model/prefix.dart:54:7)
#6      PackageGraph.allHrefs (package:dartdoc/src/model/package_graph.dart:581:33)
#7      Dartdoc._validateLinks (package:dartdoc/dartdoc.dart:485:27)
#8      Dartdoc.generateDocsBase (package:dartdoc/dartdoc.dart:217:7)
<asynchronous suspension>
#9      Dartdoc.generateDocs (package:dartdoc/dartdoc.dart:249:28)
<asynchronous suspension>
#10     Dartdoc.executeGuarded.<anonymous closure> (package:dartdoc/dartdoc.dart:512:9)
<asynchronous suspension>

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work oncustomer-fuchsiaIssues originating from or important to Fuchsiatype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions