Check that the declared type of prims matches the expected one.

Fixes #711
This commit is contained in:
Iavor Diatchki 2020-05-05 14:30:25 -07:00
parent 6adec7f771
commit c3eca4f22a
3 changed files with 11 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -44,7 +44,7 @@ Primitive Types
Arith : * -> Prop
Bit : *
Cmp : * -> Prop
fin : * -> Prop
fin : # -> Prop
Integer : *
inf : #
Literal : # -> * -> Prop