Add nested structs semantic tests for type(S).typehash

This commit is contained in:
Anton Bukov 2023-07-05 11:44:59 +02:00
parent b65751c030
commit bcadf3c5de

View File

@ -0,0 +1,28 @@
contract C {
struct S2 {
uint256 x;
S1 y;
}
struct S1 {
uint256 z;
S3[] w;
}
struct S3 {
address a;
uint24 b;
}
function f() public pure returns(bool, bool, bool) {
return (
type(S3).typehash == keccak256("S3(address a,uint24 b)"),
type(S1).typehash == keccak256("S1(uint256 z,S3[] w)S3(address a,uint24 b)"),
type(S2).typehash == keccak256("S2(uint256 x,S1 y)S1(uint256 z,S3[] w)S3(address a,uint24 b)")
);
}
}
// ====
// compileToEwasm: also
// ----
// f() -> true, true, true