-
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
Escaped quantified variables #723
Comments
Here is a minimized example that generates the same error:
|
I think I understand what's going on here. This is probably a situation where we should be reporting a user error, and not a panic. In the minimized example I posted, think about what the type checker is doing: When checking the declaration for The problem here is that when type checking function To fix this, we need to demote this situation from a panic to an ordinary user type error, and make a better type error message. Perhaps we should look at what |
Yep, I think you are exactly right. We actually even have a type error for that, see |
Wow. You guys are fast. Thanks for taking this on so quickly. |
Ok, I did some tracing and I discovered that this particular panic message came from a call to We shouldn't actually demote the panic to an error message in |
This call to cryptol/src/Cryptol/TypeCheck/Solver/Improve.hs Lines 67 to 70 in 1c38465
In particular, the guard condition here is not sufficient to establish the datatype invariant on the Subst value created by singleSubst .
My recommendation would be that we rename |
The old `singleSubst` has been renamed to `uncheckedSingleSubst`. Fixes #723.
I have a pull request (#726) that fixes this. Now, when loading
|
$ cryptol bug.tex
┏━╸┏━┓╻ ╻┏━┓╺┳╸┏━┓╻
┃ ┣┳┛┗┳┛┣━┛ ┃ ┃ ┃┃
┗━╸╹┗╸ ╹ ╹ ╹ ┗━┛┗━╸
version 2.8.0
Loading module Cryptol
Loading module Main
cryptol: You have encountered a bug in Cryptol's implementation.
*** Please create an issue at https://github.com/GaloisInc/cryptol/issues
%< ---------------------------------------------------
Revision: UNKNOWN
Branch: UNKNOWN
Location: Cryptol.TypeCheck.Monad.extendSubst
Message: Escaped quantified variables:
Substitution: ?front
1035 := 2 * k
1042 - n891 Vars in scope: [n
891]Escaped: [k`1042]
CallStack (from HasCallStack):
panic, called at src/Cryptol/Utils/Panic.hs:21:9 in cryptol-2.8.0-CNGuMszJOXX2THCqGgAi4I:Cryptol.Utils.Panic
panic, called at src/Cryptol/TypeCheck/Monad.hs:562:16 in cryptol-2.8.0-CNGuMszJOXX2THCqGgAi4I:Cryptol.TypeCheck.Monad
%< ---------------------------------------------------
bug.tex.txt
(The input LaTeX file is ugly. It is from an early step in development, so don't look at its contents too closely.)
The text was updated successfully, but these errors were encountered: