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

Module name confusion #21

Open
Victorious3 opened this issue Feb 13, 2023 · 2 comments
Open

Module name confusion #21

Victorious3 opened this issue Feb 13, 2023 · 2 comments
Labels
bug Something isn't working typecheck Populating the AST with type information
Milestone

Comments

@Victorious3
Copy link
Contributor

If you define a variable with the same name as a module you have imported it tries to reference the variable instead.

import module
def some_function {
    let module = 20
    module::member // Doesn't work
}

The problem is essentially that I also have to look for enums as those "overload" the :: operator.

@Victorious3 Victorious3 added the bug Something isn't working label Feb 13, 2023
@Victorious3
Copy link
Contributor Author

One option would be to simply look into the global scope to find the right value. One problem with that is that we might want to have imports inside of functions at some point.

@Victorious3
Copy link
Contributor Author

I've settled for a solution: Make :: only lookup constants. That way it mostly doesn't interfere with local variables and enums are still fine.

@Victorious3 Victorious3 added this to the 0.4 milestone Nov 17, 2023
@Victorious3 Victorious3 added the typecheck Populating the AST with type information label Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working typecheck Populating the AST with type information
Projects
None yet
Development

No branches or pull requests

1 participant