Ticket #7272 (closed bug: fixed)

Opened 9 months ago

Last modified 7 days ago

PolyKinds and mutually recursive modules

Reported by: dreixel Owned by:
Priority: normal Milestone: 7.6.2
Component: Compiler Version: 7.6.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: polykinds/T7272 Blocked By:
Blocking: Related Tickets:

Description

A.hs

{-# LANGUAGE PolyKinds #-}

module A where

import Test

class C (a :: k)

A.hs-boot

{-# LANGUAGE PolyKinds #-}

module A where

class C (a :: k)

B.hs

{-# LANGUAGE PolyKinds #-}

module Test where

import {-# SOURCE #-} A

Leads to:

A.hs-boot:5:7:
    Class `C' has conflicting definitions in the module and its hs-boot file
    Main module: class C (k::BOX) (a::k) RecFlag Recursive
    Boot file:   class C (k::BOX) (a::k) RecFlag NonRecursive

The problem is not the RecFlag, it's the k kind variable that is getting different uniques.

Change History

Changed 9 months ago by dreixel

  • owner set to dreixel

I'll look into this.

Changed 9 months ago by simonpj@…

commit 2c207b6f60ba5d271f400747256e4a32ca8f7e63

Author: Simon Peyton Jones <simonpj@microsoft.com>
Date:   Tue Oct 2 18:11:08 2012 +0100

    Compare the kinds of type variables when comparing types
    
    This is just a bug that's been around since we introduced
    polymorphic kinds.  The roots are in Type.cmpTypeX, but
    there was a variant in TcRnDriver.checkBootTyCon, which
    is where it came up.
    
    Fixes Trac #7272

 compiler/typecheck/TcRnDriver.lhs |   71 ++++++++++++++++---------------------
 compiler/types/Type.lhs           |   16 +++++++-
 2 files changed, 45 insertions(+), 42 deletions(-)

Changed 9 months ago by simonpj

  • status changed from new to merge
  • difficulty set to Unknown
  • testcase set to polykinds/T7272

Fixed. It would be good to merge this to 7.6. The merge won't be entirely smooth in TcRnDriver but the mis-match is easy to fix.

Changed 8 months ago by igloo

  • milestone set to 7.6.2

Changed 7 months ago by igloo

  • status changed from merge to closed
  • resolution set to fixed

Merged as ed6b56407275d15a8c0b9aede8f90e3f5e0f7281

Changed 12 days ago by xnyhps

There appears (to me) to be a small typo in this commit, although I can't think of any bugs that are caused by it:

 compiler/types/Type.lhs:1231

cmpTypeX env (ForAllTy tv1 t1) (ForAllTy tv2 t2) = cmpTypeX env (tyVarKind tv1) (tyVarKind tv1)

It compares tv1's kind to itself, instead of to tv2's kind.

Changed 7 days ago by simonpj@…

commit 0239d783bcda0fb0e45df7b40159d6ad29bfab63

Author: Simon Peyton Jones <simonpj@microsoft.com>
Date:   Mon Jun 10 11:57:06 2013 +0100

    Fix egregious typo in cmpTypeX
    
    Reported in Trac #7272.  "tv1" should be "tv2"!
    
    However, things weren't as simple as they sound, because
    treating (x:Open) as different from (x:*) gave rise to
    new failures; see Note [Comparison with OpenTypeKind] in Type.
    
    My hacky solution is to treat OpenKind as equal to * and #,
    at least in Core etc.  Hence the faff in Type.cmpTc.
    
    I do not like this.  But it seems like another messy consequence
    of including sub-kinding.  Sigh.

 compiler/typecheck/TcSimplify.lhs |    6 ++----
 compiler/types/Kind.lhs           |   14 +++++++++-----
 compiler/types/Type.lhs           |   28 ++++++++++++++++++++++++----
 3 files changed, 35 insertions(+), 13 deletions(-)

Changed 7 days ago by simonpj

Thanks for pointing this out!

Changed 7 days ago by monoidal

  • owner dreixel deleted
  • status changed from closed to new
  • resolution fixed deleted

Simon: The commit did not fix the typo.

Changed 7 days ago by simonpj

Crumbs. To err once might be carelessness, but twice? I switched off the change to investigate something else and forgot to switch it on again.

Simon

Changed 7 days ago by simonpj@…

commit 6ecfa98d7b9860ccf29359d0bb3d6fda1d7c7335

Author: Simon Peyton Jones <simonpj@microsoft.com>
Date:   Tue Jun 11 09:49:20 2013 +0100

    Actually make the change described in 'Fix egregious typo in cmpTypeX'
    
    I reverted it to try something else and forgot to put it back!
    Fixes Trac #7272 (again!).

 compiler/types/Kind.lhs |   30 ++++++++++++++----------------
 compiler/types/Type.lhs |   14 ++++++--------
 2 files changed, 20 insertions(+), 24 deletions(-)

Changed 7 days ago by simonpj

  • status changed from new to closed
  • resolution set to fixed

Maybe now I have finally done it :-)

Note: See TracTickets for help on using tickets.