Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

checker: include import aliases when checking for import duplicates #18450

Merged
merged 5 commits into from
Jun 14, 2023

Conversation

ttytm
Copy link
Member

@ttytm ttytm commented Jun 14, 2023

Currently, it's possible to use an import alias as duplicate of another import and an import as duplicate of another import alias.

import json
import x.json2 as json
import x.json2 as json
import json

With the changes in this PR it will result in:

error: `json` was already imported on line 1
    1 | import json
    2 | import x.json2 as json
      |                   ~~~~
error: `x.json2` was already imported as `json` on line 1
    1 | import x.json2 as json
    2 | import json
      |        ~~~~

馃 Generated by Copilot at bb05497

Add error checks to the checker module to prevent importing modules with duplicate names or aliases. Add test files to verify the new checks.

馃 Generated by Copilot at bb05497

  • Add error checks for importing modules with duplicate names or aliases (link)
    • Create V files with .vv extension that import modules with conflicting names or aliases (link, link)
    • Create output files with .out extension that match the V file names and contain the expected error messages and positions (link, link)

@medvednikov medvednikov merged commit 77a1f59 into vlang:master Jun 14, 2023
49 checks passed
@medvednikov
Copy link
Member

Good find!

@ttytm ttytm deleted the checker/import-alias-duplicates branch August 22, 2023 13:35
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.

None yet

2 participants