Missing syntax error for package qualified import with version number
Consider the following test file:
{-# LANGUAGE PackageImports #-}
module Foo where
import "containers-0.5.0.0" Data.Map
where we have
ezyang@sabre:~$ ghc-pkg list | grep containers
containers-0.5.0.0
unordered-containers-0.2.3.0
GHC will fail to compile this, but in an unusual way:
ezyang@sabre:~$ ghc test.hs
[1 of 1] Compiling Foo ( test.hs, test.o )
test.hs:3:1:
Failed to load interface for `Data.Map'
It is not a module in the current program, or in any known package.
That's misleading: the real reason the import failed is because this is a package qualified import (not package ID qualified imports). For my purposes, it would be useful to also support package ID imports, but in the meantime, it would be a good idea to run Cabal's syntax check on the package name, which requires every hyphenated component to contain an alphabetic character.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.8.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler (Parser) |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |