[go: up one dir, main page]

MIR: Refactor: return Result from typecheck

Context

This is some groundwork to implement gas consumption in the typechecker.

The current type signature of typecheck function returns either true or false, but we have more than one mode of failure.

In particular, typechecker can run out of gas. Returning the same value for all modes of failure is obviously suboptimal.

In addition, using Result allows us to reduce boilerplate by using the ? operator.

This MR doesn't concern itself with improving errors themselves too much, this is left for further work. However, some obvious cases are added.

Based on !10011 (merged)

Manually testing the MR

cargo test

Checklist

  • Document the interface of any function added or modified (see the coding guidelines)
  • Document any change to the user interface, including configuration parameters (see node configuration)
  • Provide automatic testing (see the testing guide).
  • For new features and bug fixes, add an item in the appropriate changelog (docs/protocols/alpha.rst for the protocol and the environment, CHANGES.rst at the root of the repository for everything else).
  • Select suitable reviewers using the Reviewers field below.
  • Select as Assignee the next person who should take action on that MR
Edited by Nikolay Yakimov

Merge request reports

Loading