Skip to content

Recursive superclass check is defeated by quantified constraints

This is accepted:

{-# LANGUAGE QuantifiedConstraints, KindSignatures, ConstraintKinds #-}

module Bug where

import Data.Kind

class ((() :: Constraint) => C a) => C a

The vacuous constraint () hides the recursive superclass C a. Note that I do not have RecursiveSuperclasses enabled.

The culprit is TcTyDecls.checkClassCycles.

This is not a "real" bug report, in that I found the problem only by reading the source code, not by observing the misbehavior. Still, it shouldn't be hard to fix. Should we just look through quantified constraints always?

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information