[GHC] #11361: Test tc253 doesn't pass with reversed uniques

#11361: Test tc253 doesn't pass with reversed uniques -------------------------------------+------------------------------------- Reporter: niteria | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 (Type checker) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: GHC rejects Unknown/Multiple | valid program Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- It fails with: {{{ tc253.hs:23:7: error: • Couldn't match type ‘Maybe Int’ with ‘(String, Bool)’ Expected type: Maybe Int -> (String, Int) -> Maybe Int Actual type: Fam Int Bool -> Fam Int Int -> Fam Int Bool • In the expression: inc (undefined :: Int) In an equation for ‘foo’: foo = inc (undefined :: Int) }}} Steps to reproduce: 1. Add line `TEST_HC_OPTS += -dinitial-unique=16777000 -dunique-increment=-1` after line `TEST_HC_OPTS = -fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user-$(GhcPackageDbFlag) -rtsopts $(EXTRA_HC_OPTS)` in `mk/test.mk` 2. `make TESTS=tc253` I suspect this is related to #11148 since the symptoms are similar. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11361 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11361: Test tc253 doesn't pass with reversed uniques -------------------------------------+------------------------------------- Reporter: niteria | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by niteria): It broke right after https://phabricator.haskell.org/rGHC6746549772c5cc0ac66c0fce562f297f4d4b80a2 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11361#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11361: Test tc253 doesn't pass with reversed uniques -------------------------------------+------------------------------------- Reporter: niteria | Owner: niteria Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by niteria): * owner: => niteria -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11361#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11361: Test tc253 doesn't pass with reversed uniques -------------------------------------+------------------------------------- Reporter: niteria | Owner: niteria Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Do you have an idea of what's going on here Bartosz? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11361#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11361: Test tc253 doesn't pass with reversed uniques -------------------------------------+------------------------------------- Reporter: niteria | Owner: niteria Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by niteria): I believe the problem is here: https://phabricator.haskell.org/diffusion/GHC/browse/master/compiler/typeche... There's no reason to believe that `ktvs` and `mkTyVarTys fam_tc_tvs` will be in the matching order, and indeed `ktvs` is in the order of uniques. We start out with: {{{ type Fam a_a18o3H b_a18o3G :: * type Fam a_a18o3F x_a18o3E = FamHelper a_a18o3F x_a18o3E }}} then when we reach `tcDefaultAssocDecl` we have: `FamHelper (a_a18o3F |> <*>_N) (x_a18o3E |> <*>_N) |> <*>_N)` `ktvs` is `[x_a18o3E, a_a18o3F]` `mkTyVarTys fam_tc_tvs` is `[a_a18o3H, b_a18o3G]` When we zip them together we end up with a definition that flips the arguments. From there it goes downhill, because when we try to compute `Fam Int Bool` we do it with flipped arguments: `FamHelper Bool Int` which is `(String, Bool)` which eventually doesn't unify with `Maybe Int`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11361#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11361: Test tc253 doesn't pass with reversed uniques -------------------------------------+------------------------------------- Reporter: niteria | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by niteria): * owner: niteria => Comment: I know what causes it to fail, but I don't know what a good fix would be, leaving for someone else to claim. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11361#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11361: Test tc253 doesn't pass with reversed uniques -------------------------------------+------------------------------------- Reporter: niteria | Owner: Type: bug | Status: new Priority: high | Milestone: Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by niteria): * priority: normal => high Comment: This is a blocker for #4012. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11361#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11361: Test tc253 doesn't pass with reversed uniques
-------------------------------------+-------------------------------------
Reporter: niteria | Owner:
Type: bug | Status: new
Priority: high | Milestone:
Component: Compiler (Type | Version: 8.1
checker) |
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones

#11361: Test tc253 doesn't pass with reversed uniques -------------------------------------+------------------------------------- Reporter: niteria | Owner: Type: bug | Status: merge Priority: high | Milestone: Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: indexed- valid program | types/should_compile/T11361, | T11361a Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * testcase: => indexed-types/should_compile/T11361, T11361a * status: new => merge Comment: Thanks for identifying this bug so clearly. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11361#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11361: Test tc253 doesn't pass with reversed uniques -------------------------------------+------------------------------------- Reporter: niteria | Owner: Type: bug | Status: merge Priority: high | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: indexed- valid program | types/should_compile/T11361, | T11361a Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * milestone: => 8.0.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11361#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11361: Test tc253 doesn't pass with reversed uniques -------------------------------------+------------------------------------- Reporter: niteria | Owner: Type: bug | Status: merge Priority: high | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: indexed- valid program | types/should_compile/T11361, | T11361a Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): This has been merged to `ghc-8.0` as 3b1dae2267241fa6a959e5d9785e20f712c11af0. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11361#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11361: Test tc253 doesn't pass with reversed uniques -------------------------------------+------------------------------------- Reporter: niteria | Owner: Type: bug | Status: closed Priority: high | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.1 checker) | Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: indexed- valid program | types/should_compile/T11361, | T11361a Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11361#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11361: Test tc253 doesn't pass with reversed uniques
-------------------------------------+-------------------------------------
Reporter: niteria | Owner:
Type: bug | Status: closed
Priority: high | Milestone: 8.0.1
Component: Compiler (Type | Version: 8.1
checker) |
Resolution: fixed | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: GHC rejects | Test Case: indexed-
valid program | types/should_compile/T11361,
| T11361a
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Bartosz Nitka
participants (1)
-
GHC