forked from NomicFoundation/slang
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rules to make user-defined value type resolvable
The type's functions `.wrap()` and `.unwrap()` are not yet defined, since they will be covered when we start support for builtins.
- Loading branch information
Showing
5 changed files
with
72 additions
and
6 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
17 changes: 14 additions & 3 deletions
17
...s/solidity/outputs/cargo/slang_solidity/src/generated/bindings/generated/binding_rules.rs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/mod.rs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
crates/solidity/outputs/cargo/tests/src/bindings_assertions/generated/user_types.rs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
crates/solidity/testing/snapshots/bindings_assertions/user_types/visibility.sol
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,33 @@ | ||
contract Test { | ||
// ^def:dummy | ||
type Internal is uint; | ||
// ^def:2 (>= 0.8.8) | ||
|
||
function test() public returns (int32) { | ||
Internal inter = Internal.wrap(10); | ||
// ^ref:2 (>= 0.8.8) | ||
//<ref:2 (>= 0.8.8) | ||
TopLevel tl = TopLevel.wrap(20); | ||
// ^ref:1 (>= 0.8.8) | ||
//<ref:1 (>= 0.8.8) | ||
return MyLib.LibType.unwrap(MyLib.create()); | ||
// ^ref:3 | ||
// ^ref:4 (>= 0.8.8) | ||
// ^ref:3 (>= 0.8.8) | ||
} | ||
} | ||
|
||
type TopLevel is uint256; | ||
// ^def:1 (>= 0.8.8) | ||
|
||
library MyLib { | ||
// ^def:3 | ||
type LibType is int32; | ||
// ^def:4 (>= 0.8.8) | ||
|
||
function create() public returns (LibType) { | ||
// ^ref:4 (>= 0.8.8) | ||
return LibType.wrap(30); | ||
// ^ref:4 (>= 0.8.8) | ||
} | ||
} |