mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Prevent calls to unimplemented modifiers.
This commit is contained in:
parent
9cf6021d8a
commit
c5923f7fcf
@ -8,6 +8,7 @@ Compiler Features:
|
||||
|
||||
Bugfixes:
|
||||
* Code Generator: Fix internal compiler error when calling functions bound to calldata structs and arrays.
|
||||
* Type Checker: Fix internal error and prevent static calls to unimplemented modifiers.
|
||||
|
||||
|
||||
### 0.8.6 (2021-06-22)
|
||||
|
@ -639,6 +639,15 @@ void TypeChecker::visitManually(
|
||||
"Can only use modifiers defined in the current contract or in base contracts."
|
||||
);
|
||||
}
|
||||
if (
|
||||
*_modifier.name().annotation().requiredLookup == VirtualLookup::Static &&
|
||||
!modifierDecl->isImplemented()
|
||||
)
|
||||
m_errorReporter.typeError(
|
||||
1835_error,
|
||||
_modifier.location(),
|
||||
"Cannot call unimplemented modifier. The modifier has no implementation in the referenced contract. Refer to it by its unqualified name if you want to call the implementation from the most derived contract."
|
||||
);
|
||||
}
|
||||
else
|
||||
// check parameters for Base constructors
|
||||
|
@ -0,0 +1,12 @@
|
||||
contract A {
|
||||
modifier m() virtual { _; }
|
||||
}
|
||||
abstract contract B {
|
||||
modifier m() virtual;
|
||||
}
|
||||
contract C is A, B {
|
||||
modifier m() override(A, B) { _; }
|
||||
function f() B.m public {}
|
||||
}
|
||||
// ----
|
||||
// TypeError 1835: (174-177): Cannot call unimplemented modifier. The modifier has no implementation in the referenced contract. Refer to it by its unqualified name if you want to call the implementation from the most derived contract.
|
Loading…
Reference in New Issue
Block a user