Skip to content

[#9] Print intermediate stack types when verbose typechecking is enabled

Description

Enabling stack type comments

I did that by extending CommentType data, which in turn is used by external instructions (not present in the Michelson specification). It does not enforce type correctness of the given stack, but it doesn't seem to be very useful anyway. To specify whether or not verbose typechecking is required, I've added another ReaderT on top of the TypeCheck stack with typechecking options.

Enabling printing singatures in ill-typed contracts

What that basically means, is that if we find an error at some point in the contract parsing tree, we should preserve all the existing typed information, as well as remaining, untyped part of the tree. Thus, I made a tree which can have well-typed (Typed.Instr), semi-typed(TypeCheckedInstr, can contain both well-typed and ill-typed children) and ill-typed(ExpandedOp) nodes. It can be found in Michelson.TypeCheck.TypeCheckedOp and Michelson.TypeCheck.TypeCheckedSeq modules. The latter is for type-safe typechecking of a list of ExpandedOp.

Integrating a partially typed result of typechecking into the current error system

When verbose typechecking is enabled, at the top of typechecking layers (in the typeCheckContractImpl function) we simply throw the result wrapped in a Contract' constructor.

That requried adding another constructor to TCError.

Related issue(s)

Resolves #9 (closed)

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
    • I updated changelog files of all affected packages released to Hackage if my changes are externally visible.

Stylistic guide (mandatory)

Edited by Artem Yurchenko

Merge request reports

Loading