From ed220adbadd3931776d577d1b550275d37f688c8 Mon Sep 17 00:00:00 2001 From: Nikhil Swamy Date: Tue, 22 Oct 2024 15:50:55 -0700 Subject: [PATCH] add a test case of a casetype with identical branches --- src/3d/TranslateForInterpreter.fst | 3 --- src/3d/tests/BoolSwitch.3d | 14 +++++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/3d/TranslateForInterpreter.fst b/src/3d/TranslateForInterpreter.fst index d360c1736..1d90709e4 100644 --- a/src/3d/TranslateForInterpreter.fst +++ b/src/3d/TranslateForInterpreter.fst @@ -269,9 +269,6 @@ let dep_pair_with_action_parser p1 (a:T.lam T.action) (p2:A.ident & T.parser) = let extend_fieldname fieldname e = Printf.sprintf "%s.%s" fieldname e let ite_parser typename fieldname (e:T.expr) (then_:T.parser) (else_:T.parser) : ML T.parser = let k, p1, p2 = - // if T.parser_kind_eq then_.p_kind else_.p_kind - // then then_.p_kind, then_, else_ - // else let k = pk_glb then_.p_kind else_.p_kind in k, mk_parser k then_.p_typ typename (extend_fieldname fieldname "case_left") (T.Parse_weaken_right then_ else_.p_kind), diff --git a/src/3d/tests/BoolSwitch.3d b/src/3d/tests/BoolSwitch.3d index 931329df2..136d992a9 100755 --- a/src/3d/tests/BoolSwitch.3d +++ b/src/3d/tests/BoolSwitch.3d @@ -8,4 +8,16 @@ casetype _T (Bool b) case false: UINT32 integer; } -} T; \ No newline at end of file +} T; + +entrypoint +casetype _S (Bool b) +{ + switch (b) + { + case true: + UINT32 f; + default: + UINT32 g; + } +} S; \ No newline at end of file