Skip to content

Commit

Permalink
[ fix ] Forward data declarations are linear
Browse files Browse the repository at this point in the history
  • Loading branch information
dunhamsteve authored and gallais committed Feb 22, 2025
1 parent 69f198d commit 8f1d8b7
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/TTImp/ProcessData.idr
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ processData {vars} eopts nest env fc def_vis mbtot (MkImpLater dfc n_in ty_raw)
arity <- getArity defs [] fullty

-- Add the type constructor as a placeholder
tidx <- addDef n (newDef fc n linear vars fullty def_vis
tidx <- addDef n (newDef fc n top vars fullty def_vis
(TCon 0 arity [] [] defaultFlags [] Nothing Nothing))
addMutData (Resolved tidx)
defs <- get Ctxt
Expand Down
8 changes: 8 additions & 0 deletions tests/idris2/data/data005/Issue1204.idr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
data Tm = Foo Nat

mutual
Env : Type
Env = List Clos

data Clos : Type where
Cl : Tm -> Env -> Clos
9 changes: 9 additions & 0 deletions tests/idris2/data/data005/Issue586.idr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
mutual
public export
ListT : (m : Type -> Type) -> (a : Type) -> Type
ListT m a = m (ListStruct m a)

public export
data ListStruct : (m : Type -> Type) -> (a : Type) -> Type where
Nil : ListStruct m a
(::) : a -> ListT m a -> ListStruct m a
5 changes: 5 additions & 0 deletions tests/idris2/data/data005/Issue586b.idr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
data X : Type
data Y : Type -> Type

f : Type
f = Y X
3 changes: 3 additions & 0 deletions tests/idris2/data/data005/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
1/1: Building Issue586 (Issue586.idr)
1/1: Building Issue586b (Issue586b.idr)
1/1: Building Issue1204 (Issue1204.idr)
5 changes: 5 additions & 0 deletions tests/idris2/data/data005/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
. ../../../testutils.sh

check Issue586.idr
check Issue586b.idr
check Issue1204.idr

0 comments on commit 8f1d8b7

Please sign in to comment.