Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#1072 closed bug (fixed)

Core Lint Errors: in result of Desugar

Reported by: guest Owned by: simonpj
Priority: normal Milestone: 6.8.2
Component: Compiler Version: 6.7
Keywords: Cc:
Operating System: Windows Architecture: x86
Type of failure: None/Unknown Test Case: tc239
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description (last modified by simonpj)

This error happens with ghc --make, so two source files are attached. To reproduce the error:

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

G:\>cd ghcError

G:\ghcError>ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.6

G:\ghcError>ghc -dcore-lint --make Main.hs
[1 of 2] Compiling WrapIOMonad      ( WrapIOMonad.hs, WrapIOMonad.o )
[2 of 2] Compiling Main             ( Main.hs, Main.o )
*** Core Lint Errors: in result of Desugar ***
{-# LINE 11 "Main.hs #-}:
    [RHS of f2_aGA :: WrapIOMonad.WrapIO2 a_aGz]
    The type of this binder doesn't match the type of its RHS: f2_aGA
    Binder's type: WrapIOMonad.WrapIO2 a_aGz
    Rhs type: WrapIOMonad.WrapIO GHC.Base.String a_aGz
*** Offending Program ***
Rec {
:Main.main :: GHC.IOBase.IO ()
:Main.main = GHC.TopHandler.runMainIO @ () Main.main
Main.main :: GHC.IOBase.IO ()
Main.main = GHC.Err.undefined @ (GHC.IOBase.IO ())
main_aGK :: GHC.IOBase.IO ()
main_aGK = Main.main
Main.f2 :: forall a_aB9. (GHC.Show.Show a_aB9) => WrapIOMonad.WrapIO2 a_aB9
Main.f2 =
  \ (@ a_aGz) ($dShow_aGD :: {GHC.Show.Show a_aGz}) ->
    __letrec {
      f2_aGA :: WrapIOMonad.WrapIO2 a_aGz
      f2_aGA = f1_aGB;
      $dShow_aGI :: {GHC.Show.Show a_aGz}
      $dShow_aGI = $dShow_aGD;
      f1_aGB :: WrapIOMonad.WrapIO GHC.Base.String a_aGz
      f1_aGB = Main.f1 @ a_aGz @ GHC.Base.String $dShow_aGI;
    } in  f2_aGA
Main.f1 :: forall a_aBb e_aBc.
           (GHC.Show.Show a_aBb) =>
           WrapIOMonad.WrapIO e_aBc a_aBb
Main.f1 =
  \ (@ a_aGf) (@ e_aGg) ($dShow_aGq :: {GHC.Show.Show a_aGf}) ->
    __letrec {
      f1_aGh :: WrapIOMonad.WrapIO e_aGg a_aGf
      f1_aGh = return_aGm @ a_aGf (GHC.Err.undefined @ a_aGf);
      $dMonad_aGv :: {GHC.Base.Monad (WrapIOMonad.WrapIO e_aGg)}
      $dMonad_aGv = WrapIOMonad.$f1 @ e_aGg;
      return_aGm :: forall a_awE. a_awE -> WrapIOMonad.WrapIO e_aGg a_awE
      return_aGm = GHC.Base.return @ (WrapIOMonad.WrapIO e_aGg) $dMonad_aGv;
    } in  f1_aGh
end Rec }

*** End of Offense ***

<no location info>:
Compilation had errors

Attachments (2)

Main.hs (149 bytes) - added by guest 13 years ago.
WrapIOMonad.hs (318 bytes) - added by guest 13 years ago.

Download all attachments as: .zip

Change History (7)

Changed 13 years ago by guest

Attachment: Main.hs added

Changed 13 years ago by guest

Attachment: WrapIOMonad.hs added

comment:1 Changed 13 years ago by simonpj

Description: modified (diff)

comment:2 Changed 13 years ago by simonpj

Owner: set to simonpj
severity: normalminor
Version: 6.66.7

Excellent example. This is the same problem as the failure in maessen_hashtab. It's also closely related to #930

Here's what is happening (mainly notes to me). The newtype for WrapIOMonad is getting "trimmed" by TidyPgm; but occurrences of WrapIOMonad in the types of Ids are *not* trimmed. Then when we compare types, the comparing function (Type.coreEqType) looks through the newtype on one side but not the other.

I've made a temporary solution for GHC 6.6, by making coreEqType first expand synonyms and notes, then look for equal TyCons, then expand newtypes. But it's a hack, and can be fooled (by nested newtypes, for example). The hack is enough to make this program work, however.

The HEAD has a different solution: do not make newtypes transparent at all. I think that works ok, but I'm still uneasy about the fact that a given TyCon can appear in two different forms in the same compilation. So I'm going to leave this open, but at low priority.

comment:3 Changed 13 years ago by igloo

Milestone: 6.8

comment:4 Changed 12 years ago by simonpj

Resolution: fixed
Status: newclosed
Test Case: tc239

I'm closing this, since it works fine now, but adding a test (tc239) so we'll know if it pops up again.


comment:5 Changed 12 years ago by igloo

Milestone: 6.8 branch6.8.2
Note: See TracTickets for help on using tickets.