[GHC] #13251: Must perform family consistency check on non-imported identifiers
GHC
ghc-devs at haskell.org
Thu Feb 9 16:16:25 UTC 2017
#13251: Must perform family consistency check on non-imported identifiers
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler (Type | Version: 8.1
checker) |
Resolution: | Keywords: TypeFamilies
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC accepts | Unknown/Multiple
invalid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by rwbarton):
Not thoroughly thought out, but how about in `checkWiredInTyCon` (or
something which wraps it) and in `tcLookupGlobal`, we check whether the
thing lives in a module that was actually imported and, if not, add the
relevant import information to `tcg_imports`, and either do the ensuing
type family consistency checks immediately, or perhaps add them to
`tcg_pending_fam_checks`?
I mean, we also have this behavior:
{{{#!hs
{-# LANGUAGE TemplateHaskell #-}
import Language.Haskell.TH.Syntax
main = print $( return (VarE (Name (OccName "sigFPE")
(NameG VarName (PkgName "unix-2.7.0.1")
(ModName "System.Posix.Signals")))) )
}}}
{{{
rwbarton at morphism:~/ghc2$ ghc x/TH -fforce-recomp
[1 of 1] Compiling Main ( x/TH.hs, x/TH.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.5.0.0 ... linking ... done.
Loading package deepseq-1.3.0.2 ... linking ... done.
Loading package containers-0.5.5.1 ... linking ... done.
Loading package pretty-1.1.1.1 ... linking ... done.
Loading package template-haskell ... linking ... done.
Linking x/TH ...
x/TH.o:(.text+0x4b): undefined reference to
`unixzm2zi7zi0zi1_SystemziPosixziSignals_sigFPE_closure'
x/TH.o: In function `S4hM_srt':
(.data+0x48): undefined reference to
`unixzm2zi7zi0zi1_SystemziPosixziSignals_sigFPE_closure'
collect2: error: ld returned 1 exit status
}}}
If we updated the `ImportAvails` when we type checked the spliced thing,
wouldn't that also create a dependency on the `unix` package at link time?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13251#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list