Commit 300b6c4
Rework fallible constructors (#1491)
* Remove unused trait `InitializerReturnType`
* WIP experimenting with static constructor return types
* WIP
* WIP generating metadata at compile time
* WIP using constructor result type
* Use generated method for metadata
* Generate constructor info using static types
* WIP restoring dispatch
* WIP adding metadata test to ui test
* Fix match as_result
* Attempt to infer result type
* Constructor dispatch compiles, remove metadata syntax stuff
* Fmt
* Remove unnecessary braces
* Fix up execution for results
* Fix up tests
* Remove printlns
* Explicitly set reverted flag
* ReturnTypeSpec accurately reflects ABI
* Polished refactor for constructor return type (#1500)
* revert instantiating when error
* display name + correct return typ when Self
* fix dereferencing issue
* UI test error variant + cleanup
* cargo fmt
* cargo fmt
* fix another reference issue
* fix spec contract test
Co-authored-by: Andrew Jones <ascjones@gmail.com>
* explicit prelude + fixing test error messages (#1503)
* Add constructor to ReturnFlags to not require Default trait impl
* Only invoke return_value for fallible constructors
* Add e2e fallible constructor value tests
* Fmt
* Add some reflection tests for constructors returning an error
* Check reflection for return types in UI tests
* Check reflection in example
* Fmt
* Add test for fallible constructor succeeding
* Add test for fallible constructor failing
* Remove unused message
* Fully qualify Ok(())
Co-authored-by: German <german@parity.io>1 parent 6c6e51a commit 300b6c4
File tree
19 files changed
+589
-342
lines changed- crates
- e2e/src
- env/src
- ink
- codegen/src/generator
- src
- codegen
- dispatch
- reflect
- tests/ui/contract
- fail
- pass
- metadata/src
- examples/lang-err-integration-tests/constructors-return-value
19 files changed
+589
-342
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
321 | 321 | | |
322 | 322 | | |
323 | 323 | | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
324 | 352 | | |
325 | 353 | | |
326 | 354 | | |
| |||
337 | 365 | | |
338 | 366 | | |
339 | 367 | | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
| 368 | + | |
347 | 369 | | |
348 | 370 | | |
349 | 371 | | |
| |||
429 | 451 | | |
430 | 452 | | |
431 | 453 | | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
432 | 465 | | |
433 | 466 | | |
434 | 467 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
259 | | - | |
| 259 | + | |
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
264 | 268 | | |
265 | 269 | | |
266 | 270 | | |
267 | | - | |
| 271 | + | |
268 | 272 | | |
| 273 | + | |
| 274 | + | |
269 | 275 | | |
270 | 276 | | |
271 | 277 | | |
| |||
442 | 448 | | |
443 | 449 | | |
444 | 450 | | |
445 | | - | |
446 | 451 | | |
447 | 452 | | |
448 | 453 | | |
| |||
452 | 457 | | |
453 | 458 | | |
454 | 459 | | |
455 | | - | |
| 460 | + | |
456 | 461 | | |
457 | 462 | | |
458 | 463 | | |
| |||
573 | 578 | | |
574 | 579 | | |
575 | 580 | | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
576 | 588 | | |
577 | 589 | | |
578 | 590 | | |
579 | 591 | | |
580 | 592 | | |
581 | 593 | | |
582 | 594 | | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
583 | 600 | | |
584 | 601 | | |
585 | 602 | | |
586 | 603 | | |
587 | 604 | | |
588 | 605 | | |
589 | 606 | | |
590 | | - | |
591 | | - | |
592 | | - | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
593 | 633 | | |
594 | 634 | | |
595 | 635 | | |
| |||
768 | 808 | | |
769 | 809 | | |
770 | 810 | | |
771 | | - | |
772 | | - | |
773 | 811 | | |
774 | 812 | | |
775 | 813 | | |
| |||
788 | 826 | | |
789 | 827 | | |
790 | 828 | | |
791 | | - | |
| 829 | + | |
| 830 | + | |
792 | 831 | | |
793 | 832 | | |
794 | 833 | | |
795 | 834 | | |
796 | 835 | | |
797 | 836 | | |
798 | | - | |
| 837 | + | |
799 | 838 | | |
800 | 839 | | |
801 | 840 | | |
| |||
0 commit comments