Open
Description
Description
function f(mapping(uint128 => S) storage s) internal pure returns (mapping(uint128 => S) storage s2) {
s2 = s; // pass the compilation
s = s2; // TypeError: Types in storage containing (nested) mappings cannot be assigned to.
}
s
and s2
are both mapping-type declarations in function f
. But the assignments to them cause different results.
Perhaps this is an intentional behavior, but the error message is misleading. It implies the assignment to s2
should also be forbidden.
Environment
- Compiler version: 0.8.28