aeternity / aesophia

Stand alone compiler for the Sophia smart contract language
https://docs.aeternity.com/aesophia
ISC License
51 stars 19 forks source link

No distinction between function definition and function call in lookup_env #395

Open ghallak opened 2 years ago

ghallak commented 2 years ago
contract interface NameClashInterface =
  entrypoint double_proto : () => int
  entrypoint double_proto : () => int

contract C = entrypoint init() = ()

The above code will unexpectedly result in the following error:

{error,[{err,{pos,no_file,0,0},
             type_error,
             "Invalid call to contract entrypoint `NameClashInterface.double_proto`.",
             "It must be called as `c.double_proto` for some `c : NameClashInterface`."},

This happens because the lookup in the function lookup_env1 does not distinguish between a call to a qualified function and a new definition of a function in the scope, and it considers both as a call to a qualified function.