You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we print slithir for the following source file:
contract Test {
function test() external {
int[] memory a = new int[](5);
}
}
the temp variable in the generated IR has the wrong type. It's an array of arrays instead of a 1-dimensional array:
INFO:Printers:Contract Test
Function Test.test() (*)
Expression: a = new int256[](5)
IRs:
TMP_1int256[][]) = new int256[](5)
a(int256[]) := TMP_1(int256[][])
Code example to reproduce the issue:
contract Test {
function test() external {
int[] memory a = new int[](5);
}
}
Version:
0.9.5
Relevant log output:
INFO:Printers:Contract Test
Function Test.test() (*)
Expression: a = new int256[](5)
IRs:
TMP_1int256[][]) = new int256[](5)
a(int256[]) := TMP_1(int256[][])
The text was updated successfully, but these errors were encountered:
0xalpharush
changed the title
[Bug-Candidate]: Temp variable for new dynamic array has wrong type
[Bug]: Temp variable for new dynamic array has wrong type
Jul 1, 2023
The linked PR doesn't handle late type conversion for literals in the case of an EventCall, NewStructure, or NewContract.
contract New {
constructor(int x) {
}
function b(int a) external {
}
}
contract Test {
struct X {
int x;
}
event Log(int message);
function test() external {
emit Log(5);
New n = new New(5);
n.b(5);
X(5);
}
}
Describe the issue:
When we print slithir for the following source file:
the temp variable in the generated IR has the wrong type. It's an array of arrays instead of a 1-dimensional array:
Code example to reproduce the issue:
Version:
0.9.5
Relevant log output:
The text was updated successfully, but these errors were encountered: