mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow non-namable types for inline arrays.
This commit is contained in:
parent
e4b31e7230
commit
d0b6de580f
@ -13,6 +13,7 @@ Compiler Features:
|
||||
Bugfixes:
|
||||
* Optimizer: Fixed a bug in BlockDeDuplicator.
|
||||
* Type Checker: Disallow assignments to storage variables of type ``mapping``.
|
||||
* Type Checker: Disallow inline arrays of non-nameable types.
|
||||
* Type Checker: Fix internal compiler error when accessing members of array slices.
|
||||
* NatSpec: DocString block is terminated when encountering an empty line.
|
||||
* Scanner: Fix bug when two empty NatSpec comments lead to scanning past EOL.
|
||||
|
@ -1509,6 +1509,12 @@ bool TypeChecker::visit(TupleExpression const& _tuple)
|
||||
{
|
||||
if (!inlineArrayType)
|
||||
m_errorReporter.fatalTypeError(6378_error, _tuple.location(), "Unable to deduce common type for array elements.");
|
||||
else if (!inlineArrayType->nameable())
|
||||
m_errorReporter.fatalTypeError(
|
||||
9656_error,
|
||||
_tuple.location(),
|
||||
"Unable to deduce nameable type for array elements. Try adding explicit type conversion for the first element."
|
||||
);
|
||||
else if (!inlineArrayType->canLiveOutsideStorage())
|
||||
m_errorReporter.fatalTypeError(1545_error, _tuple.location(), "Type " + inlineArrayType->toString() + " is only valid in storage.");
|
||||
|
||||
|
@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() public {
|
||||
[msg];
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (47-52): Unable to deduce nameable type for array elements. Try adding explicit type conversion for the first element.
|
@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() public {
|
||||
[type(C)];
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (47-56): Unable to deduce nameable type for array elements. Try adding explicit type conversion for the first element.
|
Loading…
Reference in New Issue
Block a user