[GHC] #15621: Error message involving type families points to wrong location

GHC ghc-devs at haskell.org
Sun Sep 9 00:01:44 UTC 2018


#15621: Error message involving type families points to wrong location
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler (Type    |              Version:  8.4.3
  checker)                           |
      Resolution:                    |             Keywords:  TypeFamilies
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Poor/confusing    |  Unknown/Multiple
  error message                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 In particular, applying this change on top of the previous commit
 (d4fa088350913233520ffa7163ef188a63666262) is enough to make the bug
 surface:

 {{{#!diff
 diff --git a/compiler/utils/UniqDFM.hs b/compiler/utils/UniqDFM.hs
 index 10e8aa9..3d4b1d6 100644
 --- a/compiler/utils/UniqDFM.hs
 +++ b/compiler/utils/UniqDFM.hs
 @@ -147,8 +147,13 @@ addToUDFM (UDFM m i) k v =
    UDFM (M.insert (getKey $ getUnique k) (TaggedVal v i) m) (i + 1)

  addToUDFM_Directly :: UniqDFM elt -> Unique -> elt -> UniqDFM elt
 -addToUDFM_Directly (UDFM m i) u v =
 -  UDFM (M.insert (getKey u) (TaggedVal v i) m) (i + 1)
 +addToUDFM_Directly (UDFM m i) u v
 +  = UDFM (M.insertWith tf (getKey u) (TaggedVal v i) m) (i + 1)
 +  where
 +    tf (TaggedVal new_v _) (TaggedVal _ old_i) = TaggedVal new_v old_i
 +      -- Keep the old tag, but insert the new value
 +      -- This means that udfmToList typically returns elements
 +      -- in the order of insertion, rather than the reverse

  addToUDFM_Directly_C
    :: (elt -> elt -> elt) -> UniqDFM elt -> Unique -> elt -> UniqDFM elt
 }}}

 Since that comment mentions that `udfmToList` now returns elements in a
 different order than it did previously, I wonder if there is some code
 which was sensitive to `udfmToList`'s order that wasn't updated
 properly...

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


More information about the ghc-tickets mailing list