mirror of
https://github.com/GaloisInc/cryptol.git
synced 2024-11-28 09:23:04 +03:00
Update function toExpr
for new type of demote primitive.
Also avoid using removed primitive `integer`. Previously this caused a panic when printing counterexamples of type Integer.
This commit is contained in:
parent
751bb4e7e1
commit
c925a82dce
@ -805,9 +805,9 @@ toExpr prims t0 v0 = findOne (go t0 v0)
|
||||
(TCon (TC TCBit) [], VBit True ) -> return (prim "True")
|
||||
(TCon (TC TCBit) [], VBit False) -> return (prim "False")
|
||||
(TCon (TC TCInteger) [], VInteger i) ->
|
||||
return $ ETApp (prim "integer") (tNum i)
|
||||
return $ ETApp (ETApp (prim "demote") (tNum i)) ty
|
||||
(TCon (TC TCIntMod) [_n], VInteger i) ->
|
||||
return $ ETApp (prim "integer") (tNum i) --FIXME
|
||||
return $ ETApp (ETApp (prim "demote") (tNum i)) ty
|
||||
(TCon (TC TCSeq) [a,b], VSeq 0 _) -> do
|
||||
guard (a == tZero)
|
||||
return $ EList [] b
|
||||
@ -818,7 +818,7 @@ toExpr prims t0 v0 = findOne (go t0 v0)
|
||||
(TCon (TC TCSeq) [a,(TCon (TC TCBit) [])], VWord _ wval) -> do
|
||||
BV w v <- lift (asWordVal =<< wval)
|
||||
guard (a == tNum w)
|
||||
return $ ETApp (ETApp (prim "demote") (tNum v)) (tWord (tNum w))
|
||||
return $ ETApp (ETApp (prim "demote") (tNum v)) ty
|
||||
(_, VStream _) -> fail "cannot construct infinite expressions"
|
||||
(_, VFun _) -> fail "cannot convert function values to expressions"
|
||||
(_, VPoly _) -> fail "cannot convert polymorphic values to expressions"
|
||||
|
Loading…
Reference in New Issue
Block a user