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 primops to access the current diagnostic of a label #1156

Merged
merged 13 commits into from
Mar 8, 2023

Conversation

yannham
Copy link
Member

@yannham yannham commented Mar 3, 2023

A previous PR (#1152) introduced a more fine-grained interface for contract labels, in order to customize error diagnostic. This PR add the Nickel primops to make this interface accessible to usercode, as well as the corresponding stdlib functions.

Content

  • Adds label_with_message, label_with_notes, label_append_note, label_push_diag primops, calling the corresponding methods on Label
  • Adds corresponding functions in the stdlib, under the contract.label submodule
  • Gets rid of %tag% and contract.tag, superseded by %label_with_message% and contract.label.with_message
  • Renames accordingly contract.blame_with to contract.blame_with_message
  • Makes contract.apply to automatically call %label_push_diag%. This means that contract.apply becomes the implicit split point between a parent contract and children subcontracts: it will stack any previously set custom diagnostic, which will save it from further modifications. Later calls to e.g. contract.label.with_error_message will modify a new, fresh diagnostic. All stacked diagnostics are printed during error reporting, in reverse order.

A previous commit introduced a more fine-grained interface for contract
labels, in order to customize error diagnostic. This PR adds the Nickel
primops that make this interface accessible to usercode.
@github-actions github-actions bot temporarily deployed to pull request March 3, 2023 18:00 Inactive
Updates the contract stdlib to expose the new label primop introduced in
a previous commit. Renames existing function accordingly. Get rid of the
`%tag%` primop, now replaced by `%with_message%`.
@github-actions github-actions bot temporarily deployed to pull request March 6, 2023 18:21 Inactive
@github-actions github-actions bot temporarily deployed to pull request March 6, 2023 18:28 Inactive
@github-actions github-actions bot temporarily deployed to pull request March 6, 2023 18:34 Inactive
@github-actions github-actions bot temporarily deployed to pull request March 6, 2023 18:39 Inactive
@yannham yannham marked this pull request as ready for review March 6, 2023 18:50
@github-actions github-actions bot temporarily deployed to pull request March 6, 2023 18:54 Inactive
Copy link
Contributor

@ebresafegaga ebresafegaga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 🤩

src/label.rs Outdated Show resolved Hide resolved
Co-authored-by: Oghenevwogaga Ebresafe <gaga.ebresafe@tweag.io>
@github-actions github-actions bot temporarily deployed to pull request March 7, 2023 13:46 Inactive
Copy link
Contributor

@vkleen vkleen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 No technical concerns, just some typochecking.

stdlib/contract.ncl Outdated Show resolved Hide resolved
stdlib/contract.ncl Outdated Show resolved Hide resolved
stdlib/contract.ncl Outdated Show resolved Hide resolved
stdlib/contract.ncl Outdated Show resolved Hide resolved
@yannham
Copy link
Member Author

yannham commented Mar 8, 2023

typochecking

Noice 😎

yannham and others added 4 commits March 8, 2023 14:45
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
Co-authored-by: Viktor Kleen <viktor.kleen@tweag.io>
@github-actions github-actions bot temporarily deployed to pull request March 8, 2023 13:50 Inactive
@yannham yannham added the merge-queue merge on green CI label Mar 8, 2023
@yannham yannham merged commit 19453be into master Mar 8, 2023
@yannham yannham deleted the feature/contract-diag-interface branch March 8, 2023 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-queue merge on green CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants