[GHC] #10534: Data families + Coercible = unsafeCoerce

#10534: Data families + Coercible = unsafeCoerce -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: bug | Status: new Priority: highest | Milestone: 7.10.2 Component: Compiler | Version: 7.10.2-rc1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- When I say {{{ {-# LANGUAGE TypeFamilies, FlexibleContexts #-} module A where import Data.Coerce data family DF a silly :: Coercible (DF a) (DF b) => a -> b silly = coerce }}} {{{ {-# LANGUAGE TypeFamilies #-} module B where import A newtype instance DF a = MkDF () unsafeCoerce :: a -> b unsafeCoerce = silly }}} I get {{{ [1 of 2] Compiling A ( A.hs, interpreted ) [2 of 2] Compiling B ( B.hs, interpreted ) Ok, modules loaded: A, B. }}} Eep! Happily, the fix is very very simple: `TyCon.isDistinctAlgRhs` should return `False` for `DataFamilyTyCon`s. This fix is already in-flight for HEAD in Phab:D968, but this ticket serves to correct this problem in 7.10.2 before the release. Patch coming very shortly. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10534 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10534: Data families + Coercible = unsafeCoerce -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: bug | Status: patch Priority: highest | Milestone: 7.10.2 Component: Compiler | Version: 7.10.2-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: Phab:D992 -------------------------------------+------------------------------------- Changes (by goldfire): * status: new => patch * differential: => Phab:D992 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10534#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10534: Data families + Coercible = unsafeCoerce
-------------------------------------+-------------------------------------
Reporter: goldfire | Owner:
Type: bug | Status: patch
Priority: highest | Milestone: 7.10.2
Component: Compiler | Version: 7.10.2-rc1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions: Phab:D992
-------------------------------------+-------------------------------------
Comment (by Richard Eisenberg

#10534: Data families + Coercible = unsafeCoerce -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: bug | Status: merge Priority: highest | Milestone: 7.10.2 Component: Compiler | Version: 7.10.2-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | typecheck/should_fail/T10534 | Blocking: | Differential Revisions: Phab:D992 -------------------------------------+------------------------------------- Changes (by goldfire): * status: patch => merge * testcase: => typecheck/should_fail/T10534 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10534#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10534: Data families + Coercible = unsafeCoerce -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: bug | Status: merge Priority: highest | Milestone: 7.10.2 Component: Compiler | Version: 7.10.2-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | typecheck/should_fail/T10534 | Blocking: | Differential Revisions: Phab:D992 -------------------------------------+------------------------------------- Comment (by simonpj): This pne-line change _really_ needs more comments. But once the next patch lands it'll have them, and we can do without on the 7.10 branch -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10534#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10534: Data families + Coercible = unsafeCoerce -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: bug | Status: merge Priority: highest | Milestone: 7.10.2 Component: Compiler | Version: 7.10.2-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | typecheck/should_fail/T10534 | Blocking: | Differential Revisions: Phab:D992 -------------------------------------+------------------------------------- Comment (by goldfire): Yes, of course. The bigger patch has run into a few validation problems that I'm working through. I fully expect to land today. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10534#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10534: Data families + Coercible = unsafeCoerce -------------------------------------+------------------------------------- Reporter: goldfire | Owner: Type: bug | Status: closed Priority: highest | Milestone: 7.10.2 Component: Compiler | Version: 7.10.2-rc1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | typecheck/should_fail/T10534 | Blocking: | Differential Revisions: Phab:D992 -------------------------------------+------------------------------------- Changes (by thoughtpolice): * status: merge => closed * resolution: => fixed Comment: Merged to `ghc-7.10`, thanks Richard! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10534#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC