Skip to content
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

Add a contract node to the AST #1955

Merged
merged 2 commits into from
Jun 13, 2024
Merged

Add a contract node to the AST #1955

merged 2 commits into from
Jun 13, 2024

Commits on Jun 13, 2024

  1. Add CustomContract node to the AST

    This commit continues the work of properly separating custom contracts
    in the AST, in order to maintain more run-time information and be able,
    in the long run, to perform operations like boolean `or` on a larger
    class of contracts and to provide better error messages in some
    situations.
    
    This commit focuses on predicates, built using the
    `std.contract.from_predicate` which now acts as some kind of type
    constructor. `%contract/apply%` then performs the conversion of this
    predicate to a generic custom contract (a partial identity function).
    
    Note that this is a backward-incompatible change on paper, because
    before one could apply a custom contract built from a predicate as a
    function (taking a label and a value, and returning a new value).
    However, in practice, it's not officially supported - users are
    requested to use `std.contract.apply` to manipulate contracts - and thus
    we don't expect actual breakage to happen.
    yannham committed Jun 13, 2024
    Configuration menu
    Copy the full SHA
    6384bb5 View commit details
    Browse the repository at this point in the history
  2. Update core/src/term/mod.rs

    Co-authored-by: jneem <joeneeman@gmail.com>
    yannham and jneem authored Jun 13, 2024
    Configuration menu
    Copy the full SHA
    4c690b6 View commit details
    Browse the repository at this point in the history