[GHC] #8215: Out of scope with `-dcore-lint` and derived instances in GHCi

GHC ghc-devs at haskell.org
Mon Sep 2 16:48:42 CEST 2013


#8215: Out of scope with `-dcore-lint` and derived instances in GHCi
------------------------------------+-------------------------------------
       Reporter:  nomeata           |             Owner:
           Type:  bug               |            Status:  new
       Priority:  normal            |         Milestone:
      Component:  Compiler          |           Version:  7.6.3
       Keywords:                    |  Operating System:  Unknown/Multiple
   Architecture:  Unknown/Multiple  |   Type of failure:  None/Unknown
     Difficulty:  Unknown           |         Test Case:
     Blocked By:                    |          Blocking:
Related Tickets:                    |
------------------------------------+-------------------------------------
 At revision 9e2e84e01cbf2bc1da1fc7260709f63687206d76 (current HEAD), I
 observe this failure:

 {{{
 $ ./inplace/bin/ghc-stage2 --interactive
 GHCi, version 7.7.20130902: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 Prelude> newtype Age = Age Int deriving Show
 Prelude> newtype Bar = Bar Age deriving Show
 Prelude> Bar (Age 1))

 <interactive>:4:12: parse error on input `)'
 Prelude> Bar (Age 1)
 Bar (Age 1)
 Prelude>
 Leaving GHCi.
 [jojo at kirk:3] Mo, der 02.09.2013 um 16:47 Uhr Keep Smiling :-)
 ~/build/haskell/ghc $ ./inplace/bin/ghc-stage2 --interactive -dcore-lint
 GHCi, version 7.7.20130902: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 Prelude> newtype Age = Age Int deriving Show
 Prelude> newtype Bar = Bar Age deriving Show
 *** Core Lint errors : in result of Desugar (after optimization) ***
 <no location info>: Warning:
     In the expression: GHC.Show.showsPrec
                          @ :Interactive.Age
                          :Interactive.$fShowAge
                          (GHC.Types.I# 11)
                          (ds_dq3
                           `cast` (:Interactive.NTCo:Bar[0]
                                   :: :Interactive.Bar ~#
 :Interactive.Age))
     :Interactive.$fShowAge :: GHC.Show.Show :Interactive.Age
     [LclIdX[DFunId], Str=DmdType] is out of scope
 *** Offending Program ***
 Rec {
 $cshowsPrec_apH
   :: GHC.Types.Int -> :Interactive.Bar -> GHC.Show.ShowS
 [LclId, Str=DmdType]
 $cshowsPrec_apH =
   \ (a_apF :: GHC.Types.Int) (ds_dq3 :: :Interactive.Bar) ->
     GHC.Show.showParen
       (GHC.Classes.>=
          @ GHC.Types.Int GHC.Classes.$fOrdInt a_apF (GHC.Types.I# 11))
       (GHC.Base..
          @ GHC.Base.String
          @ GHC.Base.String
          @ GHC.Base.String
          (GHC.Show.showString (GHC.CString.unpackCString# "Bar "#))
          (GHC.Show.showsPrec
             @ :Interactive.Age
             :Interactive.$fShowAge
             (GHC.Types.I# 11)
             (ds_dq3
              `cast` (:Interactive.NTCo:Bar[0]
                      :: :Interactive.Bar ~# :Interactive.Age))))

 :Interactive.$fShowBar [InlPrag=[ALWAYS] CONLIKE]
   :: GHC.Show.Show :Interactive.Bar
 [LclIdX[DFunId],
  Str=DmdType,
  Unf=DFun: \ ->
        GHC.Show.D:Show TYPE :Interactive.Bar
                        $cshowsPrec_apH
                        $cshow_apS
                        $cshowList_apU]
 :Interactive.$fShowBar =
   GHC.Show.D:Show
     @ :Interactive.Bar $cshowsPrec_apH $cshow_apS $cshowList_apU

 $cshowList_apU [Occ=LoopBreaker]
   :: [:Interactive.Bar] -> GHC.Show.ShowS
 [LclId, Str=DmdType]
 $cshowList_apU =
   GHC.Show.showList__
     @ :Interactive.Bar
     (GHC.Show.showsPrec
        @ :Interactive.Bar :Interactive.$fShowBar (GHC.Types.I# 0))

 $cshow_apS [Occ=LoopBreaker] :: :Interactive.Bar -> GHC.Base.String
 [LclId, Str=DmdType]
 $cshow_apS =
   GHC.Show.$dmshow @ :Interactive.Bar :Interactive.$fShowBar
 end Rec }

 *** End of Offense ***


 <no location info>:
 Compilation had errors


 *** Exception: ExitFailure 1
 }}}

 I do not observe this in GHC.

 I’ll write a test case for this.

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




More information about the ghc-tickets mailing list