projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fb65975
)
Fix parsing constructors containing dots; fixes trac #4891
author
Ian Lynagh
<igloo@earth.li>
Sun, 3 Apr 2011 14:23:38 +0000
(15:23 +0100)
committer
Ian Lynagh
<igloo@earth.li>
Sun, 3 Apr 2011 14:23:38 +0000
(15:23 +0100)
compiler/ghci/Linker.lhs
patch
|
blob
|
history
diff --git
a/compiler/ghci/Linker.lhs
b/compiler/ghci/Linker.lhs
index
bd0bb35
..
eaf4521
100644
(file)
--- a/
compiler/ghci/Linker.lhs
+++ b/
compiler/ghci/Linker.lhs
@@
-245,11
+245,18
@@
dataConInfoPtrToName x = do
where
(modWords, occWord) = ASSERT (length rest1 > 0) (parseModOcc [] (tail rest1))
parseModOcc :: [[Word8]] -> [Word8] -> ([[Word8]], [Word8])
where
(modWords, occWord) = ASSERT (length rest1 > 0) (parseModOcc [] (tail rest1))
parseModOcc :: [[Word8]] -> [Word8] -> ([[Word8]], [Word8])
- parseModOcc acc str
+ -- We only look for dots if str could start with a module name,
+ -- i.e. if it starts with an upper case character.
+ -- Otherwise we might think that "X.:->" is the module name in
+ -- "X.:->.+", whereas actually "X" is the module name and
+ -- ":->.+" is a constructor name.
+ parseModOcc acc str@(c : _)
+ | isUpper $ chr $ fromIntegral c
= case break (== dot) str of
(top, []) -> (acc, top)
= case break (== dot) str of
(top, []) -> (acc, top)
- (top, _:bot) -> parseModOcc (top : acc) bot
-
+ (top, _ : bot) -> parseModOcc (top : acc) bot
+ parseModOcc acc str = (acc, str)
+
-- | Get the 'HValue' associated with the given name.
--
-- May cause loading the module that contains the name.
-- | Get the 'HValue' associated with the given name.
--
-- May cause loading the module that contains the name.