-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Abort early after type-checking malformed constraint guards
Checking ill-typed constraint guards for exhaustivity can cause Cryptol to panic. If we detect any type errors after type-checking the guards, we now abort early and report any recorded errors instead of proceeding to check exhaustivity. Fixes #1593. Fixes #1693.
- Loading branch information
1 parent
a483c1e
commit 6e417aa
Showing
8 changed files
with
39 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
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,5 @@ | ||
f : {n, a} [n]a -> [8] | ||
f x | ||
| n == 1 => 0 | ||
| n != 1 => 1 | ||
| Eq a => 2 // Malformed |
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 @@ | ||
:load issue1593.cry |
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,7 @@ | ||
Loading module Cryptol | ||
Loading module Cryptol | ||
Loading module Main | ||
|
||
[error] at issue1593.cry:5:5--5:9: | ||
`Eq` may not be used in a constraint guard. | ||
Constraint guards support only numeric comparisons and `fin`. |
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 @@ | ||
f : {n} [n] -> [n+1] | ||
f x | ||
| (fin n) => x # [False] | ||
| (inf n) => 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 @@ | ||
:load issue1693.cry |
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,12 @@ | ||
Loading module Cryptol | ||
Loading module Cryptol | ||
Loading module Main | ||
|
||
[error] at issue1693.cry:1:5--1:21: | ||
Incorrect type form. | ||
Expected: a constraint | ||
Inferred: a numeric type | ||
[error] at issue1693.cry:4:5--4:12: | ||
Incorrect type form. | ||
Expected: a constraint | ||
Inferred: a numeric type |