summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2014-12-22 12:43:58 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2014-12-22 12:43:58 +0000
commiteb4d96e15991d8a03fcbf2385a14dc7e4cb64bcf (patch)
tree0af1e67ba9068c2580f36b4659d55609e495dcb1 /ghc
parentcf0a55d76cf945a97fc229b77d6e6177fb14125d (diff)
downloadhaskell-eb4d96e15991d8a03fcbf2385a14dc7e4cb64bcf.tar.gz
Comments only
Diffstat (limited to 'ghc')
-rw-r--r--ghc/InteractiveUI.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
index 7d6c9ba87f..d478336c36 100644
--- a/ghc/InteractiveUI.hs
+++ b/ghc/InteractiveUI.hs
@@ -876,7 +876,8 @@ enqueueCommands cmds = do
setGHCiState st{ cmdqueue = cmds ++ cmdqueue st }
-- | If we one of these strings prefixes a command, then we treat it as a decl
--- rather than a stmt.
+-- rather than a stmt. NB that the appropriate decl prefixes depends on the
+-- flag settings (Trac #9915)
declPrefixes :: DynFlags -> [String]
declPrefixes dflags = keywords ++ concat opt_keywords
where
@@ -924,6 +925,9 @@ runStmt stmt step
Just result -> afterRunStmt (const True) result
s `looks_like` prefix = prefix `isPrefixOf` dropWhile isSpace s
+ -- Ignore leading spaces (see Trac #9914), so that
+ -- ghci> data T = T
+ -- (note leading spaces) works properly
-- | Clean up the GHCi environment after a statement has run
afterRunStmt :: (SrcSpan -> Bool) -> GHC.RunResult -> GHCi Bool