mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Contract level checker: Disallow free function redefinition and alias
shadowing another free function Co-authored-by: chriseth <chris@ethereum.org>
This commit is contained in:
co-authored by
chriseth
parent
1cc0d642e8
commit
e2a2276272
@@ -0,0 +1,19 @@
|
||||
==== Source: s1.sol ====
|
||||
function f() pure returns (uint) { return 1337; }
|
||||
function g() pure returns (uint) { return 42; }
|
||||
==== Source: s2.sol ====
|
||||
import {f as g} from "s1.sol";
|
||||
==== Source: s3.sol ====
|
||||
// imports f()->1337 as g()
|
||||
import "s2.sol";
|
||||
// imports f()->1337 as f() and
|
||||
// g()->42 as g
|
||||
import "s1.sol";
|
||||
contract C {
|
||||
function foo() public pure returns (uint) {
|
||||
// calls f()->1337 / f()->1337
|
||||
return f() / g();
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// DeclarationError 1686: (s1.sol:0-49): Function with same name and parameter types defined twice.
|
||||
Reference in New Issue
Block a user