From aa3b17b55519dcaeb32416b928857749ccfd9cc3 Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Sun, 6 Apr 2008 02:50:46 +0000 Subject: [PATCH] Make protocolItems give a more useful error message on failure. --- common/Types.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/Types.hs b/common/Types.hs index 1e0cbb7..5600166 100644 --- a/common/Types.hs +++ b/common/Types.hs @@ -261,7 +261,10 @@ returnTypesOfIntrinsic m s -- Returns Left if it's a simple protocol, Right if it's tagged. protocolItems :: (CSMR m, Die m) => A.Variable -> m (Either [A.Type] [(A.Name, [A.Type])]) protocolItems v - = do A.Chan _ _ t <- typeOfVariable v + = do chanT <- typeOfVariable v + t <- case chanT of + A.Chan _ _ t -> return t + _ -> dieP (findMeta v) $ "Expected a channel variable, but this is of type: " ++ show chanT case t of A.UserProtocol proto -> do st <- specTypeOfName proto