Merge pull request #12275 from nishant-sachdeva/calldata-struct-arugment-with-internal-type-inside

Calldata struct array arugment with internal type inside
This commit is contained in:
chriseth 2021-12-06 16:55:56 +01:00 committed by GitHub
commit 4e0f334107
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 28 additions and 15 deletions

View File

@ -9,6 +9,8 @@ Compiler Features:
Bugfixes:
* Code Generator: Fix a crash when using ``@use-src`` and compiling from Yul to ewasm.
* SMTChecker: Fix internal error when an unsafe target is solved more than once and the counterexample messages are different.
* Fix internal error when a function has a calldata struct argument with an internal type inside.
### 0.8.10 (2021-11-09)

View File

@ -387,7 +387,7 @@ bool TypeChecker::visit(FunctionDefinition const& _function)
_var.referenceLocation() == VariableDeclaration::Location::Storage &&
!m_currentContract->abstract()
)
m_errorReporter.typeError(
m_errorReporter.fatalTypeError(
3644_error,
_var.location(),
"This parameter has a type that can only be used internally. "
@ -403,7 +403,7 @@ bool TypeChecker::visit(FunctionDefinition const& _function)
solAssert(!message.empty(), "Expected detailed error message!");
if (_function.isConstructor())
message += " You can make the contract abstract to avoid this problem.";
m_errorReporter.typeError(4103_error, _var.location(), message);
m_errorReporter.fatalTypeError(4103_error, _var.location(), message);
}
else if (
!useABICoderV2() &&

View File

@ -7,4 +7,3 @@ contract C {
}
// ----
// TypeError 4103: (132-140): Types containing (nested) mappings can only be parameters or return variables of internal or library functions.
// TypeError 4061: (132-140): Type struct C.S is only valid in storage because it contains a (nested) mapping.

View File

@ -6,4 +6,3 @@ contract C {
}
// ----
// TypeError 4103: (105-113): Types containing (nested) mappings can only be parameters or return variables of internal or library functions.
// TypeError 4061: (105-113): Type struct C.S is only valid in storage because it contains a (nested) mapping.

View File

@ -5,4 +5,3 @@ contract Test {
}
// ----
// TypeError 4103: (66-98): Types containing (nested) mappings can only be parameters or return variables of internal or library functions.
// TypeError 4061: (66-98): Type mapping(uint256 => uint256)[] is only valid in storage because it contains a (nested) mapping.

View File

@ -3,4 +3,3 @@ contract A {
}
// ----
// TypeError 4103: (29-59): Types containing (nested) mappings can only be parameters or return variables of internal or library functions. You can make the contract abstract to avoid this problem.
// TypeError 4061: (29-59): Type mapping(uint256 => uint256) is only valid in storage because it contains a (nested) mapping.

View File

@ -0,0 +1,8 @@
contract C {
struct S {
function() a;
}
function f(S calldata) public {}
}
// ----
// TypeError 4103: (56-66): Internal type is not allowed for public or external functions.

View File

@ -0,0 +1,8 @@
contract C {
struct S {
function() a;
}
function f(S[2] calldata) public {}
}
// ----
// TypeError 4103: (56-69): Internal type is not allowed for public or external functions.

View File

@ -0,0 +1,8 @@
contract C {
struct S {
function() a;
}
constructor (S[2] storage) public {}
}
// ----
// TypeError 3644: (58-70): This parameter has a type that can only be used internally. You can make the contract abstract to avoid this problem.

View File

@ -12,4 +12,3 @@ contract test {
}
// ----
// TypeError 4103: (155-167): Types containing (nested) mappings can only be parameters or return variables of internal or library functions.
// TypeError 4061: (155-167): Type struct test.S is only valid in storage because it contains a (nested) mapping.

View File

@ -7,4 +7,3 @@ library a {
}
// ----
// TypeError 4103: (149-157): Recursive structs can only be passed as storage pointers to libraries, not as memory objects to contract functions.
// TypeError 4061: (149-157): Type struct a.b is only valid in storage because it contains a (nested) mapping.

View File

@ -3,4 +3,3 @@ contract c {
}
// ----
// TypeError 4103: (29-61): Types containing (nested) mappings can only be parameters or return variables of internal or library functions.
// TypeError 4061: (29-61): Type mapping(uint256 => uint256)[] is only valid in storage because it contains a (nested) mapping.

View File

@ -3,4 +3,3 @@ contract c {
}
// ----
// TypeError 4103: (29-59): Types containing (nested) mappings can only be parameters or return variables of internal or library functions.
// TypeError 4061: (29-59): Type mapping(uint256 => uint256) is only valid in storage because it contains a (nested) mapping.

View File

@ -3,4 +3,3 @@ contract c {
}
// ----
// TypeError 4103: (29-57): Types containing (nested) mappings can only be parameters or return variables of internal or library functions.
// TypeError 4061: (29-57): Type mapping(uint256 => uint256) is only valid in storage because it contains a (nested) mapping.

View File

@ -9,4 +9,3 @@ contract test {
}
// ----
// TypeError 4103: (121-133): Types containing (nested) mappings can only be parameters or return variables of internal or library functions.
// TypeError 4061: (121-133): Type struct test.S is only valid in storage because it contains a (nested) mapping.

View File

@ -4,4 +4,3 @@ contract C {
}
// ----
// TypeError 4103: (51-79): Types containing (nested) mappings can only be parameters or return variables of internal or library functions.
// TypeError 4061: (51-79): Type mapping(uint256 => uint256) is only valid in storage because it contains a (nested) mapping.

View File

@ -5,4 +5,3 @@ contract C {
}
// ----
// TypeError 4103: (104-112): Types containing (nested) mappings can only be parameters or return variables of internal or library functions.
// TypeError 4061: (104-112): Type struct C.S is only valid in storage because it contains a (nested) mapping.

View File

@ -7,4 +7,3 @@ contract C {
}
// ----
// TypeError 4103: (148-156): Types containing (nested) mappings can only be parameters or return variables of internal or library functions.
// TypeError 4061: (148-156): Type struct C.U is only valid in storage because it contains a (nested) mapping.