diff --git a/app/Translate.hs b/app/Translate.hs index 3693722..a0d8c34 100644 --- a/app/Translate.hs +++ b/app/Translate.hs @@ -239,7 +239,7 @@ simplifyExp e = case removeParen e of -- Don't convert compose to apply InfixApp _ (QVarOp (UnQual (Symbol "."))) _ -> e InfixApp exp1 op exp2 -> App (App (qOpToExp op) exp1) exp2 - LeftSection e op -> App (qOpToExp op) e + LeftSection exp1 op -> App (qOpToExp op) exp1 x -> x -- TODO Consider putting this logic in a separate "simplifyExpression" function. diff --git a/test/UnitTests.hs b/test/UnitTests.hs index 3b739ab..a93148f 100644 --- a/test/UnitTests.hs +++ b/test/UnitTests.hs @@ -14,8 +14,7 @@ import TranslateCore(syntaxGraphToFglGraph, SyntaxGraph(..), Reference) import Types(SgNamedNode, Edge(..), SyntaxNode(..), IngSyntaxGraph, NodeName(..), LikeApplyFlavor(..), NameAndPort(..)) import qualified GraphAlgorithms -import Util(fromMaybeError, mapFst) -import GraphAlgorithms(collapseNodes) +import Util(fromMaybeError) -- Unit Test Helpers -- @@ -123,6 +122,7 @@ collapseUnitTests = TestList[ -- Translate unit tests +dollarTests :: Test dollarTests = TestList [ TestLabel "dollarTests1" $ assertEqualSyntaxGraphs [ "y = f x", @@ -142,6 +142,7 @@ dollarTests = TestList [ ] ] +composeApplyTests :: Test composeApplyTests = TestList [ TestLabel "composeApplyTests1" $ assertEqualSyntaxGraphs [ "y = f (g x)", @@ -156,6 +157,7 @@ composeApplyTests = TestList [ ] ] +infixTests :: Test infixTests = TestList [ TestLabel "infixTests1" $ assertEqualSyntaxGraphs [ "y = (+) 1 2", @@ -170,6 +172,7 @@ infixTests = TestList [ ] ] +letTests :: Test letTests = TestList [ TestLabel "letTests1" $ assertEqualSyntaxGraphs [ "y = f 1",