on master help sign in
Merge remote-tracking branch 'refs/remotes/upstream/master' into ahmadsalim-testing/cstaticanalysis
5ed857bDavid Raymond Christiansen
CHANGELOG+2
@@ -40,6 +40,8 @@ New in 0.9.17:
40* Classes can now be annotated with 'determining parameters' to say which
40* Classes can now be annotated with 'determining parameters' to say which
41 must be available before resolving instances. Only determining parameters
41 must be available before resolving instances. Only determining parameters
42 are checked when checking for overlapping instances.
42 are checked when checking for overlapping instances.
43+* Arguments to class instances are now checked for injectivity.
44+ Unification assumes this, so we need to check when instances are defined.
43
45
44New in 0.9.16:
46New in 0.9.16:
45--------------
47--------------
idris.cabal+3
@@ -289,6 +289,9 @@ Extra-source-files:
289 test/reg058/run
289 test/reg058/run
290 test/reg058/*.idr
290 test/reg058/*.idr
291 test/reg058/expected
291 test/reg058/expected
292+ test/reg059/run
293+ test/reg059/*.idr
294+ test/reg059/expected
292
295
293 test/basic001/run
296 test/basic001/run
294 test/basic001/*.idr
297 test/basic001/*.idr
libs/base/Language/Reflection/Utils.idr+1
@@ -270,6 +270,7 @@ instance Show Err where
270 show (NoTypeDecl n) = "NoTypeDecl " ++ show n
270 show (NoTypeDecl n) = "NoTypeDecl " ++ show n
271 show (NotInjective tm tm' x) = "NotInjective " ++ show tm ++ " " ++ show tm'
271 show (NotInjective tm tm' x) = "NotInjective " ++ show tm ++ " " ++ show tm'
272 show (CantResolve tm) = "CantResolve " ++ show tm
272 show (CantResolve tm) = "CantResolve " ++ show tm
273+ show (InvalidTCArg n tm) = "InvalidTCName " ++ show n ++ " (" ++ show tm ++ ")"
273 show (CantResolveAlts xs) = "CantResolveAlts " ++ show xs
274 show (CantResolveAlts xs) = "CantResolveAlts " ++ show xs
274 show (IncompleteTerm tm) = "IncompleteTerm " ++ show tm
275 show (IncompleteTerm tm) = "IncompleteTerm " ++ show tm
275 show (NoEliminator s tm) = "NoEliminator " ++ show s ++ " " ++ show tm
276 show (NoEliminator s tm) = "NoEliminator " ++ show s ++ " " ++ show tm
libs/prelude/Language/Reflection/Errors.idr+1
@@ -29,6 +29,7 @@ data Err = Msg String
29 | NoTypeDecl TTName
29 | NoTypeDecl TTName
30 | NotInjective TT TT TT
30 | NotInjective TT TT TT
31 | CantResolve TT
31 | CantResolve TT
32+ | InvalidTCArg TTName TT
32 | CantResolveAlts (List TTName)
33 | CantResolveAlts (List TTName)
33 | IncompleteTerm TT
34 | IncompleteTerm TT
34 | NoEliminator String TT
35 | NoEliminator String TT
libs/prelude/Prelude/Applicative.idr−4
@@ -15,10 +15,6 @@ class Functor f => Applicative (f : Type -> Type) where
15 pure : a -> f a
15 pure : a -> f a
16 (<*>) : f (a -> b) -> f a -> f b
16 (<*>) : f (a -> b) -> f a -> f b
17
17
18−instance Applicative id where
19− pure a = a
20− f <*> a = f a
21−
22class (Applicative f, VerifiedFunctor f) => VerifiedApplicative (f : Type -> Type) where
18class (Applicative f, VerifiedFunctor f) => VerifiedApplicative (f : Type -> Type) where
23 applicativeMap : (x : f a) -> (g : a -> b) ->
19 applicativeMap : (x : f a) -> (g : a -> b) ->
24 map g x = pure g <*> x
20 map g x = pure g <*> x
libs/prelude/Prelude/Functor.idr−2
@@ -24,5 +24,3 @@ class Functor f => VerifiedFunctor (f : Type -> Type) where
24 (g1 : a -> b) -> (g2 : b -> c) ->
24 (g1 : a -> b) -> (g2 : b -> c) ->
25 map (g2 . g1) x = (map g2 . map g1) x
25 map (g2 . g1) x = (map g2 . map g1) x
26
26
27−instance Functor id where
28− map f a = f a
libs/prelude/Prelude/Monad.idr−3
@@ -24,9 +24,6 @@ class (Monad m, VerifiedApplicative m) => VerifiedMonad (m : Type -> Type) where
24 monadAssociativity : (mx : m a) -> (f : a -> m b) -> (g : b -> m c) ->
24 monadAssociativity : (mx : m a) -> (f : a -> m b) -> (g : b -> m c) ->
25 (mx >>= f) >>= g = mx >>= (\x => f x >>= g)
25 (mx >>= f) >>= g = mx >>= (\x => f x >>= g)
26
26
27−instance Monad id where
28− a >>= f = f a
29−
30||| Also called `join` or mu
27||| Also called `join` or mu
31flatten : Monad m => m (m a) -> m a
28flatten : Monad m => m (m a) -> m a
32flatten a = a >>= id
29flatten a = a >>= id
rts/idris_gc.c+3−14
@@ -112,19 +112,8 @@ void idris_gc(VM* vm) {
112 if (vm->heap.old != NULL)
112 if (vm->heap.old != NULL)
113 free(vm->heap.old);
113 free(vm->heap.old);
114
114
115− char* newheap = malloc(vm->heap.size);
115+ /* Allocate swap heap. */
116− char* oldheap = vm->heap.heap;
116+ alloc_heap(&vm->heap, vm->heap.size, vm->heap.growth, vm->heap.heap);
117−
118− vm->heap.heap = newheap;
119−#ifdef FORCE_ALIGNMENT
120− if (((i_int)(vm->heap.heap)&1) == 1) {
121− vm->heap.next = newheap + 1;
122− } else
123−#endif
124− {
125− vm->heap.next = newheap;
126− }
127− vm->heap.end = newheap + vm->heap.size;
128
117
129 VAL* root;
118 VAL* root;
130
119
@@ -139,6 +128,7 @@ void idris_gc(VM* vm) {
139 msg->msg = copy(vm, msg->msg);
128 msg->msg = copy(vm, msg->msg);
140 }
129 }
141#endif
130#endif
131+
142 vm->ret = copy(vm, vm->ret);
132 vm->ret = copy(vm, vm->ret);
143 vm->reg1 = copy(vm, vm->reg1);
133 vm->reg1 = copy(vm, vm->reg1);
144
134
@@ -150,7 +140,6 @@ void idris_gc(VM* vm) {
150 if ((vm->heap.next - vm->heap.heap) > vm->heap.size >> 1) {
140 if ((vm->heap.next - vm->heap.heap) > vm->heap.size >> 1) {
151 vm->heap.size += vm->heap.growth;
141 vm->heap.size += vm->heap.growth;
152 }
142 }
153− vm->heap.old = oldheap;
154
143
155 STATS_LEAVE_GC(vm->stats, vm->heap.size, vm->heap.next - vm->heap.heap)
144 STATS_LEAVE_GC(vm->stats, vm->heap.size, vm->heap.next - vm->heap.heap)
156 HEAP_CHECK(vm)
145 HEAP_CHECK(vm)
rts/idris_heap.c+6−3
@@ -5,7 +5,9 @@
5#include <stddef.h>
5#include <stddef.h>
6#include <stdio.h>
6#include <stdio.h>
7
7
8+
9+/* Used for initializing the heap. */
8−void alloc_heap(Heap * h, size_t heap_size)
10+void alloc_heap(Heap * h, size_t heap_size, size_t growth, char * old)
9{
11{
10 char * mem = malloc(heap_size);
12 char * mem = malloc(heap_size);
11 if (mem == NULL) {
13 if (mem == NULL) {
@@ -27,9 +29,9 @@ void alloc_heap(Heap * h, size_t heap_size)
27 h->end = h->heap + heap_size;
29 h->end = h->heap + heap_size;
28
30
29 h->size = heap_size;
31 h->size = heap_size;
30− h->growth = heap_size;
32+ h->growth = growth;
31
33
32− h->old = NULL;
34+ h->old = old;
33}
35}
34
36
35void free_heap(Heap * h) {
37void free_heap(Heap * h) {
@@ -40,6 +42,7 @@ void free_heap(Heap * h) {
40 }
42 }
41}
43}
42
44
45+
43// TODO: more testing
46// TODO: more testing
44/******************** Heap testing ********************************************/
47/******************** Heap testing ********************************************/
45void heap_check_underflow(Heap * heap) {
48void heap_check_underflow(Heap * heap) {
rts/idris_heap.h+1−1
@@ -14,7 +14,7 @@ typedef struct {
14} Heap;
14} Heap;
15
15
16
16
17−void alloc_heap(Heap * heap, size_t heap_size);
17+void alloc_heap(Heap * heap, size_t heap_size, size_t growth, char * old);
18void free_heap(Heap * heap);
18void free_heap(Heap * heap);
19
19
20
20
rts/idris_rts.c+1−1
@@ -29,7 +29,7 @@ VM* init_vm(int stack_size, size_t heap_size,
29 vm->valstack_base = valstack;
29 vm->valstack_base = valstack;
30 vm->stack_max = valstack + stack_size;
30 vm->stack_max = valstack + stack_size;
31
31
32− alloc_heap(&(vm->heap), heap_size);
32+ alloc_heap(&(vm->heap), heap_size, heap_size, NULL);
33
33
34 vm->ret = NULL;
34 vm->ret = NULL;
35 vm->reg1 = NULL;
35 vm->reg1 = NULL;
src/Idris/AbsSyntax.hs+28−18
@@ -1481,31 +1481,34 @@ implicitise syn ignore ist tm = -- trace ("INCOMING " ++ showImp True tm) $
1481
1481
1482-- Add implicit arguments in function calls
1482-- Add implicit arguments in function calls
1483addImplPat :: IState -> PTerm -> PTerm
1483addImplPat :: IState -> PTerm -> PTerm
1484−addImplPat = addImpl' True [] []
1484+addImplPat = addImpl' True [] [] []
1485
1485
1486addImplBound :: IState -> [Name] -> PTerm -> PTerm
1486addImplBound :: IState -> [Name] -> PTerm -> PTerm
1487−addImplBound ist ns = addImpl' False ns [] ist
1487+addImplBound ist ns = addImpl' False ns [] [] ist
1488
1488
1489addImplBoundInf :: IState -> [Name] -> [Name] -> PTerm -> PTerm
1489addImplBoundInf :: IState -> [Name] -> [Name] -> PTerm -> PTerm
1490−addImplBoundInf ist ns inf = addImpl' False ns inf ist
1490+addImplBoundInf ist ns inf = addImpl' False ns inf [] ist
1491
1491
1492-- | Add the implicit arguments to applications in the term
1492-- | Add the implicit arguments to applications in the term
1493+-- [Name] gives the names to always expend, even when under a binder of
1494+-- that name (this is to expand methods with implicit arguments in dependent
1495+-- type classes).
1493−addImpl :: IState -> PTerm -> PTerm
1496+addImpl :: [Name] -> IState -> PTerm -> PTerm
1494addImpl = addImpl' False [] []
1497addImpl = addImpl' False [] []
1495
1498
1496-- TODO: in patterns, don't add implicits to function names guarded by constructors
1499-- TODO: in patterns, don't add implicits to function names guarded by constructors
1497-- and *not* inside a PHidden
1500-- and *not* inside a PHidden
1498
1501
1499−addImpl' :: Bool -> [Name] -> [Name] -> IState -> PTerm -> PTerm
1502+addImpl' :: Bool -> [Name] -> [Name] -> [Name] -> IState -> PTerm -> PTerm
1500−addImpl' inpat env infns ist ptm
1503+addImpl' inpat env infns imp_meths ist ptm
1501 = mkUniqueNames env (ai False (zip env (repeat Nothing)) [] ptm)
1504 = mkUniqueNames env (ai False (zip env (repeat Nothing)) [] ptm)
1502 where
1505 where
1503 ai :: Bool -> [(Name, Maybe PTerm)] -> [[T.Text]] -> PTerm -> PTerm
1506 ai :: Bool -> [(Name, Maybe PTerm)] -> [[T.Text]] -> PTerm -> PTerm
1504 ai qq env ds (PRef fc f)
1507 ai qq env ds (PRef fc f)
1505 | f `elem` infns = PInferRef fc f
1508 | f `elem` infns = PInferRef fc f
1506− | not (f `elem` map fst env) = handleErr $ aiFn inpat inpat qq ist fc f ds []
1509+ | not (f `elem` map fst env) = handleErr $ aiFn inpat inpat qq imp_meths ist fc f ds []
1507 ai qq env ds (PHidden (PRef fc f))
1510 ai qq env ds (PHidden (PRef fc f))
1508− | not (f `elem` map fst env) = PHidden (handleErr $ aiFn inpat False qq ist fc f ds [])
1511+ | not (f `elem` map fst env) = PHidden (handleErr $ aiFn inpat False qq imp_meths ist fc f ds [])
1509 ai qq env ds (PEq fc lt rt l r)
1512 ai qq env ds (PEq fc lt rt l r)
1510 = let lt' = ai qq env ds lt
1513 = let lt' = ai qq env ds lt
1511 rt' = ai qq env ds rt
1514 rt' = ai qq env ds rt
@@ -1541,7 +1544,7 @@ addImpl' inpat env infns ist ptm
1541 | f `elem` infns = ai qq env ds (PApp fc (PInferRef fc f) as)
1544 | f `elem` infns = ai qq env ds (PApp fc (PInferRef fc f) as)
1542 | not (f `elem` map fst env)
1545 | not (f `elem` map fst env)
1543 = let as' = map (fmap (ai qq env ds)) as in
1546 = let as' = map (fmap (ai qq env ds)) as in
1544− handleErr $ aiFn inpat False qq ist fc f ds as'
1547+ handleErr $ aiFn inpat False qq imp_meths ist fc f ds as'
1545 | Just (Just ty) <- lookup f env =
1548 | Just (Just ty) <- lookup f env =
1546 let as' = map (fmap (ai qq env ds)) as
1549 let as' = map (fmap (ai qq env ds)) as
1547 arity = getPArity ty in
1550 arity = getPArity ty in
@@ -1576,7 +1579,9 @@ addImpl' inpat env infns ist ptm
1576 _ -> ai qq env ds (PCase fc val [(PRef fc n, sc)])
1579 _ -> ai qq env ds (PCase fc val [(PRef fc n, sc)])
1577 ai qq env ds (PPi p n ty sc)
1580 ai qq env ds (PPi p n ty sc)
1578 = let ty' = ai qq env ds ty
1581 = let ty' = ai qq env ds ty
1582+ env' = if n `elem` imp_meths then env
1579− sc' = ai qq ((n, Just ty):env) ds sc in
1583+ else ((n, Just ty) : env)
1584+ sc' = ai qq env' ds sc in
1580 PPi p n ty' sc'
1585 PPi p n ty' sc'
1581 ai qq env ds (PGoal fc r n sc)
1586 ai qq env ds (PGoal fc r n sc)
1582 = let r' = ai qq env ds r
1587 = let r' = ai qq env ds r
@@ -1600,8 +1605,8 @@ addImpl' inpat env infns ist ptm
1600-- if in a pattern, and there are no arguments, and there's no possible
1605-- if in a pattern, and there are no arguments, and there's no possible
1601-- names with zero explicit arguments, don't add implicits.
1606-- names with zero explicit arguments, don't add implicits.
1602
1607
1603−aiFn :: Bool -> Bool -> Bool -> IState -> FC -> Name -> [[T.Text]] -> [PArg] -> Either Err PTerm
1608+aiFn :: Bool -> Bool -> Bool -> [Name] -> IState -> FC -> Name -> [[T.Text]] -> [PArg] -> Either Err PTerm
1604−aiFn inpat True qq ist fc f ds []
1609+aiFn inpat True qq imp_meths ist fc f ds []
1605 = case lookupDef f (tt_ctxt ist) of
1610 = case lookupDef f (tt_ctxt ist) of
1606 [] -> Right $ PPatvar fc f
1611 [] -> Right $ PPatvar fc f
1607 alts -> let ialts = lookupCtxtName f (idris_implicits ist) in
1612 alts -> let ialts = lookupCtxtName f (idris_implicits ist) in
@@ -1609,7 +1614,7 @@ aiFn inpat True qq ist fc f ds []
1609 if (not (vname f) || tcname f
1614 if (not (vname f) || tcname f
1610 || any (conCaf (tt_ctxt ist)) ialts)
1615 || any (conCaf (tt_ctxt ist)) ialts)
1611-- any constructor alts || any allImp ialts))
1616-- any constructor alts || any allImp ialts))
1612− then aiFn inpat False qq ist fc f ds [] -- use it as a constructor
1617+ then aiFn inpat False qq imp_meths ist fc f ds [] -- use it as a constructor
1613 else Right $ PPatvar fc f
1618 else Right $ PPatvar fc f
1614 where imp (PExp _ _ _ _) = False
1619 where imp (PExp _ _ _ _) = False
1615 imp _ = True
1620 imp _ = True
@@ -1623,9 +1628,9 @@ aiFn inpat True qq ist fc f ds []
1623 vname (UN n) = True -- non qualified
1628 vname (UN n) = True -- non qualified
1624 vname _ = False
1629 vname _ = False
1625
1630
1626−aiFn inpat expat qq ist fc f ds as
1631+aiFn inpat expat qq imp_meths ist fc f ds as
1627 | f `elem` primNames = Right $ PApp fc (PRef fc f) as
1632 | f `elem` primNames = Right $ PApp fc (PRef fc f) as
1628−aiFn inpat expat qq ist fc f ds as
1633+aiFn inpat expat qq imp_meths ist fc f ds as
1629 -- This is where namespaces get resolved by adding PAlternative
1634 -- This is where namespaces get resolved by adding PAlternative
1630 = do let ns = lookupCtxtName f (idris_implicits ist)
1635 = do let ns = lookupCtxtName f (idris_implicits ist)
1631 let nh = filter (\(n, _) -> notHidden n) ns
1636 let nh = filter (\(n, _) -> notHidden n) ns
@@ -1633,15 +1638,20 @@ aiFn inpat expat qq ist fc f ds as
1633 [] -> nh
1638 [] -> nh
1634 x -> x
1639 x -> x
1635 case ns' of
1640 case ns' of
1636− [(f',ns)] -> Right $ mkPApp fc (length ns) (PRef fc f') (insertImpl ns as)
1641+ [(f',ns)] -> Right $ mkPApp fc (length ns) (PRef fc (isImpName f f')) (insertImpl ns as)
1637 [] -> if f `elem` (map fst (idris_metavars ist))
1642 [] -> if f `elem` (map fst (idris_metavars ist))
1638 then Right $ PApp fc (PRef fc f) as
1643 then Right $ PApp fc (PRef fc f) as
1639 else Right $ mkPApp fc (length as) (PRef fc f) as
1644 else Right $ mkPApp fc (length as) (PRef fc f) as
1640 alts -> Right $
1645 alts -> Right $
1641 PAlternative True $
1646 PAlternative True $
1642− map (\(f', ns) -> mkPApp fc (length ns) (PRef fc f')
1647+ map (\(f', ns) -> mkPApp fc (length ns) (PRef fc (isImpName f f'))
1643 (insertImpl ns as)) alts
1648 (insertImpl ns as)) alts
1644 where
1649 where
1650+ -- if the name is in imp_meths, we should actually refer to the bound
1651+ -- name rather than the global one after expanding implicits
1652+ isImpName f f' | f `elem` imp_meths = f
1653+ | otherwise = f'
1654+
1645 trimAlts [] alts = alts
1655 trimAlts [] alts = alts
1646 trimAlts ns alts
1656 trimAlts ns alts
1647 = filter (\(x, _) -> any (\d -> d `isPrefixOf` nspace x) ns) alts
1657 = filter (\(x, _) -> any (\d -> d `isPrefixOf` nspace x) ns) alts
@@ -1685,7 +1695,7 @@ aiFn inpat expat qq ist fc f ds as
1685 PImp p True l n Placeholder :
1695 PImp p True l n Placeholder :
1686 insImpAcc (M.insert n Placeholder pnas) ps given imps
1696 insImpAcc (M.insert n Placeholder pnas) ps given imps
1687 insImpAcc pnas (PTacImplicit p l n sc' ty : ps) given imps =
1697 insImpAcc pnas (PTacImplicit p l n sc' ty : ps) given imps =
1688− let sc = addImpl ist (substMatches (M.toList pnas) sc') in
1698+ let sc = addImpl imp_meths ist (substMatches (M.toList pnas) sc') in
1689 case find n imps [] of
1699 case find n imps [] of
1690 Just (tm, imps') ->
1700 Just (tm, imps') ->
1691 PTacImplicit p l n sc tm :
1701 PTacImplicit p l n sc tm :
src/Idris/AbsSyntaxTree.hs+4−1
@@ -1198,6 +1198,9 @@ data SyntaxInfo = Syn { using :: [Using],
1198 syn_params :: [(Name, PTerm)],
1198 syn_params :: [(Name, PTerm)],
1199 syn_namespace :: [String],
1199 syn_namespace :: [String],
1200 no_imp :: [Name],
1200 no_imp :: [Name],
1201+ imp_methods :: [Name], -- class methods. When expanding
1202+ -- implicits, these should be expanded even under
1203+ -- binders
1201 decoration :: Name -> Name,
1204 decoration :: Name -> Name,
1202 inPattern :: Bool,
1205 inPattern :: Bool,
1203 implicitAllowed :: Bool,
1206 implicitAllowed :: Bool,
@@ -1211,7 +1214,7 @@ deriving instance NFData SyntaxInfo
1211deriving instance Binary SyntaxInfo
1214deriving instance Binary SyntaxInfo
1212!-}
1215!-}
1213
1216
1214−defaultSyntax = Syn [] [] [] [] id False False Nothing 0 initDSL 0
1217+defaultSyntax = Syn [] [] [] [] [] id False False Nothing 0 initDSL 0
1215
1218
1216expandNS :: SyntaxInfo -> Name -> Name
1219expandNS :: SyntaxInfo -> Name -> Name
1217expandNS syn n@(NS _ _) = n
1220expandNS syn n@(NS _ _) = n
src/Idris/Core/Binary.hs+6
@@ -149,6 +149,9 @@ instance Binary a => Binary (Err' a) where
149 put (NoEliminator s t) = do putWord8 37
149 put (NoEliminator s t) = do putWord8 37
150 put s
150 put s
151 put t
151 put t
152+ put (InvalidTCArg n t) = do putWord8 38
153+ put n
154+ put t
152
155
153 get = do i <- getWord8
156 get = do i <- getWord8
154 case i of
157 case i of
@@ -211,6 +214,9 @@ instance Binary a => Binary (Err' a) where
211 37 -> do x1 <- get
214 37 -> do x1 <- get
212 x2 <- get
215 x2 <- get
213 return (NoEliminator x1 x2)
216 return (NoEliminator x1 x2)
217+ 38 -> do x1 <- get
218+ x2 <- get
219+ return (InvalidTCArg x1 x2)
214 _ -> error "Corrupted binary data for Err'"
220 _ -> error "Corrupted binary data for Err'"
215----- Generated by 'derive'
221----- Generated by 'derive'
216
222
src/Idris/Core/DeepSeq.hs+1
@@ -81,6 +81,7 @@ instance NFData Err where
81 rnf (NotInjective x1 x2 x3)
81 rnf (NotInjective x1 x2 x3)
82 = rnf x1 `seq` rnf x2 `seq` rnf x3 `seq` ()
82 = rnf x1 `seq` rnf x2 `seq` rnf x3 `seq` ()
83 rnf (CantResolve x1 x2) = rnf x1 `seq` rnf x2 `seq` ()
83 rnf (CantResolve x1 x2) = rnf x1 `seq` rnf x2 `seq` ()
84+ rnf (InvalidTCArg x1 x2) = rnf x1 `seq` rnf x2 `seq` ()
84 rnf (CantResolveAlts x1) = rnf x1 `seq` ()
85 rnf (CantResolveAlts x1) = rnf x1 `seq` ()
85 rnf (IncompleteTerm x1) = rnf x1 `seq` ()
86 rnf (IncompleteTerm x1) = rnf x1 `seq` ()
86 rnf (NoEliminator x1 x2) = rnf x1 `seq` rnf x2 `seq` ()
87 rnf (NoEliminator x1 x2) = rnf x1 `seq` rnf x2 `seq` ()
src/Idris/Core/TT.hs+27−10
@@ -157,6 +157,7 @@ data Err' t
157 | NotInjective t t t
157 | NotInjective t t t
158 | CantResolve Bool -- True if postponed, False if fatal
158 | CantResolve Bool -- True if postponed, False if fatal
159 t
159 t
160+ | InvalidTCArg Name t
160 | CantResolveAlts [Name]
161 | CantResolveAlts [Name]
161 | IncompleteTerm t
162 | IncompleteTerm t
162 | NoEliminator String t
163 | NoEliminator String t
@@ -1170,17 +1171,33 @@ unList tm = case unApply tm of
1170forget :: TT Name -> Raw
1171forget :: TT Name -> Raw
1171forget tm = forgetEnv [] tm
1172forget tm = forgetEnv [] tm
1172
1173
1174+safeForget :: TT Name -> Maybe Raw
1175+safeForget tm = safeForgetEnv [] tm
1176+
1173forgetEnv :: [Name] -> TT Name -> Raw
1177forgetEnv :: [Name] -> TT Name -> Raw
1174−forgetEnv env (P _ n _) = Var n
1178+forgetEnv env tm = case safeForgetEnv env tm of
1179+ Just t' -> t'
1180+ Nothing -> error $ "Scope error in " ++ show tm
1181+
1182+
1183+safeForgetEnv :: [Name] -> TT Name -> Maybe Raw
1184+safeForgetEnv env (P _ n _) = Just $ Var n
1175−forgetEnv env (V i) = Var (env !! i)
1185+safeForgetEnv env (V i) | i < length env = Just $ Var (env !! i)
1186+ | otherwise = Nothing
1187+safeForgetEnv env (Bind n b sc)
1176−forgetEnv env (Bind n b sc) = let n' = uniqueName n env in
1188+ = do let n' = uniqueName n env
1177− RBind n' (fmap (forgetEnv env) b)
1189+ b' <- safeForgetEnvB env b
1178− (forgetEnv (n':env) sc)
1190+ sc' <- safeForgetEnv (n':env) sc
1179−forgetEnv env (App f a) = RApp (forgetEnv env f) (forgetEnv env a)
1191+ Just $ RBind n' b' sc'
1192+ where safeForgetEnvB env (Let t v) = liftM2 Let (safeForgetEnv env t)
1193+ (safeForgetEnv env v)
1194+ safeForgetEnvB env b = do ty' <- safeForgetEnv env (binderTy b)
1195+ Just $ fmap (\_ -> ty') b
1196+safeForgetEnv env (App f a) = liftM2 RApp (safeForgetEnv env f) (safeForgetEnv env a)
1180−forgetEnv env (Constant c) = RConstant c
1197+safeForgetEnv env (Constant c) = Just $ RConstant c
1181−forgetEnv env (TType i) = RType
1198+safeForgetEnv env (TType i) = Just RType
1182−forgetEnv env (UType u) = RUType u
1199+safeForgetEnv env (UType u) = Just $ RUType u
1183−forgetEnv env Erased = RConstant Forgot
1200+safeForgetEnv env Erased = Just $ RConstant Forgot
1184
1201
1185-- | Introduce a 'Bind' into the given term for each element of the
1202-- | Introduce a 'Bind' into the given term for each element of the
1186-- given list of (name, binder) pairs.
1203-- given list of (name, binder) pairs.
src/Idris/Coverage.hs+1−1
@@ -24,7 +24,7 @@ import Control.Monad.State.Strict
24-- provided explicitly from new clause generation.
24-- provided explicitly from new clause generation.
25mkPatTm :: PTerm -> Idris Term
25mkPatTm :: PTerm -> Idris Term
26mkPatTm t = do i <- getIState
26mkPatTm t = do i <- getIState
27− let timp = addImpl' True [] [] i t
27+ let timp = addImpl' True [] [] [] i t
28 evalStateT (toTT (mapPT deNS timp)) 0
28 evalStateT (toTT (mapPT deNS timp)) 0
29 where
29 where
30 toTT (PRef _ n) = do i <- lift getIState
30 toTT (PRef _ n) = do i <- lift getIState
src/Idris/DeepSeq.hs+2−2
@@ -353,10 +353,10 @@ instance NFData Using where
353 rnf (UConstraint x1 x2) = rnf x1 `seq` rnf x2 `seq` ()
353 rnf (UConstraint x1 x2) = rnf x1 `seq` rnf x2 `seq` ()
354
354
355instance NFData SyntaxInfo where
355instance NFData SyntaxInfo where
356− rnf (Syn x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11)
356+ rnf (Syn x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12)
357 = rnf x1 `seq`
357 = rnf x1 `seq`
358 rnf x2 `seq`
358 rnf x2 `seq`
359 rnf x3 `seq`
359 rnf x3 `seq`
360 rnf x4 `seq`
360 rnf x4 `seq`
361 rnf x5 `seq`
361 rnf x5 `seq`
362− rnf x6 `seq` rnf x7 `seq` rnf x8 `seq` rnf x9 `seq` rnf x10 `seq` rnf x11 `seq` ()
362+ rnf x6 `seq` rnf x7 `seq` rnf x8 `seq` rnf x9 `seq` rnf x10 `seq` rnf x11 `seq` rnf x12 `seq` ()
src/Idris/Delaborate.hs+4
@@ -290,6 +290,10 @@ pprintErr' i (NotInjective p x y) =
290 text " when unifying" <+> annTm x (pprintTerm i (delab i x)) <+> text "and" <+>
290 text " when unifying" <+> annTm x (pprintTerm i (delab i x)) <+> text "and" <+>
291 annTm y (pprintTerm i (delab i y))
291 annTm y (pprintTerm i (delab i y))
292pprintErr' i (CantResolve _ c) = text "Can't resolve type class" <+> pprintTerm i (delab i c)
292pprintErr' i (CantResolve _ c) = text "Can't resolve type class" <+> pprintTerm i (delab i c)
293+pprintErr' i (InvalidTCArg n t)
294+ = annTm t (pprintTerm i (delab i t)) <+> text " cannot be a parameter of "
295+ <> annName n <$>
296+ text "(Type class arguments must be injective)"
293pprintErr' i (CantResolveAlts as) = text "Can't disambiguate name:" <+>
297pprintErr' i (CantResolveAlts as) = text "Can't disambiguate name:" <+>
294 align (cat (punctuate (comma <> space) (map (fmap (fancifyAnnots i) . annName) as)))
298 align (cat (punctuate (comma <> space) (map (fmap (fancifyAnnots i) . annName) as)))
295pprintErr' i (NoTypeDecl n) = text "No type declaration for" <+> annName n
299pprintErr' i (NoTypeDecl n) = text "No type declaration for" <+> annName n
src/Idris/Elab/Class.hs+11−11
@@ -77,28 +77,28 @@ elabClass info syn_in doc fc constraints tn ps pDocs fds ds
77 = unzip (map (\ ( x,y,z) -> (x, y)) ims)
77 = unzip (map (\ ( x,y,z) -> (x, y)) ims)
78 let defaults = map (\ (x, (y, z)) -> (x,y)) defs
78 let defaults = map (\ (x, (y, z)) -> (x,y)) defs
79 -- build instance constructor type
79 -- build instance constructor type
80− -- decorate names of functions to ensure they can't be referred
81− -- to elsewhere in the class declaration
82 let cty = impbind ps $ conbind constraints
80 let cty = impbind ps $ conbind constraints
83 $ pibind (map (\ (n, ty) -> (nsroot n, ty)) methods)
81 $ pibind (map (\ (n, ty) -> (nsroot n, ty)) methods)
84 constraint
82 constraint
85 let cons = [(emptyDocstring, [], cn, cty, fc, [])]
83 let cons = [(emptyDocstring, [], cn, cty, fc, [])]
86 let ddecl = PDatadecl tn tty cons
84 let ddecl = PDatadecl tn tty cons
87 logLvl 5 $ "Class data " ++ show (showDImp verbosePPOption ddecl)
85 logLvl 5 $ "Class data " ++ show (showDImp verbosePPOption ddecl)
86+ -- Elaborate the data declaration
88− elabData info (syn { no_imp = no_imp syn ++ mnames }) doc pDocs fc [] ddecl
87+ elabData info (syn { no_imp = no_imp syn ++ mnames,
89−
88+ imp_methods = mnames }) doc pDocs fc [] ddecl
90 dets <- findDets cn fds
89 dets <- findDets cn fds
91 addClass tn (CI cn (map nodoc imethods) defaults idecls (map fst ps) [] dets)
90 addClass tn (CI cn (map nodoc imethods) defaults idecls (map fst ps) [] dets)
91+
92 -- for each constraint, build a top level function to chase it
92 -- for each constraint, build a top level function to chase it
93− logLvl 5 $ "Building functions"
94−-- let usyn = syn { using = map (\ (x,y) -> UImplicit x y) ps
95−-- ++ using syn }
96− fns <- mapM (cfun cn constraint syn (map fst imethods)) constraints
93+ cfns <- mapM (cfun cn constraint syn (map fst imethods)) constraints
97− mapM_ (rec_elabDecl info EAll info) (concat fns)
94+ mapM_ (rec_elabDecl info EAll info) (concat cfns)
95+
98 -- for each method, build a top level function
96 -- for each method, build a top level function
99 fns <- mapM (tfun cn constraint syn (map fst imethods)) imethods
97 fns <- mapM (tfun cn constraint syn (map fst imethods)) imethods
100 logLvl 5 $ "Functions " ++ show fns
98 logLvl 5 $ "Functions " ++ show fns
99+ -- Elaborate the the top level methods
101 mapM_ (rec_elabDecl info EAll info) (concat fns)
100 mapM_ (rec_elabDecl info EAll info) (concat fns)
101+
102 -- add the default definitions
102 -- add the default definitions
103 mapM_ (rec_elabDecl info EAll info) (concat (map (snd.snd) defs))
103 mapM_ (rec_elabDecl info EAll info) (concat (map (snd.snd) defs))
104 addIBC (IBCClass tn)
104 addIBC (IBCClass tn)
@@ -134,8 +134,8 @@ elabClass info syn_in doc fc constraints tn ps pDocs fds ds
134
134
135 getMName (PTy _ _ _ _ _ n _) = nsroot n
135 getMName (PTy _ _ _ _ _ n _) = nsroot n
136 tdecl allmeths (PTy doc _ syn _ o n t)
136 tdecl allmeths (PTy doc _ syn _ o n t)
137− = do t' <- implicit' info syn allmeths n t
137+ = do t' <- implicit' info syn (map fst ps ++ allmeths) n t
138− logLvl 5 $ "Method " ++ show n ++ " : " ++ showTmImpls t'
138+ logLvl 2 $ "Method " ++ show n ++ " : " ++ showTmImpls t'
139 return ( (n, (toExp (map fst ps) Exp t')),
139 return ( (n, (toExp (map fst ps) Exp t')),
140 (n, (doc, o, (toExp (map fst ps)
140 (n, (doc, o, (toExp (map fst ps)
141 (\ l s p -> Imp l s p Nothing) t'))),
141 (\ l s p -> Imp l s p Nothing) t'))),
src/Idris/Elab/Clause.hs+10−10
@@ -548,7 +548,7 @@ elabClause :: ElabInfo -> FnOpts -> (Int, PClause) ->
548elabClause info opts (_, PClause fc fname lhs_in [] PImpossible [])
548elabClause info opts (_, PClause fc fname lhs_in [] PImpossible [])
549 = do let tcgen = Dictionary `elem` opts
549 = do let tcgen = Dictionary `elem` opts
550 i <- get
550 i <- get
551− let lhs = addImpl i lhs_in
551+ let lhs = addImpl [] i lhs_in
552 b <- checkPossible info fc tcgen fname lhs_in
552 b <- checkPossible info fc tcgen fname lhs_in
553 case b of
553 case b of
554 True -> tclift $ tfail (At fc
554 True -> tclift $ tfail (At fc
@@ -603,7 +603,7 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
603 -- If we're inferring metavariables in the type, don't recheck,
603 -- If we're inferring metavariables in the type, don't recheck,
604 -- because we're only doing this to try to work out those metavariables
604 -- because we're only doing this to try to work out those metavariables
605 (clhs_c, clhsty) <- if not inf
605 (clhs_c, clhsty) <- if not inf
606− then recheckC fc [] lhs_tm
606+ then recheckC fc id [] lhs_tm
607 else return (lhs_tm, lhs_ty)
607 else return (lhs_tm, lhs_ty)
608 let clhs = normalise ctxt [] clhs_c
608 let clhs = normalise ctxt [] clhs_c
609 let borrowed = borrowedNames [] clhs
609 let borrowed = borrowedNames [] clhs
@@ -681,7 +681,7 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
681 logLvl 4 $ "---> " ++ show rhs'
681 logLvl 4 $ "---> " ++ show rhs'
682 when (not (null defer)) $ iLOG $ "DEFERRED " ++
682 when (not (null defer)) $ iLOG $ "DEFERRED " ++
683 show (map (\ (n, (_,_,t)) -> (n, t)) defer)
683 show (map (\ (n, (_,_,t)) -> (n, t)) defer)
684− def' <- checkDef fc defer
684+ def' <- checkDef fc (Elaborating "deferred type of ") defer
685 let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
685 let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
686 addDeferred def''
686 addDeferred def''
687 mapM_ (\(n, _) -> addIBC (IBCDef n)) def''
687 mapM_ (\(n, _) -> addIBC (IBCDef n)) def''
@@ -700,7 +700,7 @@ elabClause info opts (cnum, PClause fc fname lhs_in_as withs rhs_in_as wherebloc
700 logLvl 6 $ " ==> " ++ show (forget rhs')
700 logLvl 6 $ " ==> " ++ show (forget rhs')
701
701
702 (crhs, crhsty) <- if not inf
702 (crhs, crhsty) <- if not inf
703− then recheckC_borrowing True borrowed fc [] rhs'
703+ then recheckC_borrowing True borrowed fc id [] rhs'
704 else return (rhs', clhsty)
704 else return (rhs', clhsty)
705 logLvl 6 $ " ==> " ++ show crhsty ++ " against " ++ show clhsty
705 logLvl 6 $ " ==> " ++ show crhsty ++ " against " ++ show clhsty
706 ctxt <- getContext
706 ctxt <- getContext
@@ -828,7 +828,7 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
828 let ret_ty = getRetTy (explicitNames (normalise ctxt [] lhs_ty))
828 let ret_ty = getRetTy (explicitNames (normalise ctxt [] lhs_ty))
829 let static_names = getStaticNames i lhs_tm
829 let static_names = getStaticNames i lhs_tm
830 logLvl 5 (show lhs_tm ++ "\n" ++ show static_names)
830 logLvl 5 (show lhs_tm ++ "\n" ++ show static_names)
831− (clhs, clhsty) <- recheckC fc [] lhs_tm
831+ (clhs, clhsty) <- recheckC fc id [] lhs_tm
832 logLvl 5 ("Checked " ++ show clhs)
832 logLvl 5 ("Checked " ++ show clhs)
833 let bargs = getPBtys (explicitNames (normalise ctxt [] lhs_tm))
833 let bargs = getPBtys (explicitNames (normalise ctxt [] lhs_tm))
834 let wval = addImplBound i (map fst bargs) wval_in
834 let wval = addImplBound i (map fst bargs) wval_in
@@ -847,12 +847,12 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
847 return (tt, d, is, ctxt', newDecls))
847 return (tt, d, is, ctxt', newDecls))
848 setContext ctxt'
848 setContext ctxt'
849 processTacticDecls newDecls
849 processTacticDecls newDecls
850− def' <- checkDef fc defer
850+ def' <- checkDef fc iderr defer
851 let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
851 let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
852 addDeferred def''
852 addDeferred def''
853 mapM_ (elabCaseBlock info opts) is
853 mapM_ (elabCaseBlock info opts) is
854 logLvl 5 ("Checked wval " ++ show wval')
854 logLvl 5 ("Checked wval " ++ show wval')
855− (cwval, cwvalty) <- recheckC fc [] (getInferTerm wval')
855+ (cwval, cwvalty) <- recheckC fc id [] (getInferTerm wval')
856 let cwvaltyN = explicitNames (normalise ctxt [] cwvalty)
856 let cwvaltyN = explicitNames (normalise ctxt [] cwvalty)
857 let cwvalN = explicitNames (normalise ctxt [] cwval)
857 let cwvalN = explicitNames (normalise ctxt [] cwval)
858 logLvl 3 ("With type " ++ show cwvalty ++ "\nRet type " ++ show ret_ty)
858 logLvl 3 ("With type " ++ show cwvalty ++ "\nRet type " ++ show ret_ty)
@@ -907,7 +907,7 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
907 addIBC (IBCImp wname)
907 addIBC (IBCImp wname)
908 addIBC (IBCStatic wname)
908 addIBC (IBCStatic wname)
909
909
910− def' <- checkDef fc [(wname, (-1, Nothing, wtype))]
910+ def' <- checkDef fc iderr [(wname, (-1, Nothing, wtype))]
911 let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
911 let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
912 addDeferred def''
912 addDeferred def''
913
913
@@ -943,12 +943,12 @@ elabClause info opts (_, PWith fc fname lhs_in withs wval_in pn_in withblock)
943 setContext ctxt'
943 setContext ctxt'
944 processTacticDecls newDecls
944 processTacticDecls newDecls
945
945
946− def' <- checkDef fc defer
946+ def' <- checkDef fc iderr defer
947 let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
947 let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, False))) def'
948 addDeferred def''
948 addDeferred def''
949 mapM_ (elabCaseBlock info opts) is
949 mapM_ (elabCaseBlock info opts) is
950 logLvl 5 ("Checked RHS " ++ show rhs')
950 logLvl 5 ("Checked RHS " ++ show rhs')
951− (crhs, crhsty) <- recheckC fc [] rhs'
951+ (crhs, crhsty) <- recheckC fc id [] rhs'
952 return $ (Right (clhs, crhs), lhs)
952 return $ (Right (clhs, crhs), lhs)
953 where
953 where
954 getImps (Bind n (Pi _ _ _) t) = pexp Placeholder : getImps t
954 getImps (Bind n (Pi _ _ _) t) = pexp Placeholder : getImps t
src/Idris/Elab/Data.hs+2−1
@@ -215,6 +215,7 @@ elabCon :: ElabInfo -> SyntaxInfo -> Name -> Bool ->
215 Idris (Name, Type)
215 Idris (Name, Type)
216elabCon info syn tn codata expkind (doc, argDocs, n, t_in, fc, forcenames)
216elabCon info syn tn codata expkind (doc, argDocs, n, t_in, fc, forcenames)
217 = do checkUndefined fc n
217 = do checkUndefined fc n
218+ logLvl 2 $ show fc ++ ":Constructor " ++ show n ++ " : " ++ show t_in
218 (cty, ckind, t, inacc) <- buildType info syn fc [Constructor] n (if codata then mkLazy t_in else t_in)
219 (cty, ckind, t, inacc) <- buildType info syn fc [Constructor] n (if codata then mkLazy t_in else t_in)
219 ctxt <- getContext
220 ctxt <- getContext
220 let cty' = normalise ctxt [] cty
221 let cty' = normalise ctxt [] cty
@@ -223,7 +224,7 @@ elabCon info syn tn codata expkind (doc, argDocs, n, t_in, fc, forcenames)
223 -- Check that the constructor type is, in fact, a part of the family being defined
224 -- Check that the constructor type is, in fact, a part of the family being defined
224 tyIs n cty'
225 tyIs n cty'
225
226
226− logLvl 2 $ show fc ++ ":Constructor " ++ show n ++ " : " ++ show t
227+ logLvl 5 $ show fc ++ ":Constructor " ++ show n ++ " elaborated : " ++ show t
227 logLvl 5 $ "Inaccessible args: " ++ show inacc
228 logLvl 5 $ "Inaccessible args: " ++ show inacc
228 logLvl 2 $ "---> " ++ show n ++ " : " ++ show cty'
229 logLvl 2 $ "---> " ++ show n ++ " : " ++ show cty'
229
230
src/Idris/Elab/Instance.hs+29−2
@@ -135,6 +135,8 @@ elabInstance info syn doc argDocs what fc cs n ps t expn ds = do
135 [PClause fc iname lhs [] rhs wb]]
135 [PClause fc iname lhs [] rhs wb]]
136 iLOG (show idecls)
136 iLOG (show idecls)
137 mapM_ (rec_elabDecl info EAll info) idecls
137 mapM_ (rec_elabDecl info EAll info) idecls
138+ ist <- getIState
139+ checkInjectiveArgs fc n (class_determiners ci) (lookupTyExact iname (tt_ctxt ist))
138 addIBC (IBCInstance intInst n iname)
140 addIBC (IBCInstance intInst n iname)
139
141
140 where
142 where
@@ -167,7 +169,7 @@ elabInstance info syn doc argDocs what fc cs n ps t expn ds = do
167 = do ty' <- addUsingConstraints syn fc t
169 = do ty' <- addUsingConstraints syn fc t
168 -- TODO think: something more in info?
170 -- TODO think: something more in info?
169 ty' <- implicit info syn iname ty'
171 ty' <- implicit info syn iname ty'
170− let ty = addImpl i ty'
172+ let ty = addImpl [] i ty'
171 ctxt <- getContext
173 ctxt <- getContext
172 (ElabResult tyT _ _ ctxt' newDecls, _) <-
174 (ElabResult tyT _ _ ctxt' newDecls, _) <-
173 tclift $ elaborate ctxt iname (TType (UVal 0)) initEState
175 tclift $ elaborate ctxt iname (TType (UVal 0)) initEState
@@ -175,7 +177,7 @@ elabInstance info syn doc argDocs what fc cs n ps t expn ds = do
175 setContext ctxt'
177 setContext ctxt'
176 processTacticDecls newDecls
178 processTacticDecls newDecls
177 ctxt <- getContext
179 ctxt <- getContext
178− (cty, _) <- recheckC fc [] tyT
180+ (cty, _) <- recheckC fc id [] tyT
179 let nty = normalise ctxt [] cty
181 let nty = normalise ctxt [] cty
180 return $ any (isJust . findOverlapping i (class_determiners ci) (delab i nty)) (class_instances ci)
182 return $ any (isJust . findOverlapping i (class_determiners ci) (delab i nty)) (class_instances ci)
181
183
@@ -276,3 +278,28 @@ elabInstance info syn doc argDocs what fc cs n ps t expn ds = do
276 clauseFor m iname ns (PClauses _ _ m' _)
278 clauseFor m iname ns (PClauses _ _ m' _)
277 = decorate ns iname m == decorate ns iname m'
279 = decorate ns iname m == decorate ns iname m'
278 clauseFor m iname ns _ = False
280 clauseFor m iname ns _ = False
281+
282+checkInjectiveArgs :: FC -> Name -> [Int] -> Maybe Type -> Idris ()
283+checkInjectiveArgs fc n ds Nothing = return ()
284+checkInjectiveArgs fc n ds (Just ty)
285+ = do ist <- getIState
286+ let (_, args) = unApply (instantiateRetTy ty)
287+ ci 0 ist args
288+ where
289+ ci i ist (a : as) | i `elem` ds
290+ = if isInj ist a then ci (i + 1) ist as
291+ else tclift $ tfail (At fc (InvalidTCArg n a))
292+ ci i ist (a : as) = ci (i + 1) ist as
293+ ci i ist [] = return ()
294+
295+ isInj i (P Bound n _) = True
296+ isInj i (P _ n _) = isConName n (tt_ctxt i)
297+ isInj i (App f a) = isInj i f && isInj i a
298+ isInj i (V _) = True
299+ isInj i (Bind n b sc) = isInj i sc
300+ isInj _ _ = True
301+
302+ instantiateRetTy (Bind n (Pi _ _ _) sc)
303+ = substV (P Bound n Erased) (instantiateRetTy sc)
304+ instantiateRetTy t = t
305+
src/Idris/Elab/Transform.hs+2−2
@@ -63,7 +63,7 @@ elabTransform info fc safe lhs_in@(PApp _ (PRef _ tf) _) rhs_in
63 let lhs_ty = getInferType lhs'
63 let lhs_ty = getInferType lhs'
64 let newargs = pvars i lhs_tm
64 let newargs = pvars i lhs_tm
65
65
66− (clhs_tm_in, clhs_ty) <- recheckC fc [] lhs_tm
66+ (clhs_tm_in, clhs_ty) <- recheckC fc id [] lhs_tm
67 let clhs_tm = renamepats pnames clhs_tm_in
67 let clhs_tm = renamepats pnames clhs_tm_in
68 logLvl 3 ("Transform LHS " ++ show clhs_tm)
68 logLvl 3 ("Transform LHS " ++ show clhs_tm)
69
69
@@ -80,7 +80,7 @@ elabTransform info fc safe lhs_in@(PApp _ (PRef _ tf) _) rhs_in
80 setContext ctxt'
80 setContext ctxt'
81 processTacticDecls newDecls
81 processTacticDecls newDecls
82
82
83− (crhs_tm_in, crhs_ty) <- recheckC fc [] rhs'
83+ (crhs_tm_in, crhs_ty) <- recheckC fc id [] rhs'
84 let crhs_tm = renamepats pnames crhs_tm_in
84 let crhs_tm = renamepats pnames crhs_tm_in
85 logLvl 3 ("Transform RHS " ++ show crhs_tm)
85 logLvl 3 ("Transform RHS " ++ show crhs_tm)
86
86
src/Idris/Elab/Type.hs+7−7
@@ -57,13 +57,13 @@ buildType info syn fc opts n ty' = do
57 ctxt <- getContext
57 ctxt <- getContext
58 i <- getIState
58 i <- getIState
59
59
60− logLvl 3 $ show n ++ " pre-type " ++ showTmImpls ty'
60+ logLvl 2 $ show n ++ " pre-type " ++ showTmImpls ty' ++ show (no_imp syn)
61 ty' <- addUsingConstraints syn fc ty'
61 ty' <- addUsingConstraints syn fc ty'
62 ty' <- addUsingImpls syn n fc ty'
62 ty' <- addUsingImpls syn n fc ty'
63− let ty = addImpl i ty'
63+ let ty = addImpl (imp_methods syn) i ty'
64
64
65− logLvl 3 $ show n ++ " type pre-addimpl " ++ showTmImpls ty'
65+ logLvl 5 $ show n ++ " type pre-addimpl " ++ showTmImpls ty'
66− logLvl 3 $ show n ++ " type " ++ show (using syn) ++ "\n" ++ showTmImpls ty
66+ logLvl 2 $ show n ++ " type " ++ show (using syn) ++ "\n" ++ showTmImpls ty
67
67
68 (ElabResult tyT' defer is ctxt' newDecls, log) <-
68 (ElabResult tyT' defer is ctxt' newDecls, log) <-
69 tclift $ elaborate ctxt n (TType (UVal 0)) initEState
69 tclift $ elaborate ctxt n (TType (UVal 0)) initEState
@@ -75,7 +75,7 @@ buildType info syn fc opts n ty' = do
75
75
76 logLvl 3 $ show ty ++ "\nElaborated: " ++ show tyT'
76 logLvl 3 $ show ty ++ "\nElaborated: " ++ show tyT'
77
77
78− ds <- checkAddDef True False fc defer
78+ ds <- checkAddDef True False fc iderr defer
79 -- if the type is not complete, note that we'll need to infer
79 -- if the type is not complete, note that we'll need to infer
80 -- things later (for solving metavariables)
80 -- things later (for solving metavariables)
81 when (not (null ds)) $ addTyInferred n
81 when (not (null ds)) $ addTyInferred n
@@ -85,7 +85,7 @@ buildType info syn fc opts n ty' = do
85 logLvl 5 $ "Rechecking"
85 logLvl 5 $ "Rechecking"
86 logLvl 6 $ show tyT
86 logLvl 6 $ show tyT
87 logLvl 10 $ "Elaborated to " ++ showEnvDbg [] tyT
87 logLvl 10 $ "Elaborated to " ++ showEnvDbg [] tyT
88− (cty, ckind) <- recheckC fc [] tyT
88+ (cty, ckind) <- recheckC fc id [] tyT
89
89
90 -- record the implicit and inaccessible arguments
90 -- record the implicit and inaccessible arguments
91 i <- getIState
91 i <- getIState
@@ -154,7 +154,7 @@ elabType' norm info syn doc argDocs fc opts n ty' = {- let ty' = piBind (params
154 -- Productivity checking now via checking for guarded 'Delay'
154 -- Productivity checking now via checking for guarded 'Delay'
155 let opts' = opts -- if corec then (Coinductive : opts) else opts
155 let opts' = opts -- if corec then (Coinductive : opts) else opts
156 let usety = if norm then nty' else nty
156 let usety = if norm then nty' else nty
157− ds <- checkDef fc [(n, (-1, Nothing, usety))]
157+ ds <- checkDef fc iderr [(n, (-1, Nothing, usety))]
158 addIBC (IBCDef n)
158 addIBC (IBCDef n)
159 let ds' = map (\(n, (i, top, t)) -> (n, (i, top, t, True))) ds
159 let ds' = map (\(n, (i, top, t)) -> (n, (i, top, t, True))) ds
160 addDeferred ds'
160 addDeferred ds'
src/Idris/Elab/Utils.hs+16−10
@@ -24,30 +24,36 @@ import qualified Data.Map as Map
24
24
25recheckC = recheckC_borrowing False []
25recheckC = recheckC_borrowing False []
26
26
27−recheckC_borrowing uniq_check bs fc env t
27+recheckC_borrowing uniq_check bs fc mkerr env t
28 = do -- t' <- applyOpts (forget t) (doesn't work, or speed things up...)
28 = do -- t' <- applyOpts (forget t) (doesn't work, or speed things up...)
29 ctxt <- getContext
29 ctxt <- getContext
30+ t' <- case safeForget t of
31+ Just ft -> return ft
32+ Nothing -> tclift $ tfail $ mkerr (At fc (IncompleteTerm t))
30− (tm, ty, cs) <- tclift $ case recheck_borrowing uniq_check bs ctxt env (forget t) t of
33+ (tm, ty, cs) <- tclift $ case recheck_borrowing uniq_check bs ctxt env t' t of
31− Error e -> tfail (At fc e)
34+ Error e -> tfail (At fc (mkerr e))
32 OK x -> return x
35 OK x -> return x
33 logLvl 6 $ "CONSTRAINTS ADDED: " ++ show cs
36 logLvl 6 $ "CONSTRAINTS ADDED: " ++ show cs
34 addConstraints fc cs
37 addConstraints fc cs
35 return (tm, ty)
38 return (tm, ty)
36
39
40+iderr :: Name -> Err -> Err
41+iderr _ e = e
42+
37−checkDef :: FC -> [(Name, (Int, Maybe Name, Type))]
43+checkDef :: FC -> (Name -> Err -> Err) -> [(Name, (Int, Maybe Name, Type))]
38 -> Idris [(Name, (Int, Maybe Name, Type))]
44 -> Idris [(Name, (Int, Maybe Name, Type))]
39−checkDef fc ns = checkAddDef False True fc ns
45+checkDef fc mkerr ns = checkAddDef False True fc mkerr ns
40
46
41−checkAddDef :: Bool -> Bool -> FC
47+checkAddDef :: Bool -> Bool -> FC -> (Name -> Err -> Err)
42 -> [(Name, (Int, Maybe Name, Type))]
48 -> [(Name, (Int, Maybe Name, Type))]
43 -> Idris [(Name, (Int, Maybe Name, Type))]
49 -> Idris [(Name, (Int, Maybe Name, Type))]
44−checkAddDef add toplvl fc [] = return []
50+checkAddDef add toplvl fc mkerr [] = return []
45−checkAddDef add toplvl fc ((n, (i, top, t)) : ns)
51+checkAddDef add toplvl fc mkerr ((n, (i, top, t)) : ns)
46 = do ctxt <- getContext
52 = do ctxt <- getContext
47− (t', _) <- recheckC fc [] t
53+ (t', _) <- recheckC fc (mkerr n) [] t
48 when add $ do addDeferred [(n, (i, top, t, toplvl))]
54 when add $ do addDeferred [(n, (i, top, t, toplvl))]
49 addIBC (IBCDef n)
55 addIBC (IBCDef n)
50− ns' <- checkAddDef add toplvl fc ns
56+ ns' <- checkAddDef add toplvl fc mkerr ns
51 return ((n, (i, top, t')) : ns')
57 return ((n, (i, top, t')) : ns')
52
58
53-- | Get the list of (index, name) of inaccessible arguments from an elaborated
59-- | Get the list of (index, name) of inaccessible arguments from an elaborated
src/Idris/Elab/Value.hs+3−3
@@ -56,7 +56,7 @@ elabValBind :: ElabInfo -> ElabMode -> Bool -> PTerm -> Idris (Term, Type, [(Nam
56elabValBind info aspat norm tm_in
56elabValBind info aspat norm tm_in
57 = do ctxt <- getContext
57 = do ctxt <- getContext
58 i <- getIState
58 i <- getIState
59− let tm = addImpl i tm_in
59+ let tm = addImpl [] i tm_in
60 logLvl 10 (showTmImpls tm)
60 logLvl 10 (showTmImpls tm)
61 -- try:
61 -- try:
62 -- * ordinary elaboration
62 -- * ordinary elaboration
@@ -73,13 +73,13 @@ elabValBind info aspat norm tm_in
73
73
74 let vtm = orderPats (getInferTerm tm')
74 let vtm = orderPats (getInferTerm tm')
75
75
76− def' <- checkDef (fileFC "(input)") defer
76+ def' <- checkDef (fileFC "(input)") iderr defer
77 let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, True))) def'
77 let def'' = map (\(n, (i, top, t)) -> (n, (i, top, t, True))) def'
78 addDeferred def''
78 addDeferred def''
79 mapM_ (elabCaseBlock info []) is
79 mapM_ (elabCaseBlock info []) is
80
80
81 logLvl 3 ("Value: " ++ show vtm)
81 logLvl 3 ("Value: " ++ show vtm)
82− (vtm_in, vty) <- recheckC (fileFC "(input)") [] vtm
82+ (vtm_in, vty) <- recheckC (fileFC "(input)") id [] vtm
83
83
84 let vtm = if norm then normalise (tt_ctxt i) [] vtm_in
84 let vtm = if norm then normalise (tt_ctxt i) [] vtm_in
85 else vtm_in
85 else vtm_in
src/Idris/ElabTerm.hs+6−2
@@ -57,7 +57,7 @@ processTacticDecls info =
57 updateIState $ \i -> i { idris_implicits =
57 updateIState $ \i -> i { idris_implicits =
58 addDef n impls (idris_implicits i) }
58 addDef n impls (idris_implicits i) }
59 addIBC (IBCImp n)
59 addIBC (IBCImp n)
60− ds <- checkDef fc [(n, (-1, Nothing, ty))]
60+ ds <- checkDef fc iderr [(n, (-1, Nothing, ty))]
61 addIBC (IBCDef n)
61 addIBC (IBCDef n)
62 let ds' = map (\(n, (i, top, t)) -> (n, (i, top, t, True))) ds
62 let ds' = map (\(n, (i, top, t)) -> (n, (i, top, t, True))) ds
63 addDeferred ds'
63 addDeferred ds'
@@ -1375,9 +1375,12 @@ findInstances :: IState -> Term -> [Name]
1375findInstances ist t
1375findInstances ist t
1376 | (P _ n _, _) <- unApply t
1376 | (P _ n _, _) <- unApply t
1377 = case lookupCtxt n (idris_classes ist) of
1377 = case lookupCtxt n (idris_classes ist) of
1378− [CI _ _ _ _ _ ins _] -> ins
1378+ [CI _ _ _ _ _ ins _] -> filter accessible ins
1379 _ -> []
1379 _ -> []
1380 | otherwise = []
1380 | otherwise = []
1381+ where accessible n = case lookupDefAccExact n False (tt_ctxt ist) of
1382+ Just (_, Hidden) -> False
1383+ _ -> True
1381
1384
1382-- Try again to solve auto implicits
1385-- Try again to solve auto implicits
1383solveAuto :: IState -> Name -> Bool -> Name -> ElabD ()
1386solveAuto :: IState -> Name -> Bool -> Name -> ElabD ()
@@ -2708,6 +2711,7 @@ reflectErr (NotInjective t1 t2 t3) =
2708 , reflect t3
2711 , reflect t3
2709 ]
2712 ]
2710reflectErr (CantResolve _ t) = raw_apply (Var $ reflErrName "CantResolve") [reflect t]
2713reflectErr (CantResolve _ t) = raw_apply (Var $ reflErrName "CantResolve") [reflect t]
2714+reflectErr (InvalidTCArg n t) = raw_apply (Var $ reflErrName "InvalidTCArg") [reflectName n, reflect t]
2711reflectErr (CantResolveAlts ss) =
2715reflectErr (CantResolveAlts ss) =
2712 raw_apply (Var $ reflErrName "CantResolveAlts")
2716 raw_apply (Var $ reflErrName "CantResolveAlts")
2713 [rawList (Var $ reflm "TTName") (map reflectName ss)]
2717 [rawList (Var $ reflm "TTName") (map reflectName ss)]
src/Idris/IBC.hs+2−2
@@ -1420,7 +1420,7 @@ instance Binary Using where
1420 _ -> error "Corrupted binary data for Using"
1420 _ -> error "Corrupted binary data for Using"
1421
1421
1422instance Binary SyntaxInfo where
1422instance Binary SyntaxInfo where
1423− put (Syn x1 x2 x3 x4 _ x5 x6 _ _ x7 _)
1423+ put (Syn x1 x2 x3 x4 _ _ x5 x6 _ _ x7 _)
1424 = do put x1
1424 = do put x1
1425 put x2
1425 put x2
1426 put x3
1426 put x3
@@ -1436,7 +1436,7 @@ instance Binary SyntaxInfo where
1436 x5 <- get
1436 x5 <- get
1437 x6 <- get
1437 x6 <- get
1438 x7 <- get
1438 x7 <- get
1439− return (Syn x1 x2 x3 x4 id x5 x6 Nothing 0 x7 0)
1439+ return (Syn x1 x2 x3 x4 [] id x5 x6 Nothing 0 x7 0)
1440
1440
1441instance (Binary t) => Binary (PClause' t) where
1441instance (Binary t) => Binary (PClause' t) where
1442 put x
1442 put x
src/Idris/Prover.hs+1−1
@@ -78,7 +78,7 @@ prove opt ctxt lit n ty
78 putIState (i { proof_list = (n, prf) : proofs })
78 putIState (i { proof_list = (n, prf) : proofs })
79 let tree = simpleCase False (STerm Erased) False CompileTime (fileFC "proof") [] [] [([], P Ref n ty, tm)]
79 let tree = simpleCase False (STerm Erased) False CompileTime (fileFC "proof") [] [] [([], P Ref n ty, tm)]
80 logLvl 3 (show tree)
80 logLvl 3 (show tree)
81− (ptm, pty) <- recheckC (fileFC "proof") [] tm
81+ (ptm, pty) <- recheckC (fileFC "proof") id [] tm
82 logLvl 5 ("Proof type: " ++ show pty ++ "\n" ++
82 logLvl 5 ("Proof type: " ++ show pty ++ "\n" ++
83 "Expected type:" ++ show ty)
83 "Expected type:" ++ show ty)
84 case converts ctxt [] ty pty of
84 case converts ctxt [] ty pty of
src/Idris/TypeSearch.hs+1−1
@@ -46,7 +46,7 @@ searchByType pkgs pterm = do
46 mapM_ loadPkgIndex pkgs
46 mapM_ loadPkgIndex pkgs
47 pterm' <- addUsingConstraints syn emptyFC pterm
47 pterm' <- addUsingConstraints syn emptyFC pterm
48 pterm'' <- implicit toplevel syn name pterm'
48 pterm'' <- implicit toplevel syn name pterm'
49− let pterm''' = addImpl i pterm''
49+ let pterm''' = addImpl [] i pterm''
50 ty <- elabType toplevel syn (fst noDocs) (snd noDocs) emptyFC [] name pterm'
50 ty <- elabType toplevel syn (fst noDocs) (snd noDocs) emptyFC [] name pterm'
51 let names = searchUsing searchPred i ty
51 let names = searchUsing searchPred i ty
52 let names' = take numLimit names
52 let names' = take numLimit names
test/quasiquote001/expected+2−2
@@ -1,5 +1,5 @@
1(App (App (App (P (DCon 1 3) (NS (UN ::) ["List", "Prelude"]) (Bind (UN a) (Pi (TType (UVar -1))) (Bind (MN 0 "_t") (Pi (V 0)) (Bind (MN 2 "_t") (Pi (App (P (TCon 0 0) (NS (UN List) ["List", "Prelude"]) Erased) (V 1))) (App (P (TCon 0 0) (NS (UN List) ["List", "Prelude"]) Erased) (V 2)))))) (P (TCon 8 0) (UN Unit) (TType (UVar -1)))) (P (DCon 0 0) (UN MkUnit) (P (TCon 0 0) (UN Unit) Erased))) (App (App (App (P (DCon 1 3) (NS (UN ::) ["List", "Prelude"]) (Bind (UN a) (Pi (TType (UVar -1))) (Bind (MN 0 "_t") (Pi (V 0)) (Bind (MN 2 "_t") (Pi (App (P (TCon 0 0) (NS (UN List) ["List", "Prelude"]) Erased) (V 1))) (App (P (TCon 0 0) (NS (UN List) ["List", "Prelude"]) Erased) (V 2)))))) (P (TCon 8 0) (UN Unit) (TType (UVar -1)))) (P (DCon 0 0) (UN MkUnit) (P (TCon 0 0) (UN Unit) Erased))) (App (P (DCon 0 1) (NS (UN Nil) ["List", "Prelude"]) (Bind (UN a) (Pi (TType (UVar -1))) (App (P (TCon 0 0) (NS (UN List) ["List", "Prelude"]) Erased) (V 0)))) (P (TCon 8 0) (UN Unit) (TType (UVar -1))))))
1(App (App (App (P (DCon 1 3) (NS (UN ::) ["List", "Prelude"]) (Bind (UN a) (Pi (TType (UVar -1))) (Bind (MN 0 "_t") (Pi (V 0)) (Bind (MN 2 "_t") (Pi (App (P (TCon 0 0) (NS (UN List) ["List", "Prelude"]) Erased) (V 1))) (App (P (TCon 0 0) (NS (UN List) ["List", "Prelude"]) Erased) (V 2)))))) (P (TCon 8 0) (UN Unit) (TType (UVar -1)))) (P (DCon 0 0) (UN MkUnit) (P (TCon 0 0) (UN Unit) Erased))) (App (App (App (P (DCon 1 3) (NS (UN ::) ["List", "Prelude"]) (Bind (UN a) (Pi (TType (UVar -1))) (Bind (MN 0 "_t") (Pi (V 0)) (Bind (MN 2 "_t") (Pi (App (P (TCon 0 0) (NS (UN List) ["List", "Prelude"]) Erased) (V 1))) (App (P (TCon 0 0) (NS (UN List) ["List", "Prelude"]) Erased) (V 2)))))) (P (TCon 8 0) (UN Unit) (TType (UVar -1)))) (P (DCon 0 0) (UN MkUnit) (P (TCon 0 0) (UN Unit) Erased))) (App (P (DCon 0 1) (NS (UN Nil) ["List", "Prelude"]) (Bind (UN a) (Pi (TType (UVar -1))) (App (P (TCon 0 0) (NS (UN List) ["List", "Prelude"]) Erased) (V 0)))) (P (TCon 8 0) (UN Unit) (TType (UVar -1))))))
2--------------
2--------------
3−(App (App (App (P (DCon 1 3) (NS (UN ::) ["List", "Prelude"]) (Bind (UN a) (Pi (TType (UVar -1))) (Bind (MN 0 "_t") (Pi (V 0)) (Bind (MN 2 "_t") (Pi (App (P (TCon 0 0) (NS (UN List) ["List", "Prelude"]) Erased) (V 1))) (App (P (TCon 0 0) (NS (UN List) ["List", "Prelude"]) Erased) (V 2)))))) (TType (UVar 48))) (TType (UVar 50))) (App (App (App (P (DCon 1 3) (NS (UN ::) ["List", "Prelude"]) (Bind (UN a) (Pi (TType (UVar -1))) (Bind (MN 0 "_t") (Pi (V 0)) (Bind (MN 2 "_t") (Pi (App (P (TCon 0 0) (NS (UN List) ["List", "Prelude"]) Erased) (V 1))) (App (P (TCon 0 0) (NS (UN List) ["List", "Prelude"]) Erased) (V 2)))))) (TType (UVar 52))) (App (App (App (App (P (DCon 0 4) (NS (UN MkPair) ["Builtins"]) (Bind (UN A) (Pi (TType (UVar -1))) (Bind (UN B) (Pi (TType (UVar -1))) (Bind (UN a) (Pi (V 1)) (Bind (UN b) (Pi (V 1)) (App (App (P (TCon 0 0) (NS (UN Pair) ["Builtins"]) Erased) (V 3)) (V 2))))))) (TType (UVar 42))) (TType (UVar 44))) (P (TCon 8 0) (NS (UN Nat) ["Nat", "Prelude"]) (TType (UVar -1)))) (P (TCon 8 0) (NS (UN Nat) ["Nat", "Prelude"]) (TType (UVar -1))))) (App (P (DCon 0 1) (NS (UN Nil) ["List", "Prelude"]) (Bind (UN a) (Pi (TType (UVar -1))) (App (P (TCon 0 0) (NS (UN List) ["List", "Prelude"]) Erased) (V 0)))) (TType (UVar 54)))))
3+(App (App (App (P (DCon 1 3) (NS (UN ::) ["List", "Prelude"]) (Bind (UN a) (Pi (TType (UVar -1))) (Bind (MN 0 "_t") (Pi (V 0)) (Bind (MN 2 "_t") (Pi (App (P (TCon 0 0) (NS (UN List) ["List", "Prelude"]) Erased) (V 1))) (App (P (TCon 0 0) (NS (UN List) ["List", "Prelude"]) Erased) (V 2)))))) (TType (UVar 32))) (TType (UVar 34))) (App (App (App (P (DCon 1 3) (NS (UN ::) ["List", "Prelude"]) (Bind (UN a) (Pi (TType (UVar -1))) (Bind (MN 0 "_t") (Pi (V 0)) (Bind (MN 2 "_t") (Pi (App (P (TCon 0 0) (NS (UN List) ["List", "Prelude"]) Erased) (V 1))) (App (P (TCon 0 0) (NS (UN List) ["List", "Prelude"]) Erased) (V 2)))))) (TType (UVar 36))) (App (App (App (App (P (DCon 0 4) (NS (UN MkPair) ["Builtins"]) (Bind (UN A) (Pi (TType (UVar -1))) (Bind (UN B) (Pi (TType (UVar -1))) (Bind (UN a) (Pi (V 1)) (Bind (UN b) (Pi (V 1)) (App (App (P (TCon 0 0) (NS (UN Pair) ["Builtins"]) Erased) (V 3)) (V 2))))))) (TType (UVar 30))) (TType (UVar 32))) (P (TCon 8 0) (NS (UN Nat) ["Nat", "Prelude"]) (TType (UVar -1)))) (P (TCon 8 0) (NS (UN Nat) ["Nat", "Prelude"]) (TType (UVar -1))))) (App (P (DCon 0 1) (NS (UN Nil) ["List", "Prelude"]) (Bind (UN a) (Pi (TType (UVar -1))) (App (P (TCon 0 0) (NS (UN List) ["List", "Prelude"]) Erased) (V 0)))) (TType (UVar 38)))))
4--------------
4--------------
5−(App (App (App (App (P (DCon 0 4) (NS (UN MkPair) ["Builtins"]) (Bind (UN A) (Pi (TType (UVar -1))) (Bind (UN B) (Pi (TType (UVar -1))) (Bind (UN a) (Pi (V 1)) (Bind (UN b) (Pi (V 1)) (App (App (P (TCon 0 0) (NS (UN Pair) ["Builtins"]) Erased) (V 3)) (V 2))))))) (TType (UVar 42))) (TType (UVar 44))) (App (App (App (App (P (DCon 0 4) (NS (UN MkPair) ["Builtins"]) (Bind (UN A) (Pi (TType (UVar -1))) (Bind (UN B) (Pi (TType (UVar -1))) (Bind (UN a) (Pi (V 1)) (Bind (UN b) (Pi (V 1)) (App (App (P (TCon 0 0) (NS (UN Pair) ["Builtins"]) Erased) (V 3)) (V 2))))))) (TType (UVar 42))) (TType (UVar 44))) (TType (UVar 48))) (TType (UVar 48)))) (App (App (App (App (P (DCon 0 4) (NS (UN MkPair) ["Builtins"]) (Bind (UN A) (Pi (TType (UVar -1))) (Bind (UN B) (Pi (TType (UVar -1))) (Bind (UN a) (Pi (V 1)) (Bind (UN b) (Pi (V 1)) (App (App (P (TCon 0 0) (NS (UN Pair) ["Builtins"]) Erased) (V 3)) (V 2))))))) (TType (UVar 42))) (TType (UVar 44))) (TType (UVar 48))) (TType (UVar 48))))
5+(App (App (App (App (P (DCon 0 4) (NS (UN MkPair) ["Builtins"]) (Bind (UN A) (Pi (TType (UVar -1))) (Bind (UN B) (Pi (TType (UVar -1))) (Bind (UN a) (Pi (V 1)) (Bind (UN b) (Pi (V 1)) (App (App (P (TCon 0 0) (NS (UN Pair) ["Builtins"]) Erased) (V 3)) (V 2))))))) (TType (UVar 30))) (TType (UVar 32))) (App (App (App (App (P (DCon 0 4) (NS (UN MkPair) ["Builtins"]) (Bind (UN A) (Pi (TType (UVar -1))) (Bind (UN B) (Pi (TType (UVar -1))) (Bind (UN a) (Pi (V 1)) (Bind (UN b) (Pi (V 1)) (App (App (P (TCon 0 0) (NS (UN Pair) ["Builtins"]) Erased) (V 3)) (V 2))))))) (TType (UVar 30))) (TType (UVar 32))) (TType (UVar 32))) (TType (UVar 32)))) (App (App (App (App (P (DCon 0 4) (NS (UN MkPair) ["Builtins"]) (Bind (UN A) (Pi (TType (UVar -1))) (Bind (UN B) (Pi (TType (UVar -1))) (Bind (UN a) (Pi (V 1)) (Bind (UN b) (Pi (V 1)) (App (App (P (TCon 0 0) (NS (UN Pair) ["Builtins"]) Erased) (V 3)) (V 2))))))) (TType (UVar 30))) (TType (UVar 32))) (TType (UVar 32))) (TType (UVar 32))))
test/reg059/expectednew file

No changes to the content.

test/reg059/reg059.idrnew file+8
@@ -0,0 +1,8 @@
1+class Monad m => ContainerMonad (m : Type -> Type) where
2+ Elem : a -> m a -> Type
3+ tagElem : (mx : m a) -> m (x : a ** Elem x mx)
4+
5+class Monad m => ContainerMonad2 a (m : Type -> Type) where
6+ Elem2 : a -> m a -> Type
7+ tagElem2 : (mx : m a) -> m (x : a ** Elem2 x mx)
8+
test/reg059/runnew file+3
@@ -0,0 +1,3 @@
1+#!/usr/bin/env bash
2+idris $@ reg059.idr --check
3+rm -f *.ibc
test/unique001/expected+1−1
@@ -17,4 +17,4 @@ with
17unique001b.idr:16:7:Borrowed name xs must not be used on RHS
17unique001b.idr:16:7:Borrowed name xs must not be used on RHS
18unique001c.idr:46:6:Unique name f is used more than once
18unique001c.idr:46:6:Unique name f is used more than once
19unique001d.idr:3:7:Borrowed name x must not be used on RHS
19unique001d.idr:3:7:Borrowed name x must not be used on RHS
20−unique001e.idr:4:11:Constructor Main.:: has a UniqueType, but the data type does not
20+unique001e.idr:3:10:Constructor Main.Nil has a UniqueType, but the data type does not