[GHC] #10077: Providing type checker plugin on command line results in false cyclic import error

GHC ghc-devs at haskell.org
Sat Jun 18 13:40:14 UTC 2016


#10077: Providing type checker plugin on command line results in false cyclic
import error
-------------------------------------+-------------------------------------
        Reporter:  jbracker          |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  7.11
  checker)                           |             Keywords:  typechecker
      Resolution:                    |  plugin cycle imports
Operating System:  Linux             |         Architecture:  x86_64
 Type of failure:  Incorrect         |  (amd64)
  warning at compile-time            |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by osa1):

 Sorry if I'm missing anything, but I don't think this makes sense and it's
 not
 arguable that this is correct behaviour. First, there's no loop here. `M`
 uses
 `P`, but `P` doesn't import `M`. It should just work no matter what.

 Second, say there's a loop: `M` uses `P` and `P` imports `M`. Then I think
 we
 _should_ just stop the compilation with the error message currently being
 printed. The reason is because a Core plugin can generate arbitrary code,
 so
 while ignoring the plugin when compiling `M` may be OK, we can't know in
 general
 that this will work (e.g. when the library relies on code generated by the
 plugin). So maybe we have an excuse here and bailing out is just OK.

 Also, `-fplugin` is a flag, so it can be handled by a build system. So if
 someone wants to "boot" `P` with `M` compiled using the plugin itself,
 maybe
 they should do this:

 1. Build `M` without `P` (build system doesn't use `-fplugin`)
 2. Build `P` with `M` built in step (1)
 3. Build `M` again, this time with `P` (build system uses `-fplugin`)
 4. Build `P` again, using `M` built in step (3)

 What do you think? Does that sound reasonable?

 I want to fix this at least for the non-recursive case but I don't know
 anything
 about this code so it may take some time.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10077#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list