@@ -615,10 +615,12 @@ instance Show Def where
615 show (Function ty tm) = "Function: " ++ show (ty, tm)
615 show (Function ty tm) = "Function: " ++ show (ty, tm)
616 show (TyDecl nt ty) = "TyDecl: " ++ show nt ++ " " ++ show ty
616 show (TyDecl nt ty) = "TyDecl: " ++ show nt ++ " " ++ show ty
617 show (Operator ty _ _) = "Operator: " ++ show ty
617 show (Operator ty _ _) = "Operator: " ++ show ty
618− show (CaseOp _ _ ty ps_in ps ns sc ns' sc')
618+ show (CaseOp inlc inlr ty ps_in ps ns sc ns' sc')
619 = "Case: " ++ show ty ++ " " ++ show ps ++ "\n" ++
619 = "Case: " ++ show ty ++ " " ++ show ps ++ "\n" ++
620 show ns ++ " " ++ show sc ++ "\n" ++
620 show ns ++ " " ++ show sc ++ "\n" ++
621− show ns' ++ " " ++ show sc'
621+ show ns' ++ " " ++ show sc' ++ "\n" ++
622+ if inlc then "Inlinable\n" else "Not inlinable\n"
622-- We need this for serialising Def. Fortunately, it never gets used because
624-- We need this for serialising Def. Fortunately, it never gets used because
623-- we'll never serialise a primitive operator
625-- we'll never serialise a primitive operator
@@ -725,12 +727,12 @@ addDatatype (Data n tag ty cons) uctxt
725 addCons (tag+1) cons (addDef n
727 addCons (tag+1) cons (addDef n
726 (TyDecl (DCon tag (arity ty')) ty, Public, Unchecked) ctxt)
728 (TyDecl (DCon tag (arity ty')) ty, Public, Unchecked) ctxt)
728−addCasedef :: Name -> Bool -> Bool -> Bool ->
730+addCasedef :: Name -> Bool -> Bool -> Bool -> Bool ->
729 [Either Term (Term, Term)] ->
731 [Either Term (Term, Term)] ->
730 [([Name], Term, Term)] ->
732 [([Name], Term, Term)] ->
731 [([Name], Term, Term)] ->
733 [([Name], Term, Term)] ->
732 Type -> Context -> Context
734 Type -> Context -> Context
733−addCasedef n alwaysInline tcase covering ps_in ps psrt ty uctxt
735+addCasedef n alwaysInline tcase covering asserted ps_in ps psrt ty uctxt
734 = let ctxt = definitions uctxt
736 = let ctxt = definitions uctxt
735 access = case lookupDefAcc Nothing n False uctxt of
737 access = case lookupDefAcc Nothing n False uctxt of
736 [(_, acc)] -> acc
738 [(_, acc)] -> acc
@@ -738,8 +740,10 @@ addCasedef n alwaysInline tcase covering ps_in ps psrt ty uctxt
738 ctxt' = case (simpleCase tcase covering CompileTime (FC "" 0) ps,
740 ctxt' = case (simpleCase tcase covering CompileTime (FC "" 0) ps,
739 simpleCase tcase covering RunTime (FC "" 0) psrt) of
741 simpleCase tcase covering RunTime (FC "" 0) psrt) of
740 (OK (CaseDef args sc _), OK (CaseDef args' sc' _)) ->
742 (OK (CaseDef args sc _), OK (CaseDef args' sc' _)) ->
741− let inl = alwaysInline in
743+ let inl = alwaysInline
744+ inlc = (inl || small n args sc') && (not asserted)
745+ inlr = inl || small n args sc' in
742− addDef n (CaseOp inl (inl || small n args sc')
746+ addDef n (CaseOp inlc inlr
743 ty ps_in ps args sc args' sc',
747 ty ps_in ps args sc args' sc',
744 access, Unchecked) ctxt in
748 access, Unchecked) ctxt in
745 uctxt { definitions = ctxt' }
749 uctxt { definitions = ctxt' }