@@ -463,18 +463,17 @@ equiv :: Raw -> Elab' aux ()
463equiv tm = processTactic' (Equiv tm)
463equiv tm = processTactic' (Equiv tm)
465-- | Turn the current hole into a pattern variable with the provided
465-- | Turn the current hole into a pattern variable with the provided
466−-- name, made unique if MN
466+-- name, made unique if not the same as the head of the hole queue
467patvar :: Name -> Elab' aux ()
467patvar :: Name -> Elab' aux ()
468patvar n@(SN _) = do apply (Var n) []; solve
468patvar n@(SN _) = do apply (Var n) []; solve
469patvar n = do env <- get_env
469patvar n = do env <- get_env
470 hs <- get_holes
470 hs <- get_holes
471 if (n `elem` map fst env) then do apply (Var n) []; solve
471 if (n `elem` map fst env) then do apply (Var n) []; solve
472− else do n' <- case n of
472+ else do n' <- case hs of
473− UN _ -> return $! n
473+ (h : hs) -> if n == h then return n
474− MN _ _ -> unique_hole n
474+ else unique_hole n
475− NS _ _ -> return $! n
475+ _ -> unique_hole n
477− processTactic' (PatVar n')
476+ processTactic' (PatVar n)
479-- | Turn the current hole into a pattern variable with the provided
478-- | Turn the current hole into a pattern variable with the provided
480-- name, but don't make MNs unique.
479-- name, but don't make MNs unique.