@@ -636,7 +636,7 @@ elab ist info pattern opts fn tm
636 elab' ina (PUnifyLog t) = do unifyLog True
636 elab' ina (PUnifyLog t) = do unifyLog True
637 elab' ina t
637 elab' ina t
638 unifyLog False
638 unifyLog False
639− elab' (ina, g, inty, qq) (PQuasiquote t)
639+ elab' (ina, g, inty, qq) (PQuasiquote t goal) -- TODO: goal type
640 = do -- First extract the unquoted subterms, replacing them with fresh
640 = do -- First extract the unquoted subterms, replacing them with fresh
641 -- names in the quasiquoted term. Claim their reflections to be
641 -- names in the quasiquoted term. Claim their reflections to be
642 -- of type TT.
642 -- of type TT.
@@ -663,19 +663,25 @@ elab ist info pattern opts fn tm
663 movelast n)
663 movelast n)
664 unquoteNames
664 unquoteNames
666+ -- Determine whether there's an explicit goal type, and act accordingly
666 -- Establish holes for the type and value of the term to be
667 -- Establish holes for the type and value of the term to be
667 -- quasiquoted
668 -- quasiquoted
668 qTy <- getNameFrom (sMN 0 "qquoteTy")
669 qTy <- getNameFrom (sMN 0 "qquoteTy")
669 claim qTy RType
670 claim qTy RType
670 qTm <- getNameFrom (sMN 0 "qquoteTm")
672 qTm <- getNameFrom (sMN 0 "qquoteTm")
671 claim qTm (Var qTy)
673 claim qTm (Var qTy)
672 -- Let-bind the result of elaborating the contained term, so that
675 -- Let-bind the result of elaborating the contained term, so that
673 -- the hole doesn't disappear
676 -- the hole doesn't disappear
674 nTm <- getNameFrom (sMN 0 "quotedTerm")
677 nTm <- getNameFrom (sMN 0 "quotedTerm")
675 letbind nTm (Var qTy) (Var qTm)
678 letbind nTm (Var qTy) (Var qTm)
676− -- We must solve the type later through unification
680+ -- Fill out the goal type, if relevant
682+ Nothing -> return ()
683+ Just gTy -> do focus qTy
684+ elabE (ina, g, inty, True) gTy
680 -- Elaborate the quasiquoted term into the hole
686 -- Elaborate the quasiquoted term into the hole
681 focus qTm
687 focus qTm