[GHC] #9023: Error when using empty record update on binary pattern synonym

#9023: Error when using empty record update on binary pattern synonym --------------------------------+--------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Keywords: | Operating System: Linux Architecture: x86 | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | --------------------------------+--------------------------------- Using an empty record update with patterns works here {{{ pattern Singleton a = [a] isSingleton :: [a] -> Bool isSingleton Singleton{} = True isSingleton _ = False }}} but fails in the follow example (there may exist a more minimal example) {{{ pattern P a b = Just (a, b) foo P{} = True }}} which outputs (GHC 7.8.2) {{{ $ ghci -ignore-dot-ghci tmp.g2WZtTUkhJ.hs GHCi, version 7.8.2: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. [1 of 1] Compiling Main ( tmp.g2WZtTUkhJ.hs, interpreted ) Var/Type length mismatch: [t{tv aIW} [sk]] [] Ok, modules loaded: Main. *Main> }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9023 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9023: Error when using empty record update on binary pattern synonym ---------------------------------+--------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Linux | Architecture: x86 Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ---------------------------------+--------------------------- Changes (by archblob): * status: new => patch Comment: This is actually not an error, just a {{{pprTrace}}} that I think was left there accidentally. Everything actually type-checks and works. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9023#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9023: Error when using empty record update on binary pattern synonym ---------------------------------+--------------------------- Reporter: Iceland_jack | Owner: cactus Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Linux | Architecture: x86 Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ---------------------------------+--------------------------- Changes (by simonpj): * cc: cactus (added) * owner: => cactus Comment: Let's not remove the trace. It signals that something quite unexpected is happening ,which should be investigated. Gergo: could you look at why this is happening, since it involves pattern synonyms? Yell if you get stuck and need help from me. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9023#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9023: Error when using empty record update on binary pattern synonym ---------------------------------+--------------------------- Reporter: Iceland_jack | Owner: cactus Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Linux | Architecture: x86 Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ---------------------------------+--------------------------- Comment (by archblob): I was pretty uncomfortable doing that and wondered if something else was going on but I removed it because the caller also tests for the length mismatch and prints pretty much the same message if debug flags is set. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9023#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9023: Error when using empty record update on binary pattern synonym ---------------------------------+--------------------------- Reporter: Iceland_jack | Owner: cactus Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Linux | Architecture: x86 Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ---------------------------------+--------------------------- Comment (by archblob): I had no idea assertions were enabled only {{{-DDEBUG}}}, lesson learned. Here is the actual panic: {{{ ghc-stage2: panic! (the 'impossible' happened) (GHC version 7.9.20140530 for x86_64-unknown-linux): ASSERT failed! file compiler/basicTypes/PatSyn.lhs line 268 patSynInstArgTys P [t, t] [(t, t)] }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9023#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9023: Error when using empty record update on binary pattern synonym ---------------------------------+--------------------------- Reporter: Iceland_jack | Owner: cactus Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Linux | Architecture: x86 Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ---------------------------------+--------------------------- Comment (by archblob): I'm sorry for hijacking this thread again but I'm trying to understand all of this stuff and tinkering with it does it best for me. As I understand it, {{{tcTyConAppArgs}}} will look through synonyms but not through newtypes. The thing is it will also not get us the args we want in the case of nested application, so in this case for tuples, but the bug will manifest itself for any nested application. I've attached a patch with a new fix and I'm wondering if you can take a look at it. The fix works for this test case but there may be things that i overlooked. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9023#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9023: Error when using empty record update on binary pattern synonym
---------------------------------+---------------------------
Reporter: Iceland_jack | Owner: cactus
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 7.8.2
Resolution: | Keywords:
Operating System: Linux | Architecture: x86
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
---------------------------------+---------------------------
Comment (by Simon Peyton Jones

#9023: Error when using empty record update on binary pattern synonym ------------------------------------------------+-------------------------- Reporter: Iceland_jack | Owner: cactus Type: bug | Status: merge Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Linux | Architecture: x86 Type of failure: None/Unknown | Difficulty: Test Case: patsyn/should_compile/T9023 | Unknown Blocking: | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Changes (by simonpj): * status: patch => merge * testcase: => patsyn/should_compile/T9023 Comment: archblob: you successfully provoked me into looking into this, but your patch was I'm afraid utterly wrong! The `[Type]` argument to `patSynInstArgTys` is positional: the order of the types in that list matters a lot! Moreover we need the instantiating types, not the free variables of the instantiating types. So if it worked for you it was a fluke. But don't be discouraged! There is plenty more to do. Austin: worth merging this to 7.8.3. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9023#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9023: Error when using empty record update on binary pattern synonym
------------------------------------------------+--------------------------
Reporter: Iceland_jack | Owner: cactus
Type: bug | Status: merge
Priority: normal | Milestone:
Component: Compiler | Version: 7.8.2
Resolution: | Keywords:
Operating System: Linux | Architecture: x86
Type of failure: None/Unknown | Difficulty:
Test Case: patsyn/should_compile/T9023 | Unknown
Blocking: | Blocked By:
| Related Tickets:
------------------------------------------------+--------------------------
Comment (by Simon Peyton Jones

#9023: Error when using empty record update on binary pattern synonym ------------------------------------------------+-------------------------- Reporter: Iceland_jack | Owner: cactus Type: bug | Status: merge Priority: normal | Milestone: 7.8.3 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Linux | Architecture: x86 Type of failure: None/Unknown | Difficulty: Test Case: patsyn/should_compile/T9023 | Unknown Blocking: | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Changes (by simonpj): * milestone: => 7.8.3 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9023#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9023: Error when using empty record update on binary pattern synonym ------------------------------------------------+-------------------------- Reporter: Iceland_jack | Owner: cactus Type: bug | Status: merge Priority: normal | Milestone: 7.8.3 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Linux | Architecture: x86 Type of failure: None/Unknown | Difficulty: Test Case: patsyn/should_compile/T9023 | Unknown Blocking: | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by thoughtpolice): I had a merge conflict while merging this - looking into it... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9023#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9023: Error when using empty record update on binary pattern synonym ------------------------------------------------+-------------------------- Reporter: Iceland_jack | Owner: cactus Type: bug | Status: merge Priority: normal | Milestone: 7.8.3 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Linux | Architecture: x86 Type of failure: None/Unknown | Difficulty: Test Case: patsyn/should_compile/T9023 | Unknown Blocking: | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by cactus): After fixing the conflicts, I've pushed a version on top of `ghc-7.8` as `wip/T9023`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9023#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9023: Error when using empty record update on binary pattern synonym ------------------------------------------------+-------------------------- Reporter: Iceland_jack | Owner: cactus Type: bug | Status: closed Priority: normal | Milestone: 7.8.3 Component: Compiler | Version: 7.8.2 Resolution: fixed | Keywords: Operating System: Linux | Architecture: x86 Type of failure: None/Unknown | Difficulty: Test Case: patsyn/should_compile/T9023 | Unknown Blocking: | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Changes (by thoughtpolice): * status: merge => closed * resolution: => fixed Comment: Thanks Gergo, I've merged this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9023#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9023: Error when using empty record update on binary pattern synonym ------------------------------------------------+-------------------------- Reporter: Iceland_jack | Owner: cactus Type: bug | Status: closed Priority: normal | Milestone: 7.10.1 Component: Compiler | Version: 7.8.2 Resolution: fixed | Keywords: Operating System: Linux | Architecture: x86 Type of failure: None/Unknown | Difficulty: Test Case: patsyn/should_compile/T9023 | Unknown Blocking: | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Changes (by thoughtpolice): * milestone: 7.8.3 => 7.10.1 Comment: OK, so this couldn't go through cleanly because the Haddock change has a conflict that's proving to be extremely confusing: https://github.com/haskell/haddock/commit/e56a8037c04a32922cb0951c66f64ecc6e... https://github.com/haskell/haddock/commit/e811b00837d19340047ad83273b4aa2dc2... I have no idea how to reconcile these two commits, since the v2.14 haddock branch has diverged from the 7.8 branch, and I have no clue what Fuuzetsu etc have planned here. So I'm inclined to just leave this one out I'm afraid. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9023#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9023: Error when using empty record update on binary pattern synonym ------------------------------------------------+-------------------------- Reporter: Iceland_jack | Owner: cactus Type: bug | Status: closed Priority: normal | Milestone: 7.10.1 Component: Compiler | Version: 7.8.2 Resolution: fixed | Keywords: Operating System: Linux | Architecture: x86 Type of failure: None/Unknown | Difficulty: Test Case: patsyn/should_compile/T9023 | Unknown Blocking: | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by simonpj): Yes, just leave it out. There are other things wrong with pattern synonyms and we aren't going to fix all of them in the 7.8 branch. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9023#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9023: Error when using empty record update on binary pattern synonym ------------------------------------------------+-------------------------- Reporter: Iceland_jack | Owner: cactus Type: bug | Status: closed Priority: normal | Milestone: 7.10.1 Component: Compiler | Version: 7.8.2 Resolution: fixed | Keywords: Operating System: Linux | Architecture: x86 Type of failure: None/Unknown | Difficulty: Test Case: patsyn/should_compile/T9023 | Unknown Blocking: | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by cactus): That Haddock conflict is because of 7ac600d, which fixes #9175, which is also marked for merging anyway. I've updated the `wip/T9023` branch to contain both, then you can try merging from that again. I've also added a `wip/T9023` branch to Haddock for the same purpose. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9023#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9023: Error when using empty record update on binary pattern synonym ------------------------------------------------+-------------------------- Reporter: Iceland_jack | Owner: cactus Type: bug | Status: closed Priority: normal | Milestone: 7.10.1 Component: Compiler | Version: 7.8.2 Resolution: fixed | Keywords: Operating System: Linux | Architecture: x86 Type of failure: None/Unknown | Difficulty: Test Case: patsyn/should_compile/T9023 | Unknown Blocking: | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by thoughtpolice): This was merged into GHC 7.8 for 7.8.3 (also part of fixing #9175). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9023#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9023: Error when using empty record update on binary pattern synonym ------------------------------------------------+-------------------------- Reporter: Iceland_jack | Owner: cactus Type: bug | Status: closed Priority: normal | Milestone: 7.8.3 Component: Compiler | Version: 7.8.2 Resolution: fixed | Keywords: Operating System: Linux | Architecture: x86 Type of failure: None/Unknown | Difficulty: Test Case: patsyn/should_compile/T9023 | Unknown Blocking: | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Changes (by thoughtpolice): * milestone: 7.10.1 => 7.8.3 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9023#comment:17 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC