Disallow using modifiers not in the current contract or in base contracts.

This commit is contained in:
chriseth
2020-11-17 18:33:45 +01:00
parent 79afd04818
commit 049c7f7a8e
6 changed files with 59 additions and 0 deletions
@@ -0,0 +1,9 @@
library L {
modifier m() { _; }
}
contract C {
function f() L.m public {
}
}
// ----
// TypeError 9428: (68-71): Can only use modifiers defined in the current contract or in base contracts.
@@ -0,0 +1,9 @@
contract C {
modifier m() { _; }
}
contract D {
function f() C.m public {
}
}
// ----
// TypeError 9428: (69-72): Can only use modifiers defined in the current contract or in base contracts.
@@ -0,0 +1,8 @@
contract C {
modifier m() { _; }
}
contract D is C {
function f() C.m public {
}
}
// ----
@@ -0,0 +1,11 @@
contract A {}
contract C is A {
modifier m() { _; }
}
contract D is A {
function f() C.m public {
}
}
contract T is D, C {}
// ----
// TypeError 9428: (93-96): Can only use modifiers defined in the current contract or in base contracts.
@@ -0,0 +1,10 @@
library L {
modifier m() { _; }
}
contract C {
using L for *;
function f() L.m public {
}
}
// ----
// TypeError 9428: (87-90): Can only use modifiers defined in the current contract or in base contracts.