Merge pull request #9514 from ethereum/fixInterCon

Fix internal error for invalid data location in constructor.
This commit is contained in:
chriseth 2020-07-27 19:21:55 +02:00 committed by GitHub
commit 81cdc39f51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View File

@ -324,7 +324,9 @@ void DeclarationTypeChecker::endVisit(VariableDeclaration const& _variable)
", ",
" or "
);
if (_variable.isCallableOrCatchParameter())
if (_variable.isConstructorParameter())
errorString += " for constructor parameter";
else if (_variable.isCallableOrCatchParameter())
errorString +=
" for " +
string(_variable.isReturnParameter() ? "return " : "") +

View File

@ -2,4 +2,4 @@ contract C {
constructor(uint[] calldata) public {}
}
// ----
// TypeError 6651: (29-44): Data location must be "storage" or "memory" for parameter in function, but "calldata" was given.
// TypeError 6651: (29-44): Data location must be "storage" or "memory" for constructor parameter, but "calldata" was given.

View File

@ -0,0 +1,6 @@
contract C {
struct S {uint x;}
constructor(S) {}
}
// ----
// TypeError 6651: (48-49): Data location must be "storage" or "memory" for constructor parameter, but none was given.