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

Force enum payloads #1890

Merged
merged 2 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions core/src/eval/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1121,6 +1121,13 @@ impl<R: ImportResolver, C: Cache> VirtualMachine<R, C> {
// For an enum variant, `force x` is simply equivalent to `deep_seq x x`, as
// there's no lazy pending contract to apply.
Term::EnumVariant { tag, arg, attrs } => {
let arg = mk_term::op1(
UnaryOp::Force {
ignore_not_exported,
},
arg,
)
.closurize(&mut self.cache, env.clone());
let cont = RichTerm::new(
Term::EnumVariant {
tag,
Expand Down
7 changes: 7 additions & 0 deletions core/tests/integration/inputs/adts/deep_seq_enum2.ncl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# test.type = 'error'
#
# [test.metadata]
# error = 'EvalError::NAryPrimopTypeError'

# Check that deep_seq correctly deeply evaluates the content of an enum variant
%deep_seq% ('Foo { bar = 5 + "a" }) null
7 changes: 7 additions & 0 deletions core/tests/integration/inputs/adts/force_enum2.ncl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# test.type = 'error'
#
# [test.metadata]
# error = 'EvalError::NAryPrimopTypeError'

# Check that force correctly deeply evaluates the content of an enum variant
%force% ('Foo { bar = 5 + "a" })
Loading