Skip to content

fix(ext): _ShimAnalyzerResolver.libraries should yield cross-package#2

Open
pcj wants to merge 1 commit into
aran:mainfrom
pcj:fix/resolver-libraries-cross-package
Open

fix(ext): _ShimAnalyzerResolver.libraries should yield cross-package#2
pcj wants to merge 1 commit into
aran:mainfrom
pcj:fix/resolver-libraries-cross-package

Conversation

@pcj

@pcj pcj commented Jun 16, 2026

Copy link
Copy Markdown

Resolver.libraries previously yielded only same-package staged files (the input + each --dep). Cross-package public re-export libraries - e.g. package:stacked_services/stacked_services.dart - were never yielded, even though they're reachable through the analyzer's session and import directly from the input under analysis.

build_runner's Resolver yields every library the analysis session has loaded. Generators that walk Resolver.libraries to look up a type's public re-exporting library (notably stacked_generator's ImportResolver) silently fail under the narrower set, computing wrong import paths or returning null for elements that ARE reachable.

Yield each package's conventional package:/.dart library from the synthesized PackageConfig in addition to the same-package staged entries. The lazy analyzer load keeps the cost negligible - libraryFor only materializes packages the consumer iterates over.

Adds four tests covering: baseline same-package yield, cross-package yield (using an on-disk fake foreign package), no-double-yield dedup, and tolerance of packages with non-conventional layouts.

Resolver.libraries previously yielded only same-package staged files
(the input + each --dep). Cross-package public re-export libraries -
e.g. package:stacked_services/stacked_services.dart - were never
yielded, even though they're reachable through the analyzer's session
and import directly from the input under analysis.

build_runner's Resolver yields every library the analysis session has
loaded. Generators that walk Resolver.libraries to look up a type's
public re-exporting library (notably stacked_generator's ImportResolver)
silently fail under the narrower set, computing wrong import paths or
returning null for elements that ARE reachable.

Yield each package's conventional package:<name>/<name>.dart library
from the synthesized PackageConfig in addition to the same-package
staged entries. The lazy analyzer load keeps the cost negligible -
libraryFor only materializes packages the consumer iterates over.

Adds four tests covering: baseline same-package yield, cross-package
yield (using an on-disk fake foreign package), no-double-yield dedup,
and tolerance of packages with non-conventional layouts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant