Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,9 @@ function functionInterfaceName(contractFunction: ContractInterfaceFunction) {
const { name, parameters } = contractFunction;
const paramTypes = parameters
.map((param) => param.split(" ")[0])
.map((type) => type.replace("[]", "Array"))
// Static arrays may contain multiple disallowed symbols, for name uniqueness toHex is easier than escaping
.map((type) => type.replace(/\[.+\]/, (match) => stringToHex(match)))
// Multidimensional arrays are also captured by `.*`
.map((type) => type.replace(/\[.*\]/, (match) => stringToHex(match)))
.join("_");
return `_${name}${paramTypes.length === 0 ? "" : `_${paramTypes}`}`;
}
Expand Down
2 changes: 2 additions & 0 deletions test/system-libraries/src/codegen/world/IASystem.sol

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions test/system-libraries/src/namespaces/a/ASystem.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,10 @@ contract ASystem is System {
Value.set(values[3]);
}
*/

function set2dArray(uint256[][] memory array2d) external returns (uint256[][] memory) {
address addr = _msgSender();
AddressValue.set(addr);
return array2d;
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions test/system-libraries/test/Libraries.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ contract LibrariesTest is MudTest {
assertEq(Value.get(), 2);
aSystem.setValuesStaticArray([uint256(1), 2, 3]);
assertEq(Value.get(), 3);

uint256[][] memory array2d = new uint256[][](1);
array2d[0] = new uint256[](1);
array2d[0][0] = 10;
uint256[][] memory array2dResult = aSystem.set2dArray(array2d);
assertEq(abi.encode(array2d), abi.encode(array2dResult));
}

function testCanCallSystemFromOtherSystem() public {
Expand Down
Loading