Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correct multiplicities when checking Pi binders
We've always just used 0, which isn't correct if the function is going to be used in a runtime pattern match. Now calculate correctly so that we're explicit about which type level variables are used at runtime. This might cause some programs to fail to compile, if they use functions that calculate Pi types. The solution is to make those functions explicitly 0 multiplicity. If that doesn't work, you may have been accidentally trying to use compile-time only data at run time! Fixes #1163
- Loading branch information
Showing
15 changed files
with
64 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
data Foo : Nat -> Type where | ||
|
||
G : (0 yv : Nat) -> Type | ||
G yv = Foo yv -> Bool | ||
|
||
partial | ||
f : (0 x : Nat) -> Nat | ||
f x = case G x of | ||
(Foo x' -> _) => x' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
data Foo : Nat -> Type where | ||
|
||
0 G : (0 yv : Nat) -> Type | ||
G yv = Foo yv -> Bool | ||
|
||
partial | ||
f : (0 x : Nat) -> Nat | ||
f x = case G x of | ||
(Foo x' -> _) => x' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
1/1: Building Test1 (Test1.idr) | ||
Error: While processing right hand side of G. yv is not accessible in this context. | ||
|
||
Test1.idr:4:12--4:14 | ||
1 | data Foo : Nat -> Type where | ||
2 | | ||
3 | G : (0 yv : Nat) -> Type | ||
4 | G yv = Foo yv -> Bool | ||
^^ | ||
|
||
1/1: Building Test2 (Test2.idr) | ||
Error: While processing right hand side of f. Main.G is not accessible in this context. | ||
|
||
Test2.idr:8:12--8:13 | ||
4 | G yv = Foo yv -> Bool | ||
5 | | ||
6 | partial | ||
7 | f : (0 x : Nat) -> Nat | ||
8 | f x = case G x of | ||
^ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
$1 --no-color --console-width 0 Test1.idr --check | ||
$1 --no-color --console-width 0 Test2.idr --check | ||
|
||
rm -rf build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
IdType : Type | ||
0 IdType : Type | ||
IdType = {0 a : Type} -> a -> a | ||
|
||
id : IdType | ||
|