-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: clarify error message for a field access in bounced types that d…
…oes not fit in 224 bytes (#1111)
- Loading branch information
Showing
6 changed files
with
111 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/types/stmts-failed/usage-of-bounced-field-in-type-that-is-too-big-2.tact
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
primitive Int; | ||
trait BaseTrait { } | ||
|
||
message Withdraw { | ||
data128: Int as uint128; // 128 | ||
data64: Int as uint64; // 192 | ||
data16: Int as uint16; // 208 | ||
data8: Int as uint8; // 216 | ||
data4: Int as uint4; // 220 | ||
data4_2: Int as uint4; // 224 | ||
|
||
amount: Int as uint128; | ||
} | ||
|
||
contract Fund { | ||
balance: Int as uint256 = 0; | ||
|
||
bounced(msg: bounced<Withdraw>){ | ||
self.balance += msg.data128; // ok | ||
self.balance += msg.data64; // ok | ||
self.balance += msg.data16; // ok | ||
self.balance += msg.data8; // ok | ||
self.balance += msg.data4; // ok | ||
self.balance += msg.data4_2; // ok | ||
|
||
self.balance += msg.amount; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/types/stmts-failed/usage-of-bounced-field-in-type-that-is-too-big.tact
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
primitive Int; | ||
trait BaseTrait { } | ||
|
||
message Withdraw { | ||
data: Int as uint128; | ||
amount: Int as uint128; // exceeds 224 bytes | ||
} | ||
|
||
contract Fund { | ||
balance: Int as uint256 = 0; | ||
|
||
bounced(msg: bounced<Withdraw>){ | ||
self.balance += msg.data; // ok | ||
self.balance += msg.amount; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/types/stmts-failed/usage-of-bounced-field-that-is-too-big.tact
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
primitive Int; | ||
trait BaseTrait { } | ||
|
||
message Withdraw { | ||
amount: Int as uint256; // too big | ||
} | ||
|
||
contract Fund { | ||
balance: Int as uint256 = 0; | ||
|
||
bounced(msg: bounced<Withdraw>){ | ||
self.balance += msg.amount; | ||
} | ||
} |