Fixed the abbreviation modes of claimed channels a bit

This doesn't solve the problem (see #95), but it at least properly confines the problem to shared channel bundles, rather than affecting shared normal channels too.
This commit is contained in:
Neil Brown 2009-04-16 17:18:39 +00:00
parent ea2d00355c
commit 19cd8085d2
2 changed files with 10 additions and 2 deletions

View File

@ -926,7 +926,15 @@ inferTypes = occamOnlyPass "Infer types"
t'' <- case t' of
A.Infer -> astTypeOf (A.ActualClaim v')
_ -> return t'
return $ addId $ A.Is m am' t'' (A.ActualClaim v')
am'' <- case t'' of
-- CLAIMed channel bundles are ValAbbrev, as they may
-- not be altered:
A.ChanDataType {} ->
do modifyName n $ \nd -> nd { A.ndAbbrevMode = A.ValAbbrev }
return A.ValAbbrev
-- CLAIMed normal channels are as before:
_ -> return am'
return $ addId $ A.Is m am'' t'' (A.ActualClaim v')
A.Is m am t (A.ActualChannelArray vs) ->
-- No expressions in this -- but we may need to infer the type
-- of the variable if it's something like "cs IS [c]:".

View File

@ -1608,7 +1608,7 @@ claimSpec
n <- getName v >>= getOrigName
eol
indent
return ([(A.Specification m (A.Name m n) $ A.Is m A.ValAbbrev A.Infer $ A.ActualClaim v, ChannelName, normalName)], outdent)
return ([(A.Specification m (A.Name m n) $ A.Is m A.Abbrev A.Infer $ A.ActualClaim v, ChannelName, normalName)], outdent)
where
getName :: A.Variable -> OccParser A.Name
getName (A.Variable _ n) = return n