@@ -219,8 +219,6 @@ reifyRawApp t [n, b, x]
219 return $ RBind n' b' x'
219 return $ RBind n' b' x'
220reifyRawApp t [f, x]
220reifyRawApp t [f, x]
221 | t == reflm "RApp" = liftM2 RApp (reifyRaw f) (reifyRaw x)
221 | t == reflm "RApp" = liftM2 RApp (reifyRaw f) (reifyRaw x)
223− | t == reflm "RForce" = liftM RForce (reifyRaw t')
224reifyRawApp t [c]
222reifyRawApp t [c]
225 | t == reflm "RConstant" = liftM RConstant (reifyTTConst c)
223 | t == reflm "RConstant" = liftM RConstant (reifyTTConst c)
226reifyRawApp t args = fail ("Unknown reflection raw term in reifyRawApp: " ++ show (t, args))
224reifyRawApp t args = fail ("Unknown reflection raw term in reifyRawApp: " ++ show (t, args))
@@ -475,18 +473,15 @@ reflectTTQuotePattern unq (Constant c)
475 = do fill $ reflCall "TConst" [reflectConstant c]
473 = do fill $ reflCall "TConst" [reflectConstant c]
477reflectTTQuotePattern unq (Proj t i)
475reflectTTQuotePattern unq (Proj t i)
478− = do t' <- claimTy (sMN 0 "t") (Var (reflm "TT")) ; movelast t'
476+ = lift . tfail . InternalMsg $
479− fill $ reflCall "Proj" [Var t', RConstant (I i)]
477+ "Phase error! The Proj constructor is for optimization only and should not have been reflected during elaboration."
481− focus t'; reflectTTQuotePattern unq t
482−reflectTTQuotePattern unq (Erased)
478+reflectTTQuotePattern unq Erased
483 = do erased <- claimTy (sMN 0 "erased") (Var (reflm "TT"))
479 = do erased <- claimTy (sMN 0 "erased") (Var (reflm "TT"))
484 movelast erased
480 movelast erased
485 fill $ (Var erased)
481 fill $ (Var erased)
487−reflectTTQuotePattern unq (Impossible)
482+reflectTTQuotePattern unq Impossible
488− = do fill $ Var (reflm "Impossible")
483+ = lift . tfail . InternalMsg $
489− solve
484+ "Phase error! The Impossible constructor is for optimization only and should not have been reflected during elaboration."
490reflectTTQuotePattern unq (TType exp)
485reflectTTQuotePattern unq (TType exp)
491 = do ue <- getNameFrom (sMN 0 "uexp")
486 = do ue <- getNameFrom (sMN 0 "uexp")
492 claim ue (Var (sNS (sUN "TTUExp") ["Reflection", "Language"]))
487 claim ue (Var (sNS (sUN "TTUExp") ["Reflection", "Language"]))
@@ -539,7 +534,6 @@ reflectRawQuotePattern unq (RBind n b sc) =
539 freeNamesR (RApp f x) = freeNamesR f ++ freeNamesR x
534 freeNamesR (RApp f x) = freeNamesR f ++ freeNamesR x
540 freeNamesR RType = []
535 freeNamesR RType = []
541 freeNamesR (RUType _) = []
536 freeNamesR (RUType _) = []
542− freeNamesR (RForce r) = freeNamesR r
543 freeNamesR (RConstant _) = []
537 freeNamesR (RConstant _) = []
544reflectRawQuotePattern unq (RApp f x) =
538reflectRawQuotePattern unq (RApp f x) =
545 do fH <- getNameFrom (sMN 0 "f")
539 do fH <- getNameFrom (sMN 0 "f")
@@ -562,13 +556,6 @@ reflectRawQuotePattern unq (RUType univ) =
562 fill $ reflCall "RUType" [Var uH]
556 fill $ reflCall "RUType" [Var uH]
564 focus uH; fill (reflectUniverse univ); solve
558 focus uH; fill (reflectUniverse univ); solve
565−reflectRawQuotePattern unq (RForce r) =
566− do rH <- getNameFrom (sMN 0 "raw")
567− claim rH (Var (reflm "Raw"))
569− fill $ reflCall "RForce" [Var rH]
571− focus rH; reflectRawQuotePattern unq r
572reflectRawQuotePattern unq (RConstant c) =
559reflectRawQuotePattern unq (RConstant c) =
573 do cH <- getNameFrom (sMN 0 "const")
560 do cH <- getNameFrom (sMN 0 "const")
574 claim cH (Var (reflm "Constant"))
561 claim cH (Var (reflm "Constant"))
@@ -651,12 +638,13 @@ reflectTTQuote unq (App _ f x)
651 = reflCall "App" [reflectTTQuote unq f, reflectTTQuote unq x]
638 = reflCall "App" [reflectTTQuote unq f, reflectTTQuote unq x]
652reflectTTQuote unq (Constant c)
639reflectTTQuote unq (Constant c)
653 = reflCall "TConst" [reflectConstant c]
640 = reflCall "TConst" [reflectConstant c]
654−reflectTTQuote unq (Proj t i)
655− = reflCall "Proj" [reflectTTQuote unq t, RConstant (I i)]
656−reflectTTQuote unq (Erased) = Var (reflm "Erased")
657−reflectTTQuote unq (Impossible) = Var (reflm "Impossible")
658reflectTTQuote unq (TType exp) = reflCall "TType" [reflectUExp exp]
641reflectTTQuote unq (TType exp) = reflCall "TType" [reflectUExp exp]
659reflectTTQuote unq (UType u) = reflCall "UType" [reflectUniverse u]
642reflectTTQuote unq (UType u) = reflCall "UType" [reflectUniverse u]
643+reflectTTQuote _ (Proj _ _) =
644+ error "Phase error! The Proj constructor is for optimization only and should not have been reflected during elaboration."
645+reflectTTQuote unq Erased = Var (reflm "Erased")
646+reflectTTQuote _ Impossible =
647+ error "Phase error! The Impossible constructor is for optimization only and should not have been reflected during elaboration."
661reflectRawQuote :: [Name] -> Raw -> Raw
649reflectRawQuote :: [Name] -> Raw -> Raw
662reflectRawQuote unq (Var n)
650reflectRawQuote unq (Var n)
@@ -669,7 +657,6 @@ reflectRawQuote unq (RApp f x) =
669reflectRawQuote unq RType = Var (reflm "RType")
657reflectRawQuote unq RType = Var (reflm "RType")
670reflectRawQuote unq (RUType u) =
658reflectRawQuote unq (RUType u) =
671 reflCall "RUType" [reflectUniverse u]
659 reflCall "RUType" [reflectUniverse u]
672−reflectRawQuote unq (RForce r) = reflCall "RForce" [reflectRawQuote unq r]
673reflectRawQuote unq (RConstant cst) = reflCall "RConstant" [reflectConstant cst]
660reflectRawQuote unq (RConstant cst) = reflCall "RConstant" [reflectConstant cst]
675reflectNameType :: NameType -> Raw
662reflectNameType :: NameType -> Raw