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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v: forbid local variable names, shadowing imported module names #17197

Merged
merged 7 commits into from
Feb 3, 2023

Conversation

ChAoSUnItY
Copy link
Member

@ChAoSUnItY ChAoSUnItY commented Feb 2, 2023

import arrays

fn x() {
	arrays := 1
}
var_decl_import_sym_conflict.vv:4:2: error: duplicate of an import symbol `arrays`
    2 |
    3 | fn x() {
    4 |     arrays := 1
      |     ~~~~~~
    5 | }

Note

This is a breaking change, serveral modules and tests are effected. Including vinix, stdlib etc.

@ChAoSUnItY ChAoSUnItY added the Unit: Checker Bugs/feature requests, that are related to the type checker. label Feb 2, 2023
@ChAoSUnItY ChAoSUnItY marked this pull request as ready for review February 2, 2023 11:45
spytheman added a commit to vlang/ui that referenced this pull request Feb 2, 2023
@spytheman spytheman changed the title v: Forbid variable name shadowing import symbol v: forbid local variable names, shadowing imported module names Feb 2, 2023
spytheman added a commit to vlang/adventofcode that referenced this pull request Feb 3, 2023
vlib/v/checker/assign.v Outdated Show resolved Hide resolved
Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Unit: Checker Bugs/feature requests, that are related to the type checker.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Forbid local variables with same name as one of the imported modules
3 participants