Ticket #1430 (closed bug: fixed)

Opened 6 years ago

Last modified 5 years ago

getC: Type signature needed when existential types are used but not in the type signature

Reported by: igloo Owned by:
Priority: high Milestone: 6.8.1
Component: Compiler (Type checker) Version: 6.6.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: getC, tc228 Blocked By:
Blocking: Related Tickets:

Description

This module:

{-# OPTIONS -fglasgow-exts #-}
module Q where

import Data.Typeable

data ExTypeable = forall a. Typeable a => ExTypeable a

-- unExTypeable :: Typeable h => ExTypeable -> Maybe h
unExTypeable (ExTypeable a) = cast a

with the type signature commented out gives this in the HEAD:

q.hs:10:30:
    Could not deduce (Typeable b) from the context (Typeable a)
      arising from a use of `cast' at q.hs:10:30-35
    Possible fix:
      add (Typeable b) to the context of the constructor `ExTypeable'
    In the expression: cast a
    In the definition of `unExTypeable':
        unExTypeable (ExTypeable a) = cast a

It works in 6.6.

It's part of the getC test.

Change History

Changed 6 years ago by simonpj

  • status changed from new to closed
  • testcase changed from getC to getC, tc228
  • resolution set to fixed

Good report. It was a real bug, due to the (fairly new) implication constraints. I think I have fixed it, and I've added a test.

Simon

Tue Jun 19 17:26:13 BST 2007  simonpj@microsoft.com
  * Fix a bug in the handling of implication constraints (Trac #1430)

Changed 6 years ago by igloo

  • milestone changed from 6.8 branch to 6.8.1

Changed 5 years ago by simonmar

  • architecture changed from Unknown to Unknown/Multiple

Changed 5 years ago by simonmar

  • os changed from Unknown to Unknown/Multiple
Note: See TracTickets for help on using tickets.