Issue 11610 : Replced typeError with fataTypeError in lines 390 and 406. Test file added in test/libsolidity/syntaxTests/calldata_struct_argument_with_internal_type_inside.sol

Issue : 11610 : Test cases updated, Changelog.md file updated to include change on 0.8.11
This commit is contained in:
nishant-sachdeva 2021-11-10 17:46:36 +05:30
parent c76a6bdbab
commit a4fbc607c6
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.