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

Warn when an import shadows a locally defined function #26

Open
fcasal opened this issue Jun 16, 2022 · 1 comment
Open

Warn when an import shadows a locally defined function #26

fcasal opened this issue Jun 16, 2022 · 1 comment
Labels
new rule Proposal for a new rule.

Comments

@fcasal
Copy link
Collaborator

fcasal commented Jun 16, 2022

We would flag the following foo import

# library.cairo

func foo() -> ():
end

and

# main.cairo
from library import foo as bar

func bar() -> ():
end

func main() -> ():
    bar()
end

This should also work for unaliased import.

We should also check the compiler behavior so we could provide further details when this is found.

@fcasal fcasal added the new rule Proposal for a new rule. label Jun 16, 2022
@coolhill
Copy link
Contributor

The compiler seem to cover this case, both for aliased/unaliased imports.

$ cairo-compile main.cairo
main.cairo:3:6: Redefinition of '__main__.bar'.
func bar() -> ():
     ^*^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new rule Proposal for a new rule.
Projects
None yet
Development

No branches or pull requests

2 participants