amarna icon indicating copy to clipboard operation
amarna copied to clipboard

Warn when an import shadows a locally defined function

Open fcasal opened this issue 2 years ago • 1 comments

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 avatar Jun 16 '22 15:06 fcasal

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() -> ():
     ^*^

coolhill avatar Jun 20 '22 17:06 coolhill