mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow conversion to super.
This commit is contained in:
parent
6de7eaba95
commit
6d1454fce6
@ -2351,7 +2351,16 @@ bool TypeChecker::visit(FunctionCall const& _functionCall)
|
|||||||
funcCallAnno.kind = FunctionCallKind::StructConstructorCall;
|
funcCallAnno.kind = FunctionCallKind::StructConstructorCall;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (auto const* contractType = dynamic_cast<ContractType const*>(actualType))
|
||||||
|
if (contractType->isSuper())
|
||||||
|
m_errorReporter.fatalTypeError(
|
||||||
|
1744_error,
|
||||||
|
_functionCall.location(),
|
||||||
|
"Cannot convert to the super type."
|
||||||
|
);
|
||||||
funcCallAnno.kind = FunctionCallKind::TypeConversion;
|
funcCallAnno.kind = FunctionCallKind::TypeConversion;
|
||||||
|
}
|
||||||
|
|
||||||
funcCallAnno.isPure = argumentsArePure;
|
funcCallAnno.isPure = argumentsArePure;
|
||||||
|
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
contract C {
|
||||||
|
function f() public pure {
|
||||||
|
super().x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// TypeError 1744: (52-59): Cannot convert to the super type.
|
@ -0,0 +1,7 @@
|
|||||||
|
contract C {
|
||||||
|
function f() public pure {
|
||||||
|
super(this).f();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// TypeError 1744: (52-63): Cannot convert to the super type.
|
Loading…
Reference in New Issue
Block a user