forked from FuelLabs/sway
-
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.
Annotate ItemStorage fields (FuelLabs#2588)
Co-authored-by: JC <[email protected]>
- Loading branch information
Showing
10 changed files
with
84 additions
and
46 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
14 changes: 14 additions & 0 deletions
14
test/src/e2e_vm_tests/test_programs/should_pass/language/doc_comments/Forc.lock
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 @@ | ||
[[package]] | ||
name = 'core' | ||
source = 'path+from-root-68219769D077ACAE' | ||
dependencies = [] | ||
|
||
[[package]] | ||
name = 'doc_comments' | ||
source = 'root' | ||
dependencies = ['std'] | ||
|
||
[[package]] | ||
name = 'std' | ||
source = 'path+from-root-68219769D077ACAE' | ||
dependencies = ['core'] |
8 changes: 8 additions & 0 deletions
8
test/src/e2e_vm_tests/test_programs/should_pass/language/doc_comments/Forc.toml
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,8 @@ | ||
[project] | ||
authors = ["Fuel Labs <[email protected]>"] | ||
entry = "main.sw" | ||
license = "Apache-2.0" | ||
name = "doc_comments" | ||
|
||
[dependencies] | ||
std = { path = "../../../../../../../sway-lib-std" } |
52 changes: 52 additions & 0 deletions
52
test/src/e2e_vm_tests/test_programs/should_pass/language/doc_comments/src/main.sw
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,52 @@ | ||
contract; | ||
|
||
/// Enum representing either a number or a string | ||
/// | ||
/// # Examples | ||
/// | ||
/// `NumberOrString::Number(42)` | ||
/// `NumberOrString::String("foo")` | ||
enum NumberOrString { | ||
/// The `Number` variant in `NumberOrString` | ||
Number: u64, | ||
/// The `String` variant in `NumberOrString` | ||
String: str[4], | ||
} | ||
|
||
/// Struct holding: | ||
/// | ||
/// 1. A `value` of type `NumberOrString` | ||
/// 2. An `address` of type `u64` | ||
struct Data { | ||
/// The `value` field in `Data` | ||
value: NumberOrString, | ||
/// The `address` field in `Data` | ||
address: u64, | ||
} | ||
|
||
/// This is the `FooABI` abi | ||
abi FooABI { | ||
/// This is the `main` method on the `FooABI` abi | ||
fn main() -> u64; | ||
} | ||
|
||
/// Storage fields for the contract | ||
storage { | ||
/// A `u64` field | ||
field_a: u64 = 0, | ||
/// An `str` field | ||
field_b: str[4] = "aaaa", | ||
} | ||
|
||
/// The implementation of the `FooABI` abi | ||
impl FooABI for Contract { | ||
/// The main function that does all the things! | ||
fn main() -> u64 { | ||
let mut data = Data { | ||
value: NumberOrString::Number(20), | ||
address: 1337, | ||
}; | ||
|
||
return 20; | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
test/src/e2e_vm_tests/test_programs/should_pass/language/doc_comments/test.toml
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,2 @@ | ||
category = "compile" | ||
validate_abi = false |
1 change: 0 additions & 1 deletion
1
test/src/e2e_vm_tests/test_programs/should_pass/language/doc_strings/json_abi_oracle.json
This file was deleted.
Oops, something went wrong.
41 changes: 0 additions & 41 deletions
41
test/src/e2e_vm_tests/test_programs/should_pass/language/doc_strings/src/main.sw
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
test/src/e2e_vm_tests/test_programs/should_pass/language/doc_strings/test.toml
This file was deleted.
Oops, something went wrong.