[GHC] #11224: Program doesn't preserve semantics after pattern synonym inlining.

GHC ghc-devs at haskell.org
Fri Jun 23 17:07:48 UTC 2017


#11224: Program doesn't preserve semantics after pattern synonym inlining.
-------------------------------------+-------------------------------------
        Reporter:  anton.dubovik     |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  highest           |            Milestone:  8.0.1
       Component:  Compiler          |              Version:  7.10.2
      Resolution:  fixed             |             Keywords:
                                     |  PatternSynonyms
Operating System:  Windows           |         Architecture:  x86_64
                                     |  (amd64)
 Type of failure:  Incorrect result  |            Test Case:
  at runtime                         |  patsyn/should_run/T11224
      Blocked By:                    |             Blocking:
 Related Tickets:  #11225            |  Differential Rev(s):  Phab:D1632
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Ben Gamari <ben@…>):

 In [changeset:"9077120918b78f5152bf3596fe6df07b91cead79/ghc"
 90771209/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="9077120918b78f5152bf3596fe6df07b91cead79"
 Use actual universal tvs in check for naughty record selectors

 The naughty record selector check means to limit selectors which would
 lead to existential tyvars escaping their scope. With record pattern
 synonyms, there are situations where universal tyvars don't appear in
 the result type, for example:

 ```
 pattern ReadP :: Read a => a -> String
 pattern ReadP{readp} <- (read -> readp)
 ```

 This is a similar issue to #11224 where we assumed that we can decide
 which variables are universal and which are existential by the syntactic
 check of seeing which appear in the result type. The fix is to use
 `univ_tvs` from `conLikeFullSig` rather than the previous approximation.
 But we must also remember to apply `EqSpec`s so we use the free
 variables from `inst_tys` which is precisely `univ_tvs` with `EqSpecs`
 applied.

 Reviewers: austin, bgamari

 Reviewed By: bgamari

 Subscribers: rwbarton, thomie

 Differential Revision: https://phabricator.haskell.org/D3649
 }}}

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


More information about the ghc-tickets mailing list