Duplicate import aliases bug
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 78
- Forks
- 33
- Avg merge
- 7h 23m
- Merged PRs (30d)
- 4
Description
```
import { t as $t, t } from '@lingui/macro'
t`Hello`
$t`Hello`
```
Only the last `t` variable will be registered in `imports_id_map`
Maybe need to add a secondary data structure `importsBindingMap`?
```
// export name -> local name
importsIdMap: Map
// local name -> export name
importsIdMapInverted: Map
// local name -> ast node
importsBindingMap: Map>
```
If swc has babel's `scope.getBinding`, it can maintain the importsBindingMap during the registration phase.
Please extend swc's capabilities~
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the import registration logic and the imports_id_map behavior described in the issue, reproducing the example with both t and $t aliases. Trace how bindings are registered and define completion as both local names remaining discoverable instead of only the last t binding; no file or test path is named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, rust
- Domain
- internationalization, tooling
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100