mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
UserDefinedValueType.storageBytes() is correctly set
Previously it returned 32 bytes for all types, which was wasteful. This commit changes it to return the storage bytes of the underlying type.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
--storage-layout
|
||||
@@ -0,0 +1,2 @@
|
||||
Warning: Source file does not specify required compiler version!
|
||||
--> storage_layout_user_defined/input.sol
|
||||
@@ -0,0 +1,16 @@
|
||||
// SPDX-License-Identifier: GPL v3
|
||||
type MyInt128 is int128;
|
||||
type MyInt8 is int8;
|
||||
contract C {
|
||||
// slot 0
|
||||
MyInt128 a;
|
||||
MyInt128 b;
|
||||
// slot 1
|
||||
MyInt128 c;
|
||||
MyInt8 d;
|
||||
MyInt8 e;
|
||||
MyInt8 f;
|
||||
MyInt8 g;
|
||||
// slot 2
|
||||
MyInt8 h;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
|
||||
======= storage_layout_user_defined/input.sol:C =======
|
||||
Contract Storage Layout:
|
||||
{"storage":[{"astId":7,"contract":"storage_layout_user_defined/input.sol:C","label":"a","offset":0,"slot":"0","type":"t_userDefinedValueType(MyInt128)2"},{"astId":10,"contract":"storage_layout_user_defined/input.sol:C","label":"b","offset":16,"slot":"0","type":"t_userDefinedValueType(MyInt128)2"},{"astId":13,"contract":"storage_layout_user_defined/input.sol:C","label":"c","offset":0,"slot":"1","type":"t_userDefinedValueType(MyInt128)2"},{"astId":16,"contract":"storage_layout_user_defined/input.sol:C","label":"d","offset":16,"slot":"1","type":"t_userDefinedValueType(MyInt8)4"},{"astId":19,"contract":"storage_layout_user_defined/input.sol:C","label":"e","offset":17,"slot":"1","type":"t_userDefinedValueType(MyInt8)4"},{"astId":22,"contract":"storage_layout_user_defined/input.sol:C","label":"f","offset":18,"slot":"1","type":"t_userDefinedValueType(MyInt8)4"},{"astId":25,"contract":"storage_layout_user_defined/input.sol:C","label":"g","offset":19,"slot":"1","type":"t_userDefinedValueType(MyInt8)4"},{"astId":28,"contract":"storage_layout_user_defined/input.sol:C","label":"h","offset":20,"slot":"1","type":"t_userDefinedValueType(MyInt8)4"}],"types":{"t_userDefinedValueType(MyInt128)2":{"encoding":"inplace","label":"MyInt128","numberOfBytes":"16"},"t_userDefinedValueType(MyInt8)4":{"encoding":"inplace","label":"MyInt8","numberOfBytes":"1"}}}
|
||||
Reference in New Issue
Block a user