@@ -998,10 +998,10 @@ expandParams dec ps ns infs tm = en tm
998 PLet fc n' nfc (en ty) (en v) (en (shadow n n' s))
998 PLet fc n' nfc (en ty) (en v) (en (shadow n n' s))
999 | otherwise = PLet fc n nfc (en ty) (en v) (en s)
999 | otherwise = PLet fc n nfc (en ty) (en v) (en s)
1000 -- FIXME: Should only do this in a type signature!
1000 -- FIXME: Should only do this in a type signature!
1001− en (PDPair f p (PRef f' n) t r)
1001+ en (PDPair f p (PRef f' fcs n) t r)
1002 | n `elem` (map fst ps ++ ns) && t /= Placeholder
1002 | n `elem` (map fst ps ++ ns) && t /= Placeholder
1003 = let n' = mkShadow n in
1003 = let n' = mkShadow n in
1004− PDPair f p (PRef f' n') (en t) (en (shadow n n' r))
1004+ PDPair f p (PRef f' fcs n') (en t) (en (shadow n n' r))
1005 en (PRewrite f l r g) = PRewrite f (en l) (en r) (fmap en g)
1005 en (PRewrite f l r g) = PRewrite f (en l) (en r) (fmap en g)
1006 en (PTyped l r) = PTyped (en l) (en r)
1006 en (PTyped l r) = PTyped (en l) (en r)
1007 en (PPair f p l r) = PPair f p (en l) (en r)
1007 en (PPair f p l r) = PPair f p (en l) (en r)
@@ -1017,27 +1017,27 @@ expandParams dec ps ns infs tm = en tm
1018 en (PQuote (Var n))
1018 en (PQuote (Var n))
1019 | n `nselem` ns = PQuote (Var (dec n))
1019 | n `nselem` ns = PQuote (Var (dec n))
1020− en (PApp fc (PInferRef fc' n) as)
1020+ en (PApp fc (PInferRef fc' hl n) as)
1021− | n `nselem` ns = PApp fc (PInferRef fc' (dec n))
1021+ | n `nselem` ns = PApp fc (PInferRef fc' hl (dec n))
1022− (map (pexp . (PRef fc)) (map fst ps) ++ (map (fmap en) as))
1022+ (map (pexp . (PRef fc hl)) (map fst ps) ++ (map (fmap en) as))
1023− en (PApp fc (PRef fc' n) as)
1023+ en (PApp fc (PRef fc' hl n) as)
1024− | n `elem` infs = PApp fc (PInferRef fc' (dec n))
1024+ | n `elem` infs = PApp fc (PInferRef fc' hl (dec n))
1025− (map (pexp . (PRef fc)) (map fst ps) ++ (map (fmap en) as))
1025+ (map (pexp . (PRef fc hl)) (map fst ps) ++ (map (fmap en) as))
1026− | n `nselem` ns = PApp fc (PRef fc' (dec n))
1026+ | n `nselem` ns = PApp fc (PRef fc' hl (dec n))
1027− (map (pexp . (PRef fc)) (map fst ps) ++ (map (fmap en) as))
1027+ (map (pexp . (PRef fc hl)) (map fst ps) ++ (map (fmap en) as))
1028− en (PAppBind fc (PRef fc' n) as)
1028+ en (PAppBind fc (PRef fc' hl n) as)
1029− | n `elem` infs = PAppBind fc (PInferRef fc' (dec n))
1029+ | n `elem` infs = PAppBind fc (PInferRef fc' hl (dec n))
1030− (map (pexp . (PRef fc)) (map fst ps) ++ (map (fmap en) as))
1030+ (map (pexp . (PRef fc hl)) (map fst ps) ++ (map (fmap en) as))
1031− | n `nselem` ns = PAppBind fc (PRef fc' (dec n))
1031+ | n `nselem` ns = PAppBind fc (PRef fc' hl (dec n))
1032− (map (pexp . (PRef fc)) (map fst ps) ++ (map (fmap en) as))
1032+ (map (pexp . (PRef fc hl)) (map fst ps) ++ (map (fmap en) as))
1033− en (PRef fc n)
1033+ en (PRef fc hl n)
1034− | n `elem` infs = PApp fc (PInferRef fc (dec n))
1034+ | n `elem` infs = PApp fc (PInferRef fc hl (dec n))
1035− (map (pexp . (PRef fc)) (map fst ps))
1035+ (map (pexp . (PRef fc hl)) (map fst ps))
1036− | n `nselem` ns = PApp fc (PRef fc (dec n))
1036+ | n `nselem` ns = PApp fc (PRef fc hl (dec n))
1037− (map (pexp . (PRef fc)) (map fst ps))
1037+ (map (pexp . (PRef fc hl)) (map fst ps))
1038− en (PInferRef fc n)
1038+ en (PInferRef fc hl n)
1039− | n `nselem` ns = PApp fc (PInferRef fc (dec n))
1039+ | n `nselem` ns = PApp fc (PInferRef fc hl (dec n))
1040− (map (pexp . (PRef fc)) (map fst ps))
1040+ (map (pexp . (PRef fc hl)) (map fst ps))
1041 en (PApp fc f as) = PApp fc (en f) (map (fmap en) as)
1041 en (PApp fc f as) = PApp fc (en f) (map (fmap en) as)
1042 en (PAppBind fc f as) = PAppBind fc (en f) (map (fmap en) as)
1042 en (PAppBind fc f as) = PAppBind fc (en f) (map (fmap en) as)
1043 en (PCase fc c os) = PCase fc (en c) (map (pmap en) os)
1043 en (PCase fc c os) = PCase fc (en c) (map (pmap en) os)
@@ -1103,7 +1103,7 @@ expandParamsD rhsonly ist dec ps ns (PClauses fc opts n cs)
1104 removeBound lhs ns = ns \\ nub (bnames lhs)
1104 removeBound lhs ns = ns \\ nub (bnames lhs)
1106− bnames (PRef _ n) = [n]
1106+ bnames (PRef _ _ n) = [n]
1107 bnames (PApp _ _ args) = concatMap bnames (map getTm args)
1107 bnames (PApp _ _ args) = concatMap bnames (map getTm args)
1108 bnames (PPair _ _ l r) = bnames l ++ bnames r
1108 bnames (PPair _ _ l r) = bnames l ++ bnames r
1109 bnames (PDPair _ _ l Placeholder r) = bnames l ++ bnames r
1109 bnames (PDPair _ _ l Placeholder r) = bnames l ++ bnames r
@@ -1162,7 +1162,7 @@ mapsnd f (x, t) = (x, f t)
1162getPriority :: IState -> PTerm -> Int
1162getPriority :: IState -> PTerm -> Int
1163getPriority i tm = 1 -- pri tm
1163getPriority i tm = 1 -- pri tm
1165− pri (PRef _ n) =
1165+ pri (PRef _ _ n) =
1166 case lookupP n (tt_ctxt i) of
1166 case lookupP n (tt_ctxt i) of
1167 ((P (DCon _ _ _) _ _):_) -> 1
1167 ((P (DCon _ _ _) _ _):_) -> 1
1168 ((P (TCon _ _) _ _):_) -> 1
1168 ((P (TCon _ _) _ _):_) -> 1
@@ -1288,20 +1288,20 @@ addUsingConstraints syn fc t
1288 (mkConst c args) (doAdd cs ns t)
1288 (mkConst c args) (doAdd cs ns t)
1289 | otherwise = doAdd cs ns t
1289 | otherwise = doAdd cs ns t
1291− mkConst c args = PApp fc (PRef fc c)
1291+ mkConst c args = PApp fc (PRef fc [] c)
1292− (map (\n -> PExp 0 [] (sMN 0 "carg") (PRef fc n)) args)
1292+ (map (\n -> PExp 0 [] (sMN 0 "carg") (PRef fc [] n)) args)
1294 getConstraints (PPi (Constraint _ _) _ _ c sc)
1294 getConstraints (PPi (Constraint _ _) _ _ c sc)
1295 = getcapp c ++ getConstraints sc
1295 = getcapp c ++ getConstraints sc
1296 getConstraints (PPi _ _ _ c sc) = getConstraints sc
1296 getConstraints (PPi _ _ _ c sc) = getConstraints sc
1297 getConstraints _ = []
1297 getConstraints _ = []
1299− getcapp (PApp _ (PRef _ c) args)
1299+ getcapp (PApp _ (PRef _ _ c) args)
1300 = do ns <- mapM getName args
1300 = do ns <- mapM getName args
1301 return (UConstraint c ns)
1301 return (UConstraint c ns)
1302 getcapp _ = []
1302 getcapp _ = []
1304− getName (PExp _ _ _ (PRef _ n)) = return n
1304+ getName (PExp _ _ _ (PRef _ _ n)) = return n
1305 getName _ = []
1305 getName _ = []
1307-- Add implicit bindings from using block, and bind any missing names
1307-- Add implicit bindings from using block, and bind any missing names
@@ -1458,7 +1458,7 @@ implicitise syn ignore ist tm = -- trace ("INCOMING " ++ showImp True tm) $
1458 imps True (n:env) sc
1458 imps True (n:env) sc
1459 imps top env (PPi (Exp l _ _) n _ ty sc)
1459 imps top env (PPi (Exp l _ _) n _ ty sc)
1460 = do let isn = nub (implNamesIn uvars ty ++ case sc of
1460 = do let isn = nub (implNamesIn uvars ty ++ case sc of
1461− (PRef _ x) -> namesIn uvars ist sc `dropAll` [n]
1461+ (PRef _ _ x) -> namesIn uvars ist sc `dropAll` [n]
1462 _ -> [])
1462 _ -> [])
1463 (decls, ns) <- get -- ignore decls in HO types
1463 (decls, ns) <- get -- ignore decls in HO types
1464 put (PExp (getPriority ist ty) l n Placeholder : decls,
1464 put (PExp (getPriority ist ty) l n Placeholder : decls,
@@ -1466,7 +1466,7 @@ implicitise syn ignore ist tm = -- trace ("INCOMING " ++ showImp True tm) $
1466 imps True (n:env) sc
1466 imps True (n:env) sc
1467 imps top env (PPi (Constraint l _) n _ ty sc)
1467 imps top env (PPi (Constraint l _) n _ ty sc)
1468 = do let isn = nub (implNamesIn uvars ty ++ case sc of
1468 = do let isn = nub (implNamesIn uvars ty ++ case sc of
1469− (PRef _ x) -> namesIn uvars ist sc `dropAll` [n]
1469+ (PRef _ _ x) -> namesIn uvars ist sc `dropAll` [n]
1470 _ -> [])
1470 _ -> [])
1471 (decls, ns) <- get -- ignore decls in HO types
1471 (decls, ns) <- get -- ignore decls in HO types
1472 put (PConstraint 10 l n Placeholder : decls,
1472 put (PConstraint 10 l n Placeholder : decls,
@@ -1474,7 +1474,7 @@ implicitise syn ignore ist tm = -- trace ("INCOMING " ++ showImp True tm) $
1474 imps True (n:env) sc
1474 imps True (n:env) sc
1475 imps top env (PPi (TacImp l _ scr) n _ ty sc)
1475 imps top env (PPi (TacImp l _ scr) n _ ty sc)
1476 = do let isn = nub (implNamesIn uvars ty ++ case sc of
1476 = do let isn = nub (implNamesIn uvars ty ++ case sc of
1477− (PRef _ x) -> namesIn uvars ist sc `dropAll` [n]
1477+ (PRef _ _ x) -> namesIn uvars ist sc `dropAll` [n]
1478 _ -> [])
1478 _ -> [])
1479 (decls, ns) <- get -- ignore decls in HO types
1479 (decls, ns) <- get -- ignore decls in HO types
1480 put (PTacImplicit 10 l n scr Placeholder : decls,
1480 put (PTacImplicit 10 l n scr Placeholder : decls,
@@ -1490,7 +1490,7 @@ implicitise syn ignore ist tm = -- trace ("INCOMING " ++ showImp True tm) $
1490 = do (decls, ns) <- get
1490 = do (decls, ns) <- get
1491 let isn = namesIn uvars ist l ++ namesIn uvars ist r
1491 let isn = namesIn uvars ist l ++ namesIn uvars ist r
1492 put (decls, nub (ns ++ (isn `dropAll` (env ++ map fst (getImps decls)))))
1492 put (decls, nub (ns ++ (isn `dropAll` (env ++ map fst (getImps decls)))))
1493− imps top env (PDPair _ _ (PRef _ n) t r)
1493+ imps top env (PDPair _ _ (PRef _ _ n) t r)
1494 = do (decls, ns) <- get
1494 = do (decls, ns) <- get
1495 let isn = nub (namesIn uvars ist t ++ namesIn uvars ist r) \\ [n]
1495 let isn = nub (namesIn uvars ist t ++ namesIn uvars ist r) \\ [n]
1496 put (decls, nub (ns ++ (isn \\ (env ++ map fst (getImps decls)))))
1496 put (decls, nub (ns ++ (isn \\ (env ++ map fst (getImps decls)))))
@@ -1545,10 +1545,10 @@ addImpl' inpat env infns imp_meths ist ptm
1545 = mkUniqueNames env (ai False (zip env (repeat Nothing)) [] ptm)
1545 = mkUniqueNames env (ai False (zip env (repeat Nothing)) [] ptm)
1547 ai :: Bool -> [(Name, Maybe PTerm)] -> [[T.Text]] -> PTerm -> PTerm
1547 ai :: Bool -> [(Name, Maybe PTerm)] -> [[T.Text]] -> PTerm -> PTerm
1548− ai qq env ds (PRef fc f)
1548+ ai qq env ds (PRef fc fcs f)
1549− | f `elem` infns = PInferRef fc f
1549+ | f `elem` infns = PInferRef fc fcs f
1550 | not (f `elem` map fst env) = handleErr $ aiFn inpat inpat qq imp_meths ist fc f fc ds []
1550 | not (f `elem` map fst env) = handleErr $ aiFn inpat inpat qq imp_meths ist fc f fc ds []
1551− ai qq env ds (PHidden (PRef fc f))
1551+ ai qq env ds (PHidden (PRef fc hl f))
1552 | not (f `elem` map fst env) = PHidden (handleErr $ aiFn inpat False qq imp_meths ist fc f fc ds [])
1552 | not (f `elem` map fst env) = PHidden (handleErr $ aiFn inpat False qq imp_meths ist fc f fc ds [])
1553 ai qq env ds (PRewrite fc l r g)
1553 ai qq env ds (PRewrite fc l r g)
1554 = let l' = ai qq env ds l
1554 = let l' = ai qq env ds l
@@ -1572,11 +1572,11 @@ addImpl' inpat env infns imp_meths ist ptm
1572 = let as' = map (ai qq env ds) as in
1572 = let as' = map (ai qq env ds) as in
1573 PAlternative a as'
1573 PAlternative a as'
1574 ai qq env _ (PDisamb ds' as) = ai qq env ds' as
1574 ai qq env _ (PDisamb ds' as) = ai qq env ds' as
1575− ai qq env ds (PApp fc (PInferRef ffc f) as)
1575+ ai qq env ds (PApp fc (PInferRef ffc hl f) as)
1576 = let as' = map (fmap (ai qq env ds)) as in
1576 = let as' = map (fmap (ai qq env ds)) as in
1577− PApp fc (PInferRef ffc f) as'
1577+ PApp fc (PInferRef ffc hl f) as'
1578− ai qq env ds (PApp fc ftm@(PRef ffc f) as)
1578+ ai qq env ds (PApp fc ftm@(PRef ffc hl f) as)
1579− | f `elem` infns = ai qq env ds (PApp fc (PInferRef ffc f) as)
1579+ | f `elem` infns = ai qq env ds (PApp fc (PInferRef ffc hl f) as)
1580 | not (f `elem` map fst env)
1580 | not (f `elem` map fst env)
1581 = let as' = map (fmap (ai qq env ds)) as in
1581 = let as' = map (fmap (ai qq env ds)) as in
1582 handleErr $ aiFn inpat False qq imp_meths ist fc f ffc ds as'
1582 handleErr $ aiFn inpat False qq imp_meths ist fc f ffc ds as'
@@ -1608,15 +1608,15 @@ addImpl' inpat env infns imp_meths ist ptm
1608 sc' = ai qq ((n, Just ty):env) ds sc in
1608 sc' = ai qq ((n, Just ty):env) ds sc in
1609 PLam fc n nfc ty' sc'
1609 PLam fc n nfc ty' sc'
1610 _ -> ai qq env ds (PLam fc (sMN 0 "lamp") NoFC ty
1610 _ -> ai qq env ds (PLam fc (sMN 0 "lamp") NoFC ty
1611− (PCase fc (PRef fc (sMN 0 "lamp") )
1611+ (PCase fc (PRef fc [] (sMN 0 "lamp") )
1612− [(PRef fc n, sc)]))
1612+ [(PRef fc [] n, sc)]))
1613 ai qq env ds (PLet fc n nfc ty val sc)
1613 ai qq env ds (PLet fc n nfc ty val sc)
1614 = case lookupDef n (tt_ctxt ist) of
1614 = case lookupDef n (tt_ctxt ist) of
1615 [] -> let ty' = ai qq env ds ty
1615 [] -> let ty' = ai qq env ds ty
1616 val' = ai qq env ds val
1616 val' = ai qq env ds val
1617 sc' = ai qq ((n, Just ty):env) ds sc in
1617 sc' = ai qq ((n, Just ty):env) ds sc in
1618 PLet fc n nfc ty' val' sc'
1618 PLet fc n nfc ty' val' sc'
1619− _ -> ai qq env ds (PCase fc val [(PRef fc n, sc)])
1619+ _ -> ai qq env ds (PCase fc val [(PRef fc [] n, sc)])
1620 ai qq env ds (PPi p n nfc ty sc)
1620 ai qq env ds (PPi p n nfc ty sc)
1621 = let ty' = ai qq env ds ty
1621 = let ty' = ai qq env ds ty
1622 env' = if n `elem` imp_meths then env
1622 env' = if n `elem` imp_meths then env
@@ -1674,7 +1674,7 @@ aiFn inpat True qq imp_meths ist fc f ffc ds []
1674 vname _ = False
1674 vname _ = False
1676aiFn inpat expat qq imp_meths ist fc f ffc ds as
1676aiFn inpat expat qq imp_meths ist fc f ffc ds as
1677− | f `elem` primNames = Right $ PApp fc (PRef ffc f) as
1677+ | f `elem` primNames = Right $ PApp fc (PRef ffc [ffc] f) as
1678aiFn inpat expat qq imp_meths ist fc f ffc ds as
1678aiFn inpat expat qq imp_meths ist fc f ffc ds as
1679 -- This is where namespaces get resolved by adding PAlternative
1679 -- This is where namespaces get resolved by adding PAlternative
1680 = do let ns = lookupCtxtName f (idris_implicits ist)
1680 = do let ns = lookupCtxtName f (idris_implicits ist)
@@ -1683,13 +1683,13 @@ aiFn inpat expat qq imp_meths ist fc f ffc ds as
1683 [] -> nh
1683 [] -> nh
1685 case ns' of
1685 case ns' of
1686− [(f',ns)] -> Right $ mkPApp fc (length ns) (PRef ffc (isImpName f f')) (insertImpl ns as)
1686+ [(f',ns)] -> Right $ mkPApp fc (length ns) (PRef ffc [ffc] (isImpName f f')) (insertImpl ns as)
1687 [] -> if f `elem` (map fst (idris_metavars ist))
1687 [] -> if f `elem` (map fst (idris_metavars ist))
1688− then Right $ PApp fc (PRef ffc f) as
1688+ then Right $ PApp fc (PRef ffc [ffc] f) as
1689− else Right $ mkPApp fc (length as) (PRef ffc f) as
1689+ else Right $ mkPApp fc (length as) (PRef ffc [ffc] f) as
1690 alts -> Right $
1690 alts -> Right $
1691 PAlternative (ExactlyOne True) $
1691 PAlternative (ExactlyOne True) $
1692− map (\(f', ns) -> mkPApp fc (length ns) (PRef ffc (isImpName f f'))
1692+ map (\(f', ns) -> mkPApp fc (length ns) (PRef ffc [ffc] (isImpName f f'))
1693 (insertImpl ns as)) alts
1693 (insertImpl ns as)) alts
1695 -- if the name is in imp_meths, we should actually refer to the bound
1695 -- if the name is in imp_meths, we should actually refer to the bound
@@ -1737,7 +1737,7 @@ aiFn inpat expat qq imp_meths ist fc f ffc ds as
1737 case find n imps [] of
1737 case find n imps [] of
1738 Just (tm, imps') ->
1738 Just (tm, imps') ->
1739 PImp p False l n tm : insImpAcc (M.insert n tm pnas) ps given imps'
1739 PImp p False l n tm : insImpAcc (M.insert n tm pnas) ps given imps'
1740− Nothing -> let ph = if f `elem` imp_meths then PRef fc n else Placeholder in
1740+ Nothing -> let ph = if f `elem` imp_meths then PRef fc [] n else Placeholder in
1741 PImp p True l n ph :
1741 PImp p True l n ph :
1742 insImpAcc (M.insert n ph pnas) ps given imps
1742 insImpAcc (M.insert n ph pnas) ps given imps
1743 insImpAcc pnas (PTacImplicit p l n sc' ty : ps) given imps =
1743 insImpAcc pnas (PTacImplicit p l n sc' ty : ps) given imps =
@@ -1780,14 +1780,14 @@ expArg _ = False
1780stripLinear :: IState -> PTerm -> PTerm
1780stripLinear :: IState -> PTerm -> PTerm
1781stripLinear i tm = evalState (sl tm) [] where
1781stripLinear i tm = evalState (sl tm) [] where
1782 sl :: PTerm -> State [Name] PTerm
1782 sl :: PTerm -> State [Name] PTerm
1783− sl (PRef fc f)
1783+ sl (PRef fc hl f)
1784 | (_:_) <- lookupTy f (tt_ctxt i)
1784 | (_:_) <- lookupTy f (tt_ctxt i)
1785− = return $ PRef fc f
1785+ = return $ PRef fc hl f
1786 | otherwise = do ns <- get
1786 | otherwise = do ns <- get
1787 if (f `elem` ns)
1787 if (f `elem` ns)
1788− then return $ PHidden (PRef fc f) -- Placeholder
1788+ then return $ PHidden (PRef fc hl f) -- Placeholder
1789 else do put (f : ns)
1789 else do put (f : ns)
1790− return (PRef fc f)
1790+ return (PRef fc hl f)
1791 sl (PPatvar fc f)
1791 sl (PPatvar fc f)
1792 = do ns <- get
1792 = do ns <- get
1793 if (f `elem` ns)
1793 if (f `elem` ns)
@@ -1810,7 +1810,7 @@ stripLinear i tm = evalState (sl tm) [] where
1810 return (PDPair fc p l' t' r')
1810 return (PDPair fc p l' t' r')
1811 sl (PApp fc fn args) = do fn' <- case fn of
1811 sl (PApp fc fn args) = do fn' <- case fn of
1812 -- Just the args, fn isn't matchable as a var
1812 -- Just the args, fn isn't matchable as a var
1813− PRef _ _ -> return fn
1813+ PRef _ _ _ -> return fn
1814 t -> sl t
1814 t -> sl t
1815 args' <- mapM slA args
1815 args' <- mapM slA args
1816 return $ PApp fc fn' args'
1816 return $ PApp fc fn' args'
@@ -1832,14 +1832,14 @@ stripLinear i tm = evalState (sl tm) [] where
1832stripUnmatchable :: IState -> PTerm -> PTerm
1832stripUnmatchable :: IState -> PTerm -> PTerm
1833stripUnmatchable i (PApp fc fn args) = PApp fc fn (fmap (fmap su) args) where
1833stripUnmatchable i (PApp fc fn args) = PApp fc fn (fmap (fmap su) args) where
1834 su :: PTerm -> PTerm
1834 su :: PTerm -> PTerm
1835− su tm@(PRef fc f)
1835+ su tm@(PRef fc hl f)
1836 | (Bind n (Pi _ t _) sc :_) <- lookupTy f (tt_ctxt i)
1836 | (Bind n (Pi _ t _) sc :_) <- lookupTy f (tt_ctxt i)
1837 = Placeholder
1837 = Placeholder
1838 | (TType _ : _) <- lookupTy f (tt_ctxt i)
1838 | (TType _ : _) <- lookupTy f (tt_ctxt i)
1839 = PHidden tm
1839 = PHidden tm
1840 | (UType _ : _) <- lookupTy f (tt_ctxt i)
1840 | (UType _ : _) <- lookupTy f (tt_ctxt i)
1841 = PHidden tm
1841 = PHidden tm
1842− su (PApp fc f@(PRef _ fn) args)
1842+ su (PApp fc f@(PRef _ _ fn) args)
1843 -- here we use canBeDConName because the impossible pattern
1843 -- here we use canBeDConName because the impossible pattern
1844 -- check will not necessarily fully resolve constructor names,
1844 -- check will not necessarily fully resolve constructor names,
1845 -- and these bare names will otherwise get in the way of
1845 -- and these bare names will otherwise get in the way of
@@ -1930,24 +1930,24 @@ matchClause' names i x y = checkRpts $ match (fullApp x) (fullApp y) where
1930 fullApp x = x
1930 fullApp x = x
1932 match' x y = match (fullApp x) (fullApp y)
1932 match' x y = match (fullApp x) (fullApp y)
1933− match (PApp _ (PRef _ (NS (UN fi) [b])) [_,_,x]) x'
1933+ match (PApp _ (PRef _ _ (NS (UN fi) [b])) [_,_,x]) x'
1934 | fi == txt "fromInteger" && b == txt "builtins",
1934 | fi == txt "fromInteger" && b == txt "builtins",
1935 PConstant _ (I _) <- getTm x = match (getTm x) x'
1935 PConstant _ (I _) <- getTm x = match (getTm x) x'
1936− match x' (PApp _ (PRef _ (NS (UN fi) [b])) [_,_,x])
1936+ match x' (PApp _ (PRef _ _ (NS (UN fi) [b])) [_,_,x])
1937 | fi == txt "fromInteger" && b == txt "builtins",
1937 | fi == txt "fromInteger" && b == txt "builtins",
1938 PConstant _ (I _) <- getTm x = match (getTm x) x'
1938 PConstant _ (I _) <- getTm x = match (getTm x) x'
1939− match (PApp _ (PRef _ (UN l)) [_,x]) x' | l == txt "lazy" = match (getTm x) x'
1939+ match (PApp _ (PRef _ _ (UN l)) [_,x]) x' | l == txt "lazy" = match (getTm x) x'
1940− match x (PApp _ (PRef _ (UN l)) [_,x']) | l == txt "lazy" = match x (getTm x')
1940+ match x (PApp _ (PRef _ _ (UN l)) [_,x']) | l == txt "lazy" = match x (getTm x')
1941 match (PApp _ f args) (PApp _ f' args')
1941 match (PApp _ f args) (PApp _ f' args')
1942 | length args == length args'
1942 | length args == length args'
1943 = do mf <- match' f f'
1943 = do mf <- match' f f'
1944 ms <- zipWithM matchArg args args'
1944 ms <- zipWithM matchArg args args'
1945 return (mf ++ concat ms)
1945 return (mf ++ concat ms)
1946− match (PRef f n) (PApp _ x []) = match (PRef f n) x
1946+ match (PRef f hl n) (PApp _ x []) = match (PRef f hl n) x
1947− match (PPatvar f n) xr = match (PRef f n) xr
1947+ match (PPatvar f n) xr = match (PRef f [f] n) xr
1948− match xr (PPatvar f n) = match xr (PRef f n)
1948+ match xr (PPatvar f n) = match xr (PRef f [f] n)
1949− match (PApp _ x []) (PRef f n) = match x (PRef f n)
1949+ match (PApp _ x []) (PRef f hl n) = match x (PRef f hl n)
1950− match (PRef _ n) tm@(PRef _ n')
1950+ match (PRef _ _ n) tm@(PRef _ _ n')
1951 | n == n' && not names &&
1951 | n == n' && not names &&
1952 (not (isConName n (tt_ctxt i) || isFnName n (tt_ctxt i))
1952 (not (isConName n (tt_ctxt i) || isFnName n (tt_ctxt i))
1953 || tm == Placeholder)
1953 || tm == Placeholder)
@@ -1956,7 +1956,7 @@ matchClause' names i x y = checkRpts $ match (fullApp x) (fullApp y) where
1956 | n == n' || n == dropNS n' || dropNS n == n' = return []
1956 | n == n' || n == dropNS n' || dropNS n == n' = return []
1957 where dropNS (NS n _) = n
1957 where dropNS (NS n _) = n
1958 dropNS n = n
1958 dropNS n = n
1959− match (PRef _ n) tm
1959+ match (PRef _ _ n) tm
1960 | not names && (not (isConName n (tt_ctxt i) ||
1960 | not names && (not (isConName n (tt_ctxt i) ||
1961 isFnName n (tt_ctxt i)) || tm == Placeholder)
1961 isFnName n (tt_ctxt i)) || tm == Placeholder)
1962 = return [(n, tm)]
1962 = return [(n, tm)]
@@ -1986,7 +1986,7 @@ matchClause' names i x y = checkRpts $ match (fullApp x) (fullApp y) where
1986 _ -> LeftErr (a, b)
1986 _ -> LeftErr (a, b)
1987 match (PCase _ _ _) _ = return [] -- lifted out
1987 match (PCase _ _ _) _ = return [] -- lifted out
1988 match (PMetavar _ _) _ = return [] -- modified
1988 match (PMetavar _ _) _ = return [] -- modified
1989− match (PInferRef _ _) _ = return [] -- modified
1989+ match (PInferRef _ _ _) _ = return [] -- modified
1990 match (PQuote _) _ = return []
1990 match (PQuote _) _ = return []
1991 match (PProof _) _ = return []
1991 match (PProof _) _ = return []
1992 match (PTactics _) _ = return []
1992 match (PTactics _) _ = return []
@@ -2044,13 +2044,13 @@ substMatch n = substMatchShadow n []
2045substMatchShadow :: Name -> [Name] -> PTerm -> PTerm -> PTerm
2045substMatchShadow :: Name -> [Name] -> PTerm -> PTerm -> PTerm
2046substMatchShadow n shs tm t = sm shs t where
2046substMatchShadow n shs tm t = sm shs t where
2047− sm xs (PRef _ n') | n == n' = tm
2047+ sm xs (PRef _ _ n') | n == n' = tm
2048 sm xs (PLam fc x xfc t sc) = PLam fc x xfc (sm xs t) (sm xs sc)
2048 sm xs (PLam fc x xfc t sc) = PLam fc x xfc (sm xs t) (sm xs sc)
2049 sm xs (PPi p x fc t sc)
2049 sm xs (PPi p x fc t sc)
2050 | x `elem` xs
2050 | x `elem` xs
2051 = let x' = nextName x in
2051 = let x' = nextName x in
2052− PPi p x' fc (sm (x':xs) (substMatch x (PRef emptyFC x') t))
2052+ PPi p x' fc (sm (x':xs) (substMatch x (PRef emptyFC [] x') t))
2053− (sm (x':xs) (substMatch x (PRef emptyFC x') sc))
2053+ (sm (x':xs) (substMatch x (PRef emptyFC [] x') sc))
2054 | otherwise = PPi p x fc (sm xs t) (sm (x : xs) sc)
2054 | otherwise = PPi p x fc (sm xs t) (sm (x : xs) sc)
2055 sm xs (PApp f x as) = fullApp $ PApp f (sm xs x) (map (fmap (sm xs)) as)
2055 sm xs (PApp f x as) = fullApp $ PApp f (sm xs x) (map (fmap (sm xs)) as)
2056 sm xs (PCase f x as) = PCase f (sm xs x) (map (pmap (sm xs)) as)
2056 sm xs (PCase f x as) = PCase f (sm xs x) (map (pmap (sm xs)) as)
@@ -2072,7 +2072,7 @@ substMatchShadow n shs tm t = sm shs t where
2073shadow :: Name -> Name -> PTerm -> PTerm
2073shadow :: Name -> Name -> PTerm -> PTerm
2074shadow n n' t = sm t where
2074shadow n n' t = sm t where
2075− sm (PRef fc x) | n == x = PRef fc n'
2075+ sm (PRef fc hl x) | n == x = PRef fc hl n'
2076 sm (PLam fc x xfc t sc) | n /= x = PLam fc x xfc (sm t) (sm sc)
2076 sm (PLam fc x xfc t sc) | n /= x = PLam fc x xfc (sm t) (sm sc)
2077 | otherwise = PLam fc x xfc (sm t) sc
2077 | otherwise = PLam fc x xfc (sm t) sc
2078 sm (PPi p x fc t sc) | n /= x = PPi p x fc (sm t) (sm sc)
2078 sm (PPi p x fc t sc) | n /= x = PPi p x fc (sm t) (sm sc)
@@ -2170,7 +2170,7 @@ mkUniqueNames env tm = evalState (mkUniq tm) (S.fromList env) where
2170 mkUniq (PPair fc p l r)
2170 mkUniq (PPair fc p l r)
2171 = do l' <- mkUniq l; r' <- mkUniq r
2171 = do l' <- mkUniq l; r' <- mkUniq r
2172 return $! PPair fc p l' r'
2172 return $! PPair fc p l' r'
2173− mkUniq (PDPair fc p (PRef fc' n) t sc)
2173+ mkUniq (PDPair fc p (PRef fc' hl n) t sc)
2174 | t /= Placeholder
2174 | t /= Placeholder
2175 = do env <- get
2175 = do env <- get
2176 (n', sc') <- if n `S.member` env
2176 (n', sc') <- if n `S.member` env
@@ -2180,7 +2180,7 @@ mkUniqueNames env tm = evalState (mkUniq tm) (S.fromList env) where
2180 put (S.insert n' env)
2180 put (S.insert n' env)
2181 t' <- mkUniq t
2181 t' <- mkUniq t
2182 sc'' <- mkUniq sc'
2182 sc'' <- mkUniq sc'
2183− return $! PDPair fc p (PRef fc' n') t' sc''
2183+ return $! PDPair fc p (PRef fc' hl n') t' sc''
2184 mkUniq (PDPair fc p l t r)
2184 mkUniq (PDPair fc p l t r)
2185 = do l' <- mkUniq l; t' <- mkUniq t; r' <- mkUniq r
2185 = do l' <- mkUniq l; t' <- mkUniq t; r' <- mkUniq r
2186 return $! PDPair fc p l' t' r'
2186 return $! PDPair fc p l' t' r'