summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorSon Ho2023-12-13 11:00:35 +0100
committerSon Ho2023-12-13 11:00:35 +0100
commit0e52baf4e9befc4e0efb6ca336f382c1a47d56f3 (patch)
treedb29db566bb406b23b15fae36151bf100c0642ee /compiler
parent496a3849d1d6ba880bbd1e86c8ef5e2257bb702a (diff)
parentbfa83d948aff5ad0ec298836bf9f0be58a62d542 (diff)
Merge branch 'son/matches' into son/merge_back
Diffstat (limited to '')
-rw-r--r--compiler/InterpreterStatements.ml5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/InterpreterStatements.ml b/compiler/InterpreterStatements.ml
index 66b8492a..30b7b333 100644
--- a/compiler/InterpreterStatements.ml
+++ b/compiler/InterpreterStatements.ml
@@ -1125,7 +1125,10 @@ and eval_switch (config : config) (switch : switch) : st_cm_fun =
let dv = Option.get adt.variant_id in
(* Find the branch, evaluate and continue *)
match List.find_opt (fun (svl, _) -> List.mem dv svl) stgts with
- | None -> eval_statement config otherwise cf ctx
+ | None -> (
+ match otherwise with
+ | None -> raise (Failure "No otherwise branch")
+ | Some otherwise -> eval_statement config otherwise cf ctx)
| Some (_, tgt) -> eval_statement config tgt cf ctx)
| VSymbolic sv ->
(* Expand the symbolic value - may lead to branching *)