From 19cd8085d2b269a46c290b0cc948e43649c3be58 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Thu, 16 Apr 2009 17:18:39 +0000 Subject: [PATCH] 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. --- frontends/OccamTypes.hs | 10 +++++++++- frontends/ParseOccam.hs | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/frontends/OccamTypes.hs b/frontends/OccamTypes.hs index f12338a..bf68387 100644 --- a/frontends/OccamTypes.hs +++ b/frontends/OccamTypes.hs @@ -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]:". diff --git a/frontends/ParseOccam.hs b/frontends/ParseOccam.hs index 3d29457..0dea5d1 100644 --- a/frontends/ParseOccam.hs +++ b/frontends/ParseOccam.hs @@ -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