[GHC] #11167: Fixity of field-deconstructors incorrect

#11167: Fixity of field-deconstructors incorrect -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.10.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The example below {{{#!hs module Foo where data SomeException newtype ContT r m a = ContT {runContT :: (a -> m r) -> m r} runContT' :: ContT r m a -> (a -> m r) -> m r runContT' = runContT catch_ :: IO a -> (SomeException -> IO a) -> IO a catch_ = undefined -- has type error foo :: IO () foo = (undefined :: ContT () IO a) `runContT` (undefined :: a -> IO ()) `catch_` (undefined :: SomeException -> IO ()) -- typechecks foo' :: IO () foo' = (undefined :: ContT () IO a) `runContT'` (undefined :: a -> IO ()) `catch_` (undefined :: SomeException -> IO ()) }}} works with GHC 7.10 but breaks with GHC HEAD currently with: {{{ foo.hs:15:47: error: • Couldn't match expected type ‘a0 -> IO ()’ with actual type ‘IO ()’ • In the second argument of ‘runContT’, namely ‘(undefined :: a -> IO ()) `catch_` (undefined :: SomeException -> IO ())’ In the expression: runContT (undefined :: ContT () IO a) (undefined :: a -> IO ()) `catch_` (undefined :: SomeException -> IO ()) In an equation for ‘foo’: foo = runContT (undefined :: ContT () IO a) (undefined :: a -> IO ()) `catch_` (undefined :: SomeException -> IO ()) foo.hs:15:48: error: • Couldn't match expected type ‘IO ()’ with actual type ‘a1 -> IO ()’ • In the first argument of ‘catch_’, namely ‘(undefined :: a -> IO ())’ In the second argument of ‘runContT’, namely ‘(undefined :: a -> IO ()) `catch_` (undefined :: SomeException -> IO ())’ In the expression: runContT (undefined :: ContT () IO a) (undefined :: a -> IO ()) `catch_` (undefined :: SomeException -> IO ()) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11167 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11167: Fixity of field-deconstructors incorrect -------------------------------------+------------------------------------- Reporter: hvr | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by hvr): * version: 7.10.2 => 7.11 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11167#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11167: Fixity of field-deconstructors incorrect -------------------------------------+------------------------------------- Reporter: hvr | Owner: kanetw Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by kanetw): * owner: => kanetw -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11167#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11167: Fixity of field-deconstructors incorrect -------------------------------------+------------------------------------- Reporter: hvr | Owner: kanetw Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by kanetw): Duplicate record fields (phab:D761, git:b1884b0e62f62e3c0859515c4137124ab0c9560e) broke this. Currently trying to find what exactly broke it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11167#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11167: Fixity of field-deconstructors incorrect -------------------------------------+------------------------------------- Reporter: hvr | Owner: kanetw Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by hvr): * cc: adamgundry (added) Comment: cc'ing Adam as his patch seems to have caused this regression -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11167#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11167: Fixity of field-deconstructors incorrect -------------------------------------+------------------------------------- Reporter: hvr | Owner: kanetw Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by kanetw): Ok, so the source of the problem lies in RnExpr.hs:`rnExpr (OpApp ...)`, there's a missing case for when we have a record field. But now we've got a problem. We're running this during renaming, so we don't have the corresponding `Id` yet, only a `Name`. If the record field is `Unambiguous`, that's not a problem -- `PostRn Name Name = Name`. But if it's `Ambiguous`, `PostTc Name Name = PlaceHolder`, i.e. we have no way of getting the name. The `Unambiguous` case is easy, and that'd solve this ticket. But we need to deal with the `Ambiguous` case, too. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11167#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11167: Fixity of field-deconstructors incorrect -------------------------------------+------------------------------------- Reporter: hvr | Owner: kanetw Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by kanetw): I see a few possible solutions for the ambig. case: * Warn and default fixity to `defaultFixity = infixl 9` * Disallow infix usage of ambiguous record fields completely (abort with an error). * As long the fixity of each overloaded record is identical, use it. Otherwise do one of the above. I don't like any of these. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11167#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11167: Fixity of field-deconstructors incorrect -------------------------------------+------------------------------------- Reporter: hvr | Owner: kanetw Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by ezyang): Another possibility is if the fixity is ambiguous, allow a user to locally override the fixity (and thus disambiguating), adding some sort of "local fixity" declaration. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11167#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11167: Fixity of field-deconstructors incorrect -------------------------------------+------------------------------------- Reporter: hvr | Owner: kanetw Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by adamgundry): Argh, this is awkward. Thanks for tracking this down. Given the proximity of the RC, I'm inclined not to add a new declaration form for the time being. Rather, my vote would be to use the common fixity if there is one, or fail with an error if there isn't. After all, it isn't possible to declare iduplicate selectors with different fixities in a single module, and for imported ones the user can always disambiguate using the module system. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11167#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11167: Fixity of field-deconstructors incorrect -------------------------------------+------------------------------------- Reporter: hvr | Owner: adamgundry Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * owner: kanetw => adamgundry Comment: I'm puzzled. We only use `Ambiguous` to defer to the type checker if the occurrence is, well, ambiguous. But here it isn't: there is only one `runContT` in scope. Ah: it's because, as kanetw points out, there's a missing case in the `OpApp` case of `rnExpr`. So we could fix that at least, and then this example would work. Let's do that anyway. That will fix the regression. Now we'd only have a problem if (a) we have `-XOverloadedRecordFields` and (b) the selector occurrence really was ambiguous. And then I suppose that the right thing to do is to fail (at least if the fixities differ) saying "Ambiguous fixity for runContT" or something like that. Stuff needs to be fixed in the user manual too, to explain this. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11167#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11167: Fixity of field-deconstructors incorrect -------------------------------------+------------------------------------- Reporter: hvr | Owner: adamgundry Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by kanetw): Adam, are you going to handle this or should I finish? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11167#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11167: Fixity of field-deconstructors incorrect -------------------------------------+------------------------------------- Reporter: hvr | Owner: adamgundry Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by adamgundry): @kanetw since you've made a start, if you're happy to finish this off I'd greatly appreciate it! I'm happy to review, update the user manual or otherwise help out. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11167#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11167: Fixity of field-deconstructors incorrect -------------------------------------+------------------------------------- Reporter: hvr | Owner: kanetw Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by kanetw): * owner: adamgundry => kanetw Comment: Ok, I'll handle it then. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11167#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11167: Fixity of field-deconstructors incorrect -------------------------------------+------------------------------------- Reporter: hvr | Owner: kanetw Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by kanetw): While writing tests I've noticed that infix declarations for record fields are broken (another regression to 7.10.2). I'll make a new ticket for that. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11167#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11167: Fixity of field-deconstructors incorrect -------------------------------------+------------------------------------- Reporter: hvr | Owner: kanetw Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): phab:D1585 Wiki Page: | -------------------------------------+------------------------------------- Changes (by kanetw): * differential: => phab:D1585 Comment: Made a diff. I'll update the user manual later. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11167#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11167: Fixity of field-deconstructors incorrect -------------------------------------+------------------------------------- Reporter: hvr | Owner: kanetw Type: bug | Status: patch Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): phab:D1585 Wiki Page: | -------------------------------------+------------------------------------- Changes (by hvr): * status: new => patch -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11167#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11167: Fixity of field-deconstructors incorrect
-------------------------------------+-------------------------------------
Reporter: hvr | Owner: kanetw
Type: bug | Status: patch
Priority: highest | Milestone: 8.0.1
Component: Compiler | Version: 7.11
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): phab:D1585
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#11167: Fixity of field-deconstructors incorrect -------------------------------------+------------------------------------- Reporter: hvr | Owner: kanetw Type: bug | Status: closed Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): phab:D1585 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11167#comment:17 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11167: Fixity of field-deconstructors incorrect -------------------------------------+------------------------------------- Reporter: hvr | Owner: kanetw Type: bug | Status: closed Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 7.11 Resolution: fixed | Keywords: ORF Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): phab:D1585 Wiki Page: | -------------------------------------+------------------------------------- Changes (by adamgundry): * keywords: => ORF -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11167#comment:18 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC