also drop singleton cases for lit / default

This commit is contained in:
2026-03-19 22:08:23 -07:00
parent cfdddbb002
commit f3f9d737cf
3 changed files with 6 additions and 0 deletions

View File

@@ -170,6 +170,8 @@ cexpToScm env (CCase sc alts) = do
(CLitAlt _ _ :: _) => fatalError "lit alt after nil"
_ => fatalError "too many alts after cons"
doCase nm (CConAlt tag cname _ args qs body :: Nil) = conAlt env nm Lin args body
doCase nm (CLitAlt _ body :: Nil) = cexpToScm env body
doCase nm (CDefAlt body :: Nil) = cexpToScm env body
doCase nm alts@(CLitAlt _ _ :: _) = "(case \{nm} \{joinBy " " $ map (doAlt nm) alts})"
--
doCase nm alts = "(case (vector-ref \{cexpToScm env sc} 0) \{joinBy " " $ map (doAlt nm) alts})"