diff --git a/src/Cryptol/TypeCheck/Kind.hs b/src/Cryptol/TypeCheck/Kind.hs index 72f84667..60b4600d 100644 --- a/src/Cryptol/TypeCheck/Kind.hs +++ b/src/Cryptol/TypeCheck/Kind.hs @@ -25,6 +25,7 @@ import Cryptol.TypeCheck.AST import Cryptol.TypeCheck.Error import Cryptol.TypeCheck.Monad hiding (withTParams) import Cryptol.TypeCheck.SimpType(tRebuild) +import Cryptol.TypeCheck.SimpleSolver(simplify) import Cryptol.TypeCheck.Solve (simplifyAllConstraints ,wfTypeFunction,wfTC) import Cryptol.Utils.Panic (panic) @@ -47,7 +48,12 @@ checkSchema withWild (P.Forall xs ps t mb) = do ps1 <- mapM checkProp ps t1 <- doCheckType t (Just KType) return (ps1,t1) - return ( Forall xs1 (map tRebuild ps1) (tRebuild t1) + -- XXX: We probably shouldn't do this, as we are changing what the + -- user is doing. We do it so that things are in a propal normal form, + -- but we should probably figure out another time to do this. + let newPs = concatMap pSplitAnd $ map (simplify Map.empty) + $ map tRebuild ps1 + return ( Forall xs1 newPs (tRebuild t1) , [ g { goal = tRebuild (goal g) } | g <- gs ] ) diff --git a/src/Cryptol/TypeCheck/Subst.hs b/src/Cryptol/TypeCheck/Subst.hs index 2c654911..1e5bc7c5 100644 --- a/src/Cryptol/TypeCheck/Subst.hs +++ b/src/Cryptol/TypeCheck/Subst.hs @@ -247,9 +247,16 @@ instance TVars Expr where EProofAbs p e -> EProofAbs hmm (go e) where hmm = case pSplitAnd (apSubst su p) of [p1] -> p1 - _ -> panic "apSubst@EProofAbs" + res -> panic "apSubst@EProofAbs" [ "Predicate split or disappeared after" - , "we applied a substitution." ] + , "we applied a substitution." + , "Predicate:" + , show (pp p) + , "Became:" + , show (map pp res) + , "subst:" + , show (pp su) + ] EProofApp e -> EProofApp (go e)