diff --git a/frege/compiler/gen/java/Match.fr b/frege/compiler/gen/java/Match.fr index b97301e6..aacde2e4 100644 --- a/frege/compiler/gen/java/Match.fr +++ b/frege/compiler/gen/java/Match.fr @@ -165,7 +165,7 @@ match assert (pat@PCon {pos,qname,pats}) bind cont binds = do -- g <- getST symd <- U.findD qname -- forall a.a -> List a -> List a symt <- U.findT symd.name.tynm -- forall a.List a - if symt.enum then matchEnum (SymbolT.D symd) (SymbolT.T symt) + if symt.enum then matchEnum symd else if symt.product then if symt.newt then matchNew symd symt @@ -178,15 +178,13 @@ match assert (pat@PCon {pos,qname,pats}) bind cont binds = do other → kbnd comment g = sComment ("match " ++ nice pat g ++ " with " ++ show bind) - -- matchNewt :: Symbol -> Symbol -> StG (Binding, [JStmt]) - -- matchNewt symd symt = match (head pats) bind cont binds - matchEnum :: Symbol -> Symbol -> StG (Binding, [JStmt]) - matchEnum symd symt = do + matchEnum :: SymD Global -> StG (Binding, [JStmt]) + matchEnum symd = do g <- getST let sbnd = unKindedStrict g bind -- (bind, code1) <- realize "$" sbnd body <- cont binds - let comp = JBin sbnd.jex "==" (JX.staticMember (symJavaName g symd)) + let comp = JBin sbnd.jex "==" (JX.staticMember (symJavaName g $ SymbolT.D symd)) ifc = if assert then JAssert comp : body else [JCond "if" comp body] stio (sbnd, comment g : ifc)