mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #10886 from ethereum/issue-10874
OverrideSpecifier: Check for null before dereferencing
This commit is contained in:
commit
d4ce896582
@ -7,6 +7,7 @@ Compiler Features:
|
||||
|
||||
|
||||
Bugfixes:
|
||||
* Type Checker: Fix internal error when override specifier is not a contract.
|
||||
* SMTChecker: Fix missing type constraints on block and transaction variables in the deployment phase.
|
||||
|
||||
|
||||
|
@ -225,13 +225,12 @@ struct OverrideSpecifierChecker: public PostTypeChecker::Checker
|
||||
if (dynamic_cast<ContractDefinition const*>(decl))
|
||||
continue;
|
||||
|
||||
TypeType const* actualTypeType = dynamic_cast<TypeType const*>(decl->type());
|
||||
|
||||
auto const* typeType = dynamic_cast<TypeType const*>(decl->type());
|
||||
m_errorReporter.typeError(
|
||||
9301_error,
|
||||
override->location(),
|
||||
"Expected contract but got " +
|
||||
actualTypeType->actualType()->toString(true) +
|
||||
(typeType ? typeType->actualType() : decl->type())->toString(true) +
|
||||
"."
|
||||
);
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
contract A {
|
||||
function f() public virtual {}
|
||||
}
|
||||
contract B {
|
||||
function g() public {}
|
||||
}
|
||||
contract C is A,B {
|
||||
function f() public override (g) {}
|
||||
}
|
||||
|
||||
// ----
|
||||
// TypeError 9301: (140-141): Expected contract but got function ().
|
Loading…
Reference in New Issue
Block a user