ghc --make and ghci misses dependencies with explicit braces
Karl Crary tripped over this deeply strange case:
Bar.hs
module Bar where
bar = True
Main.hs
{ import Bar; main = print bar }
Notice that Main.hs is missing its "module Main where" part, but has explicit braces and semicolons. The BNF in the language standard says that is fine.
If you compile them one at a time all is well:
ghc -c Bar.hs
ghc -c Main.hs
But if you use --make it breaks:
simonpj@cam-04-unx:~/tmp$ ghc --make Main -ddump-parsed -ddump-rn
[1 of 1] Compiling Main ( Main.hs, Main.o )
==================== Parser ====================
import Bar
main = print foo
Main.hs:1:29: Not in scope: `foo'
Bizarre, eh? This is ghc 7.0.3. It's as if --make somehow ignores the import of Bar, even though it is parsed just fine.
Simon
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.0.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | high |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | crary@cs.cmu.edu |
| Operating system | |
| Architecture |