Skip to content

Panic on wrong imports with TypeData

Given

{-# LANGUAGE TypeData #-}
module TD where

type data A = X | Y | Z

This is accepted:

module TD2 where

import TD (Y(X))

It shouldn't be: X is not a constructor of Y. Adding one more

module TD2 where

import TD (Y(X), Z(X))

causes a panic:

<no location info>: error:
    panic! (the 'impossible' happened)
  GHC version 9.7.20230218:
	hasParent
  parent:Y parent:Z
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information