@@ -630,7 +630,14 @@ elab ist info pattern opts fn tm
630 elab' ina t
630 elab' ina t
631 unifyLog False
631 unifyLog False
632 elab' ina (PQuasiquote t)
632 elab' ina (PQuasiquote t)
633+ = do -- Save the old state - we need a fresh proof state for this to
637+ updatePS (const $ newProof (sMN 0 "q") ctxt (P Ref (sNS (sUN "TT") ["Reflection", "Language"]) Erased))
633− = do -- Establish holes for the type and value of the term to be quasiquoted
639+ -- Establish holes for the type and value of the term to be
634 qTy <- getNameFrom (sMN 0 "qquoteTy")
641 qTy <- getNameFrom (sMN 0 "qquoteTy")
635 claim qTy RType
642 claim qTy RType
636 qTm <- getNameFrom (sMN 0 "qquoteTm")
643 qTm <- getNameFrom (sMN 0 "qquoteTm")
@@ -644,12 +651,16 @@ elab ist info pattern opts fn tm
644 -- Elaborate the quasiquoted term into the hole that was
651 -- Elaborate the quasiquoted term into the hole that was
645 focus qTm
652 focus qTm
646 elab' ina t
653 elab' ina t
647− -- We now have an elaborated term. Reflect it and solve the original goal
654+ -- We now have an elaborated term. Reflect it and solve the
648− ctxt <- get_context
655+ -- original goal
649 env <- get_env
656 env <- get_env
650− let qTerm = normalise ctxt env (P Bound nTm Erased)
657+ let qTerm = fmap (reflect . binderVal) $ lookup nTm env
651− fill $ reflect qTerm
658+ case qTerm of
659+ Just q -> do loadState
662+ Nothing -> fail "Broken elaboration of quasiquote"
653 elab' ina (PUnquote t) = fail "Elaboration of unquotes not yet implemented"
664 elab' ina (PUnquote t) = fail "Elaboration of unquotes not yet implemented"
654 elab' ina x = fail $ "Unelaboratable syntactic form " ++ showTmImpls x
665 elab' ina x = fail $ "Unelaboratable syntactic form " ++ showTmImpls x