Skip to content

Commit 843fd3f

Browse files
committed
empty tuple bug
1 parent 469fc91 commit 843fd3f

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

src/slang-nodes/TupleValues.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ export class TupleValues implements SlangNode {
4141

4242
print(path: AstPath<TupleValues>, print: PrintFunction): Doc {
4343
return this.items.length === 1 &&
44-
typeof this.items[0].expression!.variant !== 'string' &&
45-
isBinaryOperation(this.items[0].expression!.variant)
44+
this.items[0].expression &&
45+
typeof this.items[0].expression.variant !== 'string' &&
46+
isBinaryOperation(this.items[0].expression.variant)
4647
? path.map(print, 'items')
4748
: printSeparatedList(path.map(print, 'items'));
4849
}

tests/format/Tuples/Tuples.sol

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,9 @@ bytes32 volumeId,
2222
bytes32 subUnitId,
2323
bytes32 requestId) = getParamsById(paramsId);
2424
}
25+
26+
function emptyTuple() public {
27+
attacker.callSender(abi.encodeCall(this.callback, ()));
28+
}
29+
2530
}

tests/format/Tuples/__snapshots__/format.test.js.snap

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ bytes32 volumeId,
3030
bytes32 subUnitId,
3131
bytes32 requestId) = getParamsById(paramsId);
3232
}
33+
34+
function emptyTuple() public {
35+
attacker.callSender(abi.encodeCall(this.callback, ()));
36+
}
37+
3338
}
3439
3540
=====================================output=====================================
@@ -58,6 +63,10 @@ contract Tupples {
5863
bytes32 requestId
5964
) = getParamsById(paramsId);
6065
}
66+
67+
function emptyTuple() public {
68+
attacker.callSender(abi.encodeCall(this.callback, ()));
69+
}
6170
}
6271
6372
================================================================================

0 commit comments

Comments
 (0)