mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Clean up visibility via contract name and fix ICE on calling unimplemented base function.
This commit is contained in:
@@ -5,4 +5,4 @@ contract derived is base {
|
||||
function g() public { base.f(); }
|
||||
}
|
||||
// ----
|
||||
// TypeError: (100-106): Member "f" not found or not visible after argument-dependent lookup in type(contract base).
|
||||
// TypeError: (100-108): Cannot call function via contract type name.
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
abstract contract A {
|
||||
function f() public virtual;
|
||||
function g() public {
|
||||
f();
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
contract A {
|
||||
function f() external {}
|
||||
function g() external pure {}
|
||||
}
|
||||
|
||||
contract B is A {
|
||||
function h() external {
|
||||
function() external f = A.f;
|
||||
function() external pure g = A.g;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (133-160): Type function A.f() is not implicitly convertible to expected type function () external.
|
||||
// TypeError: (170-202): Type function A.g() pure is not implicitly convertible to expected type function () pure external.
|
||||
@@ -0,0 +1,11 @@
|
||||
contract B {
|
||||
function f() external {}
|
||||
function g() public {}
|
||||
}
|
||||
contract C is B {
|
||||
function h() public {
|
||||
B.f.selector;
|
||||
B.g.selector;
|
||||
B.g();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
contract B {
|
||||
function f() external {}
|
||||
function g() internal {}
|
||||
}
|
||||
contract C is B {
|
||||
function i() public {
|
||||
B.f();
|
||||
B.g.selector;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (125-130): Cannot call function via contract type name.
|
||||
// TypeError: (140-152): Member "selector" not found or not visible after argument-dependent lookup in function ().
|
||||
+3
-3
@@ -12,6 +12,6 @@ contract B {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (160-165): Cannot call function via contract name.
|
||||
// TypeError: (175-180): Cannot call function via contract name.
|
||||
// TypeError: (190-195): Cannot call function via contract name.
|
||||
// TypeError: (160-165): Cannot call function via contract type name.
|
||||
// TypeError: (175-180): Cannot call function via contract type name.
|
||||
// TypeError: (190-195): Cannot call function via contract type name.
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
abstract contract B {
|
||||
function f() public virtual;
|
||||
}
|
||||
contract C is B {
|
||||
function f() public override {
|
||||
B.f();
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (118-123): Cannot call unimplemented base function.
|
||||
@@ -0,0 +1,10 @@
|
||||
contract A {
|
||||
modifier mod() { _; }
|
||||
}
|
||||
contract B {
|
||||
function f() public {
|
||||
A.mod;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (88-93): Member "mod" not found or not visible after argument-dependent lookup in type(contract A).
|
||||
@@ -0,0 +1,10 @@
|
||||
contract A {
|
||||
modifier mod() { _; }
|
||||
}
|
||||
contract B is A {
|
||||
function f() public {
|
||||
A.mod;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (93-98): Member "mod" not found or not visible after argument-dependent lookup in type(contract A).
|
||||
@@ -0,0 +1,14 @@
|
||||
contract A {
|
||||
struct S { uint256 a; }
|
||||
enum E { V }
|
||||
}
|
||||
contract B {
|
||||
A.S x;
|
||||
A.E e;
|
||||
}
|
||||
contract C is A {
|
||||
A.S x;
|
||||
S y;
|
||||
A.E e;
|
||||
E f;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
library L {
|
||||
function a() public pure {}
|
||||
function b() public pure { a(); }
|
||||
}
|
||||
Reference in New Issue
Block a user