Type inference weirdness in the presence of type synonyms with unused arguments #894
Labels
bug
Something not working correctly
low-hanging fruit
For issues that should be easy to fix
typechecker
Issues related to type-checking Cryptol code.
Milestone
Fun fact: You can get the cryptol type checker to infer, for a closed expression, a type that contains an unresolved unification variable. Here's the source file:
This is caused by an apparent bug in the definition of type variable substitution for cryptol types. When I saw the following case in the definition of
apSubstMaybe
(which is supposed to returnJust t'
to indicate that the substitution did something, andNothing
to indicate that the substitution left the value unchanged) I thought it was probably wrong and so I constructed this example to check.cryptol/src/Cryptol/TypeCheck/Subst.hs
Lines 212 to 213 in ac0aca1
The constructor
TUser
contains both a list of the type synonym arguments, and also the body of the type synonym's definition. It's possible to define a type synonym in Cryptol whose body doesn't use all the arguments. But this code assumes that if the body is unchanged by the substitution, then the arguments will also be unchanged. The above example violates this assumption.The text was updated successfully, but these errors were encountered: