summaryrefslogtreecommitdiff
path: root/testsuite/tests/plugins
diff options
context:
space:
mode:
authorSylvain Henry <hsyl20@gmail.com>2018-11-22 11:31:16 -0500
committerBen Gamari <ben@smart-cactus.org>2018-11-22 12:11:15 -0500
commit13bb4bf44e6e690133be334bbf0c63fcae5db34a (patch)
treeee7a9a9f60ca936b16cc15a46c758d4dc51abfd7 /testsuite/tests/plugins
parentf5fbecc85967218fd8ba6512f10eea2daf2812ac (diff)
downloadhaskell-13bb4bf44e6e690133be334bbf0c63fcae5db34a.tar.gz
Rename literal constructors
In a previous patch we replaced some built-in literal constructors (MachInt, MachWord, etc.) with a single LitNumber constructor. In this patch we replace the `Mach` prefix of the remaining constructors with `Lit` for consistency (e.g., LitChar, LitLabel, etc.). Sadly the name `LitString` was already taken for a kind of FastString and it would become misleading to have both `LitStr` (literal constructor renamed after `MachStr`) and `LitString` (FastString variant). Hence this patch renames the FastString variant `PtrString` (which is more accurate) and the literal string constructor now uses the least surprising `LitString` name. Both `Literal` and `LitString/PtrString` have recently seen breaking changes so doing this kind of renaming now shouldn't harm much. Reviewers: hvr, goldfire, bgamari, simonmar, jrtc27, tdammers Subscribers: tdammers, rwbarton, thomie, carter Differential Revision: https://phabricator.haskell.org/D4881
Diffstat (limited to 'testsuite/tests/plugins')
-rw-r--r--testsuite/tests/plugins/HomePackagePlugin.hs2
-rw-r--r--testsuite/tests/plugins/simple-plugin/Simple/Plugin.hs4
2 files changed, 3 insertions, 3 deletions
diff --git a/testsuite/tests/plugins/HomePackagePlugin.hs b/testsuite/tests/plugins/HomePackagePlugin.hs
index 7a6942be6a..7c979c3fb5 100644
--- a/testsuite/tests/plugins/HomePackagePlugin.hs
+++ b/testsuite/tests/plugins/HomePackagePlugin.hs
@@ -20,7 +20,7 @@ replaceInBind (Rec bes) = Rec [(b, replaceInExpr e) | (b, e) <- bes]
replaceInExpr :: CoreExpr -> CoreExpr
replaceInExpr (Var x) = Var x
-replaceInExpr (Lit (MachStr _)) = mkStringLit "Hello From The Plugin" -- The payload
+replaceInExpr (Lit (LitString _)) = mkStringLit "Hello From The Plugin" -- The payload
replaceInExpr (Lit l) = Lit l
replaceInExpr (Lam b e) = Lam b (replaceInExpr e)
replaceInExpr (App e1 e2) = App (replaceInExpr e1) (replaceInExpr e2)
diff --git a/testsuite/tests/plugins/simple-plugin/Simple/Plugin.hs b/testsuite/tests/plugins/simple-plugin/Simple/Plugin.hs
index 94cb74b151..9c0fdcbb5a 100644
--- a/testsuite/tests/plugins/simple-plugin/Simple/Plugin.hs
+++ b/testsuite/tests/plugins/simple-plugin/Simple/Plugin.hs
@@ -67,11 +67,11 @@ changeBindPr anns mb_replacement b e = do
changeExpr :: UniqFM [ReplaceWith] -> Maybe String -> CoreExpr -> CoreM CoreExpr
changeExpr anns mb_replacement e = let go = changeExpr anns mb_replacement in case e of
- Lit (MachStr _) -> case mb_replacement of
+ Lit (LitString _) -> case mb_replacement of
Nothing -> return e
Just replacement -> do
putMsgS "Performing Replacement"
- return $ Lit (MachStr (fastStringToByteString (mkFastString replacement)))
+ return $ Lit (LitString (fastStringToByteString (mkFastString replacement)))
App e1 e2 -> liftM2 App (go e1) (go e2)
Lam b e -> liftM (Lam b) (go e)
Let bind e -> liftM2 Let (changeBind anns mb_replacement bind) (go e)