From 13ea7f2c4b2b6a711a0e6717f6defd7bef4129d2 Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Mon, 2 Jun 2008 10:28:26 +0000 Subject: [PATCH] Resolve conflicts after merge. --- frontends/RainPasses.hs | 2 ++ frontends/RainPassesTest.hs | 20 ++++++++++---------- frontends/RainTypes.hs | 12 ++++++++---- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/frontends/RainPasses.hs b/frontends/RainPasses.hs index f9f7bba..bb1712b 100644 --- a/frontends/RainPasses.hs +++ b/frontends/RainPasses.hs @@ -28,6 +28,8 @@ import Data.Maybe import qualified AST as A import CompState import Errors +import ImplicitMobility +import Metadata import Pass import qualified Properties as Prop import RainTypes diff --git a/frontends/RainPassesTest.hs b/frontends/RainPassesTest.hs index f61c668..d21d62e 100644 --- a/frontends/RainPassesTest.hs +++ b/frontends/RainPassesTest.hs @@ -212,7 +212,8 @@ testRecordInfNames0 = TestCase $ testPassWithStateCheck "testRecordInfNames0" ex orig = (A.Rep m (A.ForEach m (simpleName "c") (makeLiteralStringRain "hello")) skipP) exp = orig check state = assertVarDef "testRecordInfNames0" state "c" - (tag7 A.NameDef DontCare "c" "c" A.VariableName (A.Declaration m A.Byte ) A.Abbrev A.Unplaced) + (tag6 A.NameDef DontCare "c" "c" + (A.Declaration m $ A.UnknownVarType $ Left $ simpleName "c") A.Abbrev A.Unplaced) -- | checks that c's type is recorded in: ***each (c : str) {}, where str is known to be of type string testRecordInfNames1 :: Test @@ -223,7 +224,8 @@ testRecordInfNames1 = TestCase $ testPassWithStateCheck "testRecordInfNames1" ex orig = (A.Rep m (A.ForEach m (simpleName "c") (exprVariable "str")) skipP) exp = orig check state = assertVarDef "testRecordInfNames1" state "c" - (tag7 A.NameDef DontCare "c" "c" A.VariableName (A.Declaration m A.Byte ) A.Abbrev A.Unplaced) + (tag6 A.NameDef DontCare "c" "c" + (A.Declaration m $ A.UnknownVarType $ Left $ simpleName "c") A.Abbrev A.Unplaced) -- | checks that c's and d's type are recorded in: ***each (c : multi) { seqeach (d : c) {} } where multi is known to be of type [string] testRecordInfNames2 :: Test @@ -235,15 +237,13 @@ testRecordInfNames2 = TestCase $ testPassWithStateCheck "testRecordInfNames2" ex A.Only m $ A.Seq m $ A.Rep m (A.ForEach m (simpleName "d") (exprVariable "c")) skipP exp = orig check state = do assertVarDef "testRecordInfNames2" state "c" - (tag7 A.NameDef DontCare "c" "c" A.VariableName (A.Declaration m (A.List A.Byte) ) A.Abbrev A.Unplaced) + (tag6 A.NameDef DontCare "c" "c" + (A.Declaration m $ A.UnknownVarType $ Left $ simpleName + "c") A.Abbrev A.Unplaced) assertVarDef "testRecordInfNames2" state "d" - (tag7 A.NameDef DontCare "d" "d" A.VariableName (A.Declaration m A.Byte ) A.Abbrev A.Unplaced) - --- | checks that doing a foreach over a non-array type is barred: -testRecordInfNames3 :: Test -testRecordInfNames3 = TestCase $ testPassShouldFail "testRecordInfNames3" (recordInfNameTypes orig) (return ()) - where - orig = A.Rep m (A.ForEach m (simpleName "c") (intLiteral 0)) skipP + (tag6 A.NameDef DontCare "d" "d" + (A.Declaration m $ A.UnknownVarType $ Left $ simpleName + "d") A.Abbrev A.Unplaced) --Easy way to string two passes together; creates a pass-like function that applies the left-hand pass then the right-hand pass. Associative. (>>>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c diff --git a/frontends/RainTypes.hs b/frontends/RainTypes.hs index 01c40b5..14e252e 100644 --- a/frontends/RainTypes.hs +++ b/frontends/RainTypes.hs @@ -141,10 +141,14 @@ recordInfNameTypes = checkDepthM recordInfNameTypes' where recordInfNameTypes' :: Check A.Replicator recordInfNameTypes' input@(A.ForEach m n e) - = do let innerT = A.UnknownVarType $ Left n - defineName n A.NameDef {A.ndMeta = m, A.ndName = A.nameName n, A.ndOrigName = A.nameName n, - A.ndNameType = A.VariableName, A.ndSpecType = (A.Declaration m innerT), - A.ndAbbrevMode = A.Abbrev, A.ndPlacement = A.Unplaced} + = let innerT = A.UnknownVarType $ Left n in + defineName n A.NameDef { A.ndMeta = m + , A.ndName = A.nameName n + , A.ndOrigName = A.nameName n + , A.ndSpecType = A.Declaration m innerT + , A.ndAbbrevMode = A.Abbrev + , A.ndPlacement = A.Unplaced + } recordInfNameTypes' _ = return () markReplicators :: PassType