Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 394
    • Issues 394
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 17
    • Merge requests 17
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Merge requests
  • !265

Combine afterguard and guard into a single primitive function

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Jordy Aaldering requested to merge 2367-guard-rebase into develop Dec 20, 2023
  • Overview 2
  • Commits 13
  • Changes 46

Conformity checks only have an afterguard, we want to combine this afterguard with guard so that we have a single primitive function, instead of having almost the same thing twice.

Additionally, similarly to type patterns, we want this guard to occur both before and after the conformity checked code so that we can keep the context in the future if we have better error messages.

Something like:

p1 = conformity check 1
...
pv = conformity check v

x1', .., xn' = guard (x, .., xn, p1, .., pv);
res1, .., resm = _prf_ (x1', .., xn');
res1', .., resm' = guard (res1, .., resm, p1, .., pv);

Because guards now have two variable amounts of arguments: the guarded values xi and the predicates xj, we are required to keep track of the number of returned values. To do this we added an attribute NumVariableRets to the N_prf node in the AST.

Closes #2367 (closed) Closes #2363 (closed)


Future work will include some human-readable context in the guard:

x1', .., xn' = guard (x, .., xn, p1, .., pv, "eg context of _sel_VxA_");

And the types of the returned arguments:

x1', .., xn' = guard (x, .., xn, typ1, .., typen, p1, .., pv);
Edited Dec 22, 2023 by Jordy Aaldering
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: 2367-guard-rebase