Skip to content

Resolve import aliases as global references instead of local definitions#201

Merged
jupblb merged 3 commits intomainfrom
michal/global-import-alias
Apr 14, 2026
Merged

Resolve import aliases as global references instead of local definitions#201
jupblb merged 3 commits intomainfrom
michal/global-import-alias

Conversation

@jupblb
Copy link
Copy Markdown
Member

@jupblb jupblb commented Apr 14, 2026

For more context see: #197 (comment). Fixes #34.

Aliased imports (e.g. h "net/http") now emit a reference to the global
package symbol rather than creating a local definition. This means a
references lookup from the original package statement returns all
individual usages across files (Option A).

Removes the pkgNameOverride mechanism entirely since all package name
usages in SelectorExpr now resolve directly to the global symbol.
@jupblb jupblb force-pushed the michal/global-import-alias branch 2 times, most recently from 169f479 to 9aff313 Compare April 14, 2026 11:36
Test cases covering global reference resolution for import aliases:
- All import styles: non-aliased, blank, dot, and renamed aliases
- Same-name aliases (fmt "fmt") resolve globally
- Cross-file alias consistency
- References issue #34
@jupblb jupblb force-pushed the michal/global-import-alias branch 4 times, most recently from cbd3fb0 to 4e7c1ba Compare April 14, 2026 12:35
The overrides struct wrapper is unnecessary now that pkgNameOverride has
been removed, leaving only caseClauses.
@jupblb jupblb force-pushed the michal/global-import-alias branch from 4e7c1ba to 8c5f3e4 Compare April 14, 2026 12:36
@jupblb jupblb merged commit 4b03b0e into main Apr 14, 2026
5 checks passed
@jupblb jupblb deleted the michal/global-import-alias branch April 14, 2026 14:32
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.

Inconsistency between FQN and aliased imports

2 participants