Tests for unassigned calldata returns.

This commit is contained in:
Daniel Kirchner 2021-09-13 13:52:33 +02:00
parent fc37b18e88
commit ab7b1625ac
3 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,5 @@
contract C {
function f() internal returns (uint256[] calldata) {}
}
// ----
// TypeError 3464: (48-66): This variable is of calldata pointer type and can be returned without prior assignment, which would lead to undefined behaviour.

View File

@ -0,0 +1,5 @@
contract C {
function f() internal returns (uint256[1] calldata) {}
}
// ----
// TypeError 3464: (48-67): This variable is of calldata pointer type and can be returned without prior assignment, which would lead to undefined behaviour.

View File

@ -0,0 +1,6 @@
contract C {
struct S { uint256 x; }
function f() internal returns (S calldata) {}
}
// ----
// TypeError 3464: (76-86): This variable is of calldata pointer type and can be returned without prior assignment, which would lead to undefined behaviour.