Skip to content

Conversation

@jonathanlim222
Copy link
Contributor

This PR implements and adds conformance tests for bool/integer/list/pair/unit casing.

Additional case behavior information:

  • Caseing a builtin list, exactly one or two branches are allowed: with a single branch, Case assumes the list is non-empty and applies the head element and the tail to that branch; with two branches, the first branch is selected if the list is empty (and takes no arguments), and the second branch is chosen if the list is non-empty, receiving the head element and the tail as its arguments. Note, the single branch WILL FAIL the script evaluation if empty list is given.
  • Caseing on pairs expects a single branch that takes two arguments for each values of the pair
  • Caseing on the unit expects a single branch or arbitrary value which will get picked everytime

References:
[Builtins] Allow casing on booleans and integers
[Builtins] Add constant casing for builtin unit and pair
[Builtins] Allow casing on lists

jonathanlim222 and others added 4 commits September 24, 2025 09:47
Signed-off-by: Jonathan Lim <jonathan.lim.222@gmail.com>
Signed-off-by: Jonathan Lim <jonathan.lim.222@gmail.com>
Signed-off-by: Jonathan Lim <jonathan.lim.222@gmail.com>
@jonathanlim222 jonathanlim222 requested a review from a team as a code owner September 24, 2025 15:05
}
_ => Err(MachineError::ExplicitErrorTerm),
},
v => Err(MachineError::NonConstrScrutinized(v)),
Copy link
Contributor

Choose a reason for hiding this comment

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

Has this error changed in the haskell version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated some of the errors to be more in line with the Haskell implementation.

Signed-off-by: Jonathan Lim <jonathan.lim.222@gmail.com>
Signed-off-by: Jonathan Lim <jonathan.lim.222@gmail.com>
@jonathanlim222
Copy link
Contributor Author

Not really sure why the Clippy and Format checks are failing now, it worked before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants