-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpeceted numeric constraint
panic with malformed constraint guards
#1593
Comments
The culprit is the code for typechecking numeric constraint guards: cryptol/src/Cryptol/TypeCheck/Infer.hs Lines 1266 to 1271 in 6c5bca3
Here, At first glance, it seems like calling cryptol/src/Cryptol/TypeCheck/Kind.hs Line 89 in 6c5bca3
One possible solution is to abort earlier when diff --git a/src/Cryptol/TypeCheck/Infer.hs b/src/Cryptol/TypeCheck/Infer.hs
index 4d142697..acda9938 100644
--- a/src/Cryptol/TypeCheck/Infer.hs
+++ b/src/Cryptol/TypeCheck/Infer.hs
@@ -1267,6 +1267,7 @@ checkSigB b (Forall as asmps0 t0, validSchema) =
asmps1 <- applySubstPreds asmps0
t1 <- applySubst t0
cases1 <- mapM checkPropGuardCase cases0
+ abortIfErrors
exh <- checkExhaustive (P.bName b) as asmps1 (map fst cases1)
unless exh $ This suffices to fix the panic. I'm unclear if this is the best place to call |
Just encountered a similar panic with an
Swapping the order of constraint guards to lead with the offending
|
An example very similar to |
While
torturingstress-testing Cryptol recently, I discovered that I can make it panic if I use malformed constraint guards:I imagine that constraint guards were never meant to contain constraints like
Eq a
, but nevertheless, we should reject them if encountered. Interestingly, Cryptol does give a proper error message if I move the malformed guard to the top:The text was updated successfully, but these errors were encountered: