Ticket #933 (closed bug: fixed)

Opened 5 years ago

Last modified 3 years ago

Separate compilation fails with existential records

Reported by: guest Owned by:
Priority: normal Milestone: 6.6.1
Component: Compiler Version: 6.5
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by simonpj) (diff)

Consider M.hs:

> {-# OPTIONS_GHC -fglasgow-exts #-}
> module M where data D = forall a. C { l :: a }

Then consider Main.hs:

> import M
> main = print () where x = C { l = () }

A normal compilation works:

    $ ghc --make Main.hs
    [1 of 2] Compiling M                ( M.hs, M.o )
    [2 of 2] Compiling Main             ( Main.hs, Main.o )
    Linking Main ...

However, separate compilation does not:

    $ touch Main.hs
    $ ghc --make Main.hs
    [2 of 2] Compiling Main             ( Main.hs, Main.o )

    Main.hs:2:26:
        Constructor `C' does not have field `l'
        In the expression: C {l = ()}
        In the definition of `x': x = C {l = ()}
        In the definition of `main':
            main = print ()
                 where
                     x = C {l = ()}

Where should I start looking to fix this? :-)

Thanks, Audrey

Change History

Changed 5 years ago by simonpj

  • description modified (diff)

Audrey, when you added the "record fields in existentials" feature, you didn't arrange that the info is recorded in interface files.

I discovered and fixed this when cleaning up IfaceSyn? to add FC to GHC; but the fix is only in the HEAD. The patch is not easy to incorporate in the branch, because the FC patch was very big.

Fixing the 6.6 branch is possible, but would mean a change in interface file format, which we strongly discourage between patch-level releases.

So I'm inclined to leave it alone in the branch, and encourage you to try the HEAD.

Changed 5 years ago by guest

Understood. May I commit a doc change to explain that it's a known limitation, not expected to be lifted in the 6.6.x series, then?

Thanks, Audrey

Changed 5 years ago by igloo

  • milestone set to 6.6.1

Documenting this in the 6.6 branch, if not already done, sounds like a good idea.

Changed 5 years ago by igloo

  • status changed from new to closed
  • resolution set to fixed

I've documented this in the 6.6 branch users guide.

Changed 3 years ago by simonmar

  • architecture changed from Unknown to Unknown/Multiple

Changed 3 years ago by simonmar

  • os changed from Unknown to Unknown/Multiple
Note: See TracTickets for help on using tickets.