-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ elab ] Add test of no escaping the zero quantity
- Loading branch information
Showing
4 changed files
with
56 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
||| Check that we cannot implement function illegally escaping zero quantity using elaboration reflection | ||
module NoEscape | ||
|
||
import Language.Reflection | ||
|
||
%language ElabReflection | ||
|
||
escScr : Elab $ (0 _ : a) -> a | ||
escScr = check $ ILam EmptyFC M0 ExplicitArg (Just `{x}) `(a) `(x) | ||
|
||
esc : (0 _ : a) -> a | ||
esc = %runElab escScr | ||
|
||
escd : (0 _ : a) -> a | ||
|
||
0 escd' : (0 _ : a) -> a | ||
|
||
escDecl : Name -> Elab Unit | ||
escDecl name = declare [ | ||
IDef EmptyFC name [ | ||
PatClause EmptyFC | ||
-- lhs | ||
(IApp EmptyFC (IVar EmptyFC name) (IBindVar EmptyFC "x")) | ||
-- rhs | ||
`(x) | ||
] | ||
] | ||
|
||
%runElab escDecl `{escd'} | ||
|
||
%runElab escDecl `{escd} |
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 NoEscape (NoEscape.idr) | ||
Error: While processing right hand side of esc. x is not accessible in this context. | ||
|
||
NoEscape:9:65--9:66 | ||
5 | | ||
6 | %language ElabReflection | ||
7 | | ||
8 | escScr : Elab $ (0 _ : a) -> a | ||
9 | escScr = check $ ILam EmptyFC M0 ExplicitArg (Just `{x}) `(a) `(x) | ||
^ | ||
|
||
Error: While processing right hand side of escd. x is not accessible in this context. | ||
|
||
NoEscape:25:24--25:25 | ||
21 | PatClause EmptyFC | ||
22 | -- lhs | ||
23 | (IApp EmptyFC (IVar EmptyFC name) (IBindVar EmptyFC "x")) | ||
24 | -- rhs | ||
25 | `(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,3 @@ | ||
rm -rf build | ||
|
||
$1 --no-color --console-width 0 --check NoEscape.idr |