mirror of
https://github.com/GaloisInc/cryptol.git
synced 2025-01-05 23:17:42 +03:00
Check that the declared type of prims matches the expected one.
Fixes #711
This commit is contained in:
parent
6adec7f771
commit
c3eca4f22a
@ -57,7 +57,7 @@ primitive type (!=) : # -> # -> Prop
|
||||
primitive type (>=) : # -> # -> Prop
|
||||
|
||||
/** Assert that a numeric type is a proper natural number (not 'inf'). */
|
||||
primitive type fin : * -> Prop
|
||||
primitive type fin : # -> Prop
|
||||
|
||||
/** Value types that have a notion of 'zero'. */
|
||||
primitive type Zero : * -> Prop
|
||||
|
@ -292,7 +292,15 @@ newtypeConType nt =
|
||||
abstractTypeTC :: AbstractType -> TCon
|
||||
abstractTypeTC at =
|
||||
case builtInType (atName at) of
|
||||
Just tcon -> tcon
|
||||
Just tcon
|
||||
| kindOf tcon == atKind at -> tcon
|
||||
| otherwise ->
|
||||
panic "abstractTypeTC"
|
||||
[ "Mismatch between built-in and declared type."
|
||||
, "Name: " ++ pretty (atName at)
|
||||
, "Declared: " ++ pretty (atKind at)
|
||||
, "Built-in: " ++ pretty (kindOf tcon)
|
||||
]
|
||||
_ -> TC $ TCAbstract $ UserTC (atName at) (atKind at)
|
||||
|
||||
instance Eq TVar where
|
||||
|
@ -44,7 +44,7 @@ Primitive Types
|
||||
Arith : * -> Prop
|
||||
Bit : *
|
||||
Cmp : * -> Prop
|
||||
fin : * -> Prop
|
||||
fin : # -> Prop
|
||||
Integer : *
|
||||
inf : #
|
||||
Literal : # -> * -> Prop
|
||||
|
Loading…
Reference in New Issue
Block a user