diff options
author | Bartosz Nitka <niteria@gmail.com> | 2018-03-02 05:33:07 -0800 |
---|---|---|
committer | Bartosz Nitka <niteria@gmail.com> | 2018-03-06 05:56:48 -0800 |
commit | 5bc195a2caddc5c29cf24e9c731dd8d5050f2c66 (patch) | |
tree | 3d0e58f6d1e37052c50938cd2ea9c1888183e7d2 /compiler/coreSyn/CoreSyn.hs | |
parent | ee597e9ec78ceb1a9a208c16dbdeb0b67b4ba5ec (diff) | |
download | haskell-5bc195a2caddc5c29cf24e9c731dd8d5050f2c66.tar.gz |
Allow top level ticked string literals
This reverts f5b275a239d2554c4da0b7621211642bf3b10650
and changes the places that looked for `Lit (MachStr _))`
to use `exprIsMbTickedLitString_maybe` to unwrap ticks as
necessary.
Also updated relevant comments.
Test Plan:
I added 3 new tests that previously reproduced.
GHC HEAD now builds with -g
Reviewers: simonpj, simonmar, bgamari, hvr, goldfire
Subscribers: rwbarton, thomie, carter
GHC Trac Issues: #14779
Differential Revision: https://phabricator.haskell.org/D4470
Diffstat (limited to 'compiler/coreSyn/CoreSyn.hs')
-rw-r--r-- | compiler/coreSyn/CoreSyn.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/coreSyn/CoreSyn.hs b/compiler/coreSyn/CoreSyn.hs index 27a4c99539..2cb8079feb 100644 --- a/compiler/coreSyn/CoreSyn.hs +++ b/compiler/coreSyn/CoreSyn.hs @@ -401,10 +401,10 @@ The solution is simply to allow top-level unlifted binders. We can't allow arbitrary unlifted expression at the top-level though, unlifted binders cannot be thunks, so we just allow string literals. -It is important to note that top-level primitive string literals cannot be -wrapped in Ticks, as is otherwise done with lifted bindings. CoreToStg expects -to see just a plain (Lit (MachStr ...)) expression on the RHS of primitive -string bindings; anything else and things break. CoreLint checks this invariant. +We allow the top-level primitive string literals to be wrapped in Ticks +in the same way they can be wrapped when nested in an expression. +CoreToSTG currently discards Ticks around top-level primitive string literals. +See Trac #14779. Also see Note [Compilation plan for top-level string literals]. @@ -414,7 +414,7 @@ Here is a summary on how top-level string literals are handled by various parts of the compilation pipeline. * In the source language, there is no way to bind a primitive string literal - at the top leve. + at the top level. * In Core, we have a special rule that permits top-level Addr# bindings. See Note [CoreSyn top-level string literals]. Core-to-core passes may introduce |