diff --git a/frontends/OccamPassesTest.hs b/frontends/OccamPassesTest.hs index 6052855..dfa046e 100644 --- a/frontends/OccamPassesTest.hs +++ b/frontends/OccamPassesTest.hs @@ -30,8 +30,8 @@ import qualified AST as A import CompState import Metadata import qualified OccamPasses +import Pass import TestUtils -import Types m :: Meta m = emptyMeta @@ -89,7 +89,9 @@ testFoldConstants = TestList , test 48 (add var (add const one)) (add var three) ] where - test :: Data a => Int -> a -> a -> Test + test :: (PolyplateM a (TwoOpM PassM A.Expression A.Specification) () PassM + ,PolyplateM a () (TwoOpM PassM A.Expression A.Specification) PassM + ,Data a) => Int -> a -> a -> Test test n orig exp = TestCase $ testPass ("testFoldConstants" ++ show n) exp OccamPasses.foldConstants orig startState @@ -136,13 +138,16 @@ testCheckConstants = TestList , testFail 33 (A.Option m [lit10, lit10, lit10, var] skip) ] where - testOK :: (Show a, Data a) => Int -> a -> Test + testOK :: (PolyplateM a (TwoOpM PassM A.Dimension A.Option) () PassM + ,PolyplateM a () (TwoOpM PassM A.Dimension A.Option) PassM + ,Show a, Data a) => Int -> a -> Test testOK n orig = TestCase $ testPass ("testCheckConstants" ++ show n) orig OccamPasses.checkConstants orig (return ()) - - testFail :: (Show a, Data a) => Int -> a -> Test + testFail :: (PolyplateM a (TwoOpM PassM A.Dimension A.Option) () PassM + ,PolyplateM a () (TwoOpM PassM A.Dimension A.Option) PassM + ,Show a, Data a) => Int -> a -> Test testFail n orig = TestCase $ testPassShouldFail ("testCheckConstants" ++ show n) OccamPasses.checkConstants orig diff --git a/frontends/OccamTypesTest.hs b/frontends/OccamTypesTest.hs index 3cd4884..b25dacf 100644 --- a/frontends/OccamTypesTest.hs +++ b/frontends/OccamTypesTest.hs @@ -29,8 +29,10 @@ import qualified AST as A import CompState import Metadata import qualified OccamTypes +import Pass import TestHarness import TestUtils +import Traversal m :: Meta m = emptyMeta @@ -500,13 +502,21 @@ testOccamTypes = TestList --}}} ] where - testOK :: (Show a, Data a) => Int -> a -> Test + testOK :: (PolyplateSpine a (OneOpQ (PassM ()) A.Variable) () (PassM ()) + ,PolyplateSpine a (OneOpQ (PassM ()) A.Expression) () (PassM ()) + ,PolyplateSpine a (OneOpQ (PassM ()) A.SpecType) () (PassM ()) + ,PolyplateSpine a (OneOpQ (PassM ()) A.Process) () (PassM ()) + ,Show a, Data a) => Int -> a -> Test testOK n orig = TestCase $ testPass ("testOccamTypes " ++ show n) orig OccamTypes.checkTypes orig startState - testFail :: (Show a, Data a) => Int -> a -> Test + testFail :: (PolyplateSpine a (OneOpQ (PassM ()) A.Variable) () (PassM ()) + ,PolyplateSpine a (OneOpQ (PassM ()) A.Expression) () (PassM ()) + ,PolyplateSpine a (OneOpQ (PassM ()) A.SpecType) () (PassM ()) + ,PolyplateSpine a (OneOpQ (PassM ()) A.Process) () (PassM ()) + ,Show a, Data a) => Int -> a -> Test testFail n orig = TestCase $ testPassShouldFail ("testOccamTypes " ++ show n) OccamTypes.checkTypes orig diff --git a/frontends/RainPassesTest.hs b/frontends/RainPassesTest.hs index b838b67..030b83e 100644 --- a/frontends/RainPassesTest.hs +++ b/frontends/RainPassesTest.hs @@ -218,7 +218,7 @@ testUnique4 = TestCase $ testPassWithItemsStateCheck "testUnique4" exp uniquifyA --Easy way to string two passes together; creates a pass-like function that applies the left-hand pass then the right-hand pass. Associative. -(>>>) :: Pass -> Pass -> Pass +(>>>) :: Pass t -> Pass t -> Pass t (>>>) f0 f1 = Pass {passCode = passCode f1 <.< passCode f0} --Normally, process names in Rain are not mangled. And this should be fine in all cases - but not for the main process (which would diff --git a/transformations/SimplifyAbbrevsTest.hs b/transformations/SimplifyAbbrevsTest.hs index e9132b4..4f44cb2 100644 --- a/transformations/SimplifyAbbrevsTest.hs +++ b/transformations/SimplifyAbbrevsTest.hs @@ -26,10 +26,12 @@ import Test.HUnit hiding (State) import CompState import qualified AST as A import Metadata +import Pass import Pattern import SimplifyAbbrevs import TagAST import TestUtils +import Traversal import TreeUtils m :: Meta @@ -92,7 +94,9 @@ testRemoveInitial = TestLabel "testRemoveInitial" $ TestList inner) ] where - ok :: (Data a, Data b) => Int -> a -> b -> Test + ok :: (PolyplateM a (ExtOpMSP BaseOp) () PassM + ,PolyplateM a () (ExtOpMSP BaseOp) PassM + ,Data a, Data b) => Int -> a -> b -> Test ok n inp exp = TestCase $ testPass ("testRemoveInitial" ++ show n) exp removeInitial inp setupState @@ -148,7 +152,8 @@ testRemoveResult = TestLabel "testRemoveResult" $ TestList (A.Formal A.Abbrev A.Int foo) ] where - ok :: (Data a, Data b) => Int -> a -> b -> Test + ok :: (Polyplate a (OneOp A.AbbrevMode) () + ,Data a, Data b) => Int -> a -> b -> Test ok n inp exp = TestCase $ testPass ("testRemoveResult" ++ show n) exp removeResult inp setupState diff --git a/transformations/SimplifyTypesTest.hs b/transformations/SimplifyTypesTest.hs index 4316ded..a5db62e 100644 --- a/transformations/SimplifyTypesTest.hs +++ b/transformations/SimplifyTypesTest.hs @@ -26,10 +26,12 @@ import Test.HUnit hiding (State) import CompState import qualified AST as A import Metadata +import Pass import Pattern import SimplifyTypes import TagAST import TestUtils +import Traversal import TreeUtils m :: Meta @@ -49,7 +51,9 @@ testResolveNamedTypes = TestLabel "testResolveNamedTypes" $ TestList (array10 A.Int) ] where - ok :: (Data a, Data b) => Int -> a -> b -> Test + ok :: (PolyplateM a (OneOpM PassM A.Type) () PassM + ,PolyplateM a () (OneOpM PassM A.Type) PassM + ,Data a, Data b) => Int -> a -> b -> Test ok n inp exp = TestCase $ testPass ("testResolveNamedTypes" ++ show n) exp resolveNamedTypes inp setupState