[GHC] #16261: Mysterious rule shadowing warning

GHC ghc-devs at haskell.org
Thu Jan 31 09:42:12 UTC 2019


#16261: Mysterious rule shadowing warning
-------------------------------------+-------------------------------------
           Reporter:  dfeuer         |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.10.1
          Component:  Compiler       |           Version:  8.6.3
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  Incorrect
  Unknown/Multiple                   |  error/warning at compile-time
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Compiling `Data.Set.Internal` produces the following:

 {{{
 Data/Set/Internal.hs:958:11: warning: [-Winline-rule-shadowing]
     Rule "Set.toAscListBack" may never fire
       because rule "Class op fromListN" for ‘GHCExts.fromListN’ might fire
 first
     Probable fix: add phase [n] or [~n] to the competing rule
     |
 958 | {-# RULES "Set.toAscListBack" [1] foldrFB (:) [] = toAscList #-}
     |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

 Data/Set/Internal.hs:960:11: warning: [-Winline-rule-shadowing]
     Rule "Set.toDescListBack" may never fire
       because rule "Class op fromListN" for ‘GHCExts.fromListN’ might fire
 first
     Probable fix: add phase [n] or [~n] to the competing rule
     |
 960 | {-# RULES "Set.toDescListBack" [1] foldlFB (\xs x -> x : xs) [] =
 toDescList #-}
     |
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 }}}

 What the heck does the class op rule for `fromListN` have to do with
 anything anywhere near here?

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


More information about the ghc-tickets mailing list