Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
536b500
Return `ConstructorResult` in `deploy()`
HCastano Nov 16, 2022
1ab55d9
Wrap return type with `Result` in metadata
HCastano Nov 16, 2022
79dff48
Check that constructor's return Results in tests
HCastano Nov 16, 2022
228604c
Add test showing that `Result`s are decoded correctly
HCastano Nov 16, 2022
bb4c1a2
Correctly generate metadata for constructors
HCastano Nov 17, 2022
15439a4
Merge branch 'master' into hc-impl-lang-error-for-constructors
HCastano Nov 17, 2022
27b6b97
Fix some nitpicks from Andrew's PR
HCastano Nov 17, 2022
eb10da6
Wrap dispatch return types with `Ok`
HCastano Nov 17, 2022
8b1aa66
Manually wrap metadata return with `ConstructorResult`
HCastano Nov 17, 2022
36556e7
Fix existing constructor integration tests
HCastano Nov 17, 2022
e61576e
Remove constructor related test from `integration-flipper`
HCastano Nov 17, 2022
a3e0b24
Fix compile tests
HCastano Nov 17, 2022
fb8d293
Add `ident` to dictionary
HCastano Nov 17, 2022
394ffca
Simplify code
athei Nov 18, 2022
2f026a2
Driveby: Also simplify call dispatch
athei Nov 18, 2022
c501d84
Small fixes to type paths
HCastano Nov 18, 2022
c307516
Check that actual instantiate call fails
HCastano Nov 18, 2022
aaebac4
Add some tests using the `CreateBuilder`
HCastano Nov 18, 2022
b63ef91
Clean up the `create_builder` tests
HCastano Nov 19, 2022
0c37262
Merge branch 'master' into hc-impl-lang-error-for-constructors
HCastano Nov 21, 2022
ec6253d
Remove unused method
HCastano Nov 21, 2022
d56b728
Format code for generating constructor return type
HCastano Nov 21, 2022
053f570
Add `constructors-return-value` to CI
HCastano Nov 21, 2022
7305887
Move shared imports out of messages
HCastano Nov 21, 2022
0ef75f9
Appease Clippy
HCastano Nov 21, 2022
4607a67
Appease Clippy
HCastano Nov 21, 2022
f791bfb
Try flipping order of tests
HCastano Nov 21, 2022
5d0f164
Change message name
HCastano Nov 21, 2022
e8b4e75
Revert last two changes
HCastano Nov 21, 2022
cab6c98
Try moving message related test to different module
HCastano Nov 21, 2022
4dc9973
Revert "Try moving message related test to different module"
HCastano Nov 21, 2022
ad1cab7
Try different type for account ID
HCastano Nov 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix compile tests
  • Loading branch information
HCastano committed Nov 17, 2022
commit a3e0b2470045c49da4026d87c7ac95ac48c3dac8
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error[E0277]: the trait bound `Result<(), &contract::Error>: Encode` is not satisfied
error[E0277]: the trait bound `Result<Result<(), &contract::Error>, LangError>: Encode` is not satisfied
--> tests/ui/contract/fail/constructor-return-result-non-codec-error.rs:13:9
|
13 | pub fn constructor() -> Result<Self, Error> {
| ^^^ the trait `Encode` is not implemented for `Result<(), &contract::Error>`
| ^^^ the trait `Encode` is not implemented for `Result<Result<(), &contract::Error>, LangError>`
|
= help: the trait `Encode` is implemented for `Result<T, E>`
note: required by a bound in `return_value`
Expand All @@ -28,6 +28,8 @@ error[E0277]: the trait bound `contract::Error: TypeInfo` is not satisfied
(A, B, C, D, E, F)
and $N others
= note: required for `Result<(), contract::Error>` to implement `TypeInfo`
= note: 1 redundant requirement hidden
= note: required for `Result<Result<(), contract::Error>, LangError>` to implement `TypeInfo`
note: required by a bound in `TypeSpec::with_name_str`
--> $WORKSPACE/crates/metadata/src/specs.rs
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ fn main() {
assert_eq!("constructor", constructor.label());
let type_spec = constructor.return_type().opt_type().unwrap();
assert_eq!(
"core::result::Result",
"ink_primitives::ConstructorResult",
format!("{}", type_spec.display_name())
);
let ty = metadata.registry().resolve(type_spec.ty().id()).unwrap();
Expand All @@ -68,16 +68,39 @@ fn main() {
scale_info::TypeDef::Variant(variant) => {
assert_eq!(2, variant.variants().len());

let ok_variant = &variant.variants()[0];
let ok_field = &ok_variant.fields()[0];
let ok_ty = metadata.registry().resolve(ok_field.ty().id()).unwrap();
// Outer Result
let outer_ok_variant = &variant.variants()[0];
let outer_ok_field = &outer_ok_variant.fields()[0];
let outer_ok_ty = metadata
.registry()
.resolve(outer_ok_field.ty().id())
.unwrap();
assert_eq!("Ok", outer_ok_variant.name());

// Inner Result
let inner_ok_ty = match outer_ok_ty.type_def() {
scale_info::TypeDef::Variant(variant) => {
assert_eq!(2, variant.variants().len());

let inner_ok_variant = &variant.variants()[0];
assert_eq!("Ok", inner_ok_variant.name());

let inner_ok_field = &inner_ok_variant.fields()[0];
metadata
.registry()
.resolve(inner_ok_field.ty().id())
.unwrap()
}
td => panic!("Expected a Variant type def enum, got {:?}", td),
};

let unit_ty = scale_info::TypeDef::Tuple(
scale_info::TypeDefTuple::new_portable(vec![]),
);
assert_eq!("Ok", ok_variant.name());

assert_eq!(
&unit_ty,
ok_ty.type_def(),
inner_ok_ty.type_def(),
"Ok variant should be a unit `()` type"
);

Expand Down