-
Notifications
You must be signed in to change notification settings - Fork 480
Add support for language level errors (LangError)
#1450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 101 commits
Commits
Show all changes
111 commits
Select commit
Hold shift + click to select a range
c62ea25
Add example cross-chain contract
HCastano 5e8cd1e
Update `CallBuilder`'s return type to a `Result`
HCastano 728c45c
Write to output buffer on dispatch error
HCastano 810ea54
Whoops, reduce value of `u8`
HCastano 980f6a7
Add some `cargo-contract` automation helpers
HCastano 6181d9c
Set default if no input is given
HCastano 63fc94c
Return type expected by call builder after succesful dispatch
HCastano 4280d37
Fix typo
HCastano 474133a
Return an actual `DispatchError` back to the caller
HCastano e3f67ea
Temporarily stop generating contract ref code
HCastano 6a04bd1
Manually change message return type to Result
HCastano 5c9d250
Transform message return type in the IR
HCastano a989be6
Change message return type when generating contract reference
HCastano a9cae76
Return message output directly in the codegen
HCastano b3e0141
Add error type for handling language errors
HCastano cf332b7
Clean up some things
HCastano 845b009
Merge branch 'master' into hc-add-ink-level-errors
HCastano dc1b7a3
Remove some unused code
HCastano 2ad4633
Add DispatchError type metadata
ascjones 5421a0c
Merge branch 'master' into hc-add-ink-level-errors
ascjones 14b5875
Use language error over dispatch error
HCastano a38a395
Change message body's visibility based on message signature
HCastano a4d653b
Fix unreachable code warning
HCastano fc42d66
Appease Clippy
HCastano 9705ff3
Rustfmt cross-contract example
HCastano fc7f374
align for runtime metadata compatibility
xermicus 7869558
Merge branch 'master' into hc-add-ink-level-errors
xermicus a668018
Fix formatting
HCastano 89d2cf5
Write `lang_error` into metadata using spec builder
HCastano 68417b7
Use `parse_quote` macro over the `syn::parse` function
HCastano f2ef955
Use correct span in call builder
HCastano 183dc11
Always return `Type` instead of `Option` from `wrapped_output`
HCastano 26e1170
Merge branch 'master' into hc-add-ink-level-errors
HCastano ae11633
Temporarily appease Clippy
HCastano 1630b3d
Another temporary Clippy fix
HCastano 2e7b5bc
Generate checked and unchecked versions of contract messages
HCastano 87ca721
Use non-checked message as checked message implementation
HCastano 66dd9d1
Remove error handling from test
HCastano 517d408
Add method for generating checked message idents
HCastano 1b6cacc
Merge branch 'master' into hc-add-ink-level-errors
HCastano 150e4d3
Fix UI tests related to `no_implicit_prelude`
HCastano e59f53e
Merge branch 'master' into hc-add-ink-level-errors
HCastano d68777e
Remove unneccessary import
HCastano 4f2caad
Add `Default` implementation for `cross_chain_test`
HCastano f617a0c
Bless some UI tests
HCastano 105fe23
Update `Output` type for doc test
HCastano 90cf477
Update `cross_chain_test` to appease Clippy
HCastano 3774d29
Generate `*_checked` functions for `ContractRef` calls
HCastano 13d7a42
Implement `Debug` for Multisig Wasm builds
HCastano 8929234
Add another `Debug` impl
HCastano bb6c445
Add `lang_error` to metadata tests
HCastano 10c9e7d
Add example which uses ContractRefs
HCastano 57ddec7
Handle dispatch error in example
HCastano 077d15b
Add UI test for checking that messages now return `Result`s
HCastano 816f312
Add test for message hygiene (or lack thereof)
HCastano 636e7c9
Add test to check that `*_checked` messages are generated
HCastano e2d8194
Remove debug logging from macro code
HCastano 94449dd
Appease Clippy
HCastano f1137a7
Remove `--skip-linting` from scripts
HCastano 2afef50
Fix fallible constructor revert, make `Ok` explicit
ascjones ed1aeec
Hack together E2E test example for `LangError`
HCastano ed60df8
Add a couple of type aliases to E2E test
HCastano 8cea958
Add E2E test which demonstrates write-on-err bug
HCastano 2488761
Split out E2E tests into seperate functions
HCastano 3670755
Merge branch 'aj/add-ink-level-errors' into hc-add-ink-level-errors
HCastano 412c9ac
Tweak E2E tests to make them pass given Andrew's fixes
HCastano 59bde0e
Remove outdated UI test
HCastano 6eea67e
Fix a couple more tests
HCastano a78b042
Unify output type and arrow in codegen
HCastano 96c9c42
Allow `result_unit_err` Clippy lint
HCastano f113dc2
Move `Flipper` functionality into integration example
HCastano f6b4c10
Rename `cross_chain_test` to indicate that its an integration test
HCastano 8b8eec8
Remove test helper scripts
HCastano 6c24543
Remove `ContractRef` example/compile test
HCastano ce67e87
Appease Clippy
HCastano f5b5ae4
Add `MessageResult` type alias
HCastano 0fbbae1
Remove `Ref` re-export from Flipper
HCastano 894e898
Remove TODOs related to E2E issues
HCastano fa9d57b
Work around `additional_contracts` bug by moving tests
HCastano 51dec24
Clean up `lang_err_integration_tests` a bit
HCastano cee90d7
Fix spellcheck lint
HCastano b1cfc9f
Merge branch 'master' into hc-add-ink-level-errors
HCastano 1870988
Place E2E tests behind feature flag
HCastano 476ed65
Apply suggestions from code review
HCastano 2ce3677
Unwrap message result in delegator E2E tests
HCastano 3410224
Revert "Remove `ContractRef` example/compile test"
HCastano 98aa04f
Move `LangError` integration tests into single workspace
HCastano 0164c01
Move flip related E2E tests to `integration_flipper`
HCastano 3ed6521
Move `integration_flipper` into its own folder
HCastano a82346e
Update `call_builder` test to use `integration_flipper`
HCastano 50c5f4e
Get `contract_ref` E2E test working again
HCastano d63cae1
Fill out author and version metadata
HCastano 55c4f3c
Add integration tests to CI
HCastano 671377e
Remove leftover .gitignore
HCastano c7b8b07
Skip default checks if it's a lang error integration test
HCastano ed6a6d6
Fix UI test
HCastano 1a74375
Skip a few CI stages
HCastano dff5ada
Add back Clippy stage
HCastano 26e2e37
Revert "Skip a few CI stages"
HCastano 49d2ee4
Run `LangError` E2E tests in CI
HCastano 5785eb0
Rename tests using kabob-case instead of snake_case
HCastano 7d57f8c
Try running with `staging` image
HCastano 2b05e59
Change image back to `production`
HCastano 80a27a7
Try cleaning some things
HCastano 0212c90
Guess there was no lockfile
HCastano 12bc824
Clean up the cleanup
HCastano 55b4e4f
Clean em up again
HCastano 1644343
Use `MessageResult` typedef in one more place
HCastano f1211ba
Poke CI
HCastano 9a1e41f
Move comment location
HCastano 4057790
Update contract name
HCastano File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -71,3 +71,7 @@ pub use ink_macro::{ | |
| test, | ||
| trait_definition, | ||
| }; | ||
| pub use ink_primitives::{ | ||
| LangError, | ||
| MessageResult, | ||
| }; | ||
This file contains hidden or 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
20 changes: 20 additions & 0 deletions
20
crates/ink/tests/ui/contract/fail/message-hygiene-checked.rs
This file contains hidden or 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,20 @@ | ||
| #[ink::contract] | ||
| mod contract { | ||
| #[ink(storage)] | ||
| pub struct Contract {} | ||
|
|
||
| impl Contract { | ||
| #[ink(constructor)] | ||
| pub fn constructor() -> Self { | ||
| Self {} | ||
| } | ||
|
|
||
| #[ink(message)] | ||
| pub fn message(&self) {} | ||
|
|
||
| #[ink(message)] | ||
| pub fn message_checked(&self) {} | ||
| } | ||
| } | ||
|
|
||
| fn main() {} |
8 changes: 8 additions & 0 deletions
8
crates/ink/tests/ui/contract/fail/message-hygiene-checked.stderr
This file contains hidden or 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 @@ | ||
| error[E0201]: duplicate definitions with name `message_checked`: | ||
| --> tests/ui/contract/fail/message-hygiene-checked.rs:16:9 | ||
| | | ||
| 1 | #[ink::contract] | ||
| | ---------------- previous definition of `message_checked` here | ||
| ... | ||
| 16 | pub fn message_checked(&self) {} | ||
| | ^^^ duplicate definition |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.