[Git][ghc/ghc][master] Add regression test for #21550

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Thu Sep 1 05:19:10 UTC 2022



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
15111af6 by Zubin Duggal at 2022-09-01T01:18:50-04:00
Add regression test for #21550

This was fixed by ca90ffa321a31842a32be1b5b6e26743cd677ec5
"Use local instances with least superclass depth"

- - - - -


2 changed files:

- + testsuite/tests/typecheck/should_compile/T21550.hs
- testsuite/tests/typecheck/should_compile/all.T


Changes:

=====================================
testsuite/tests/typecheck/should_compile/T21550.hs
=====================================
@@ -0,0 +1,39 @@
+{-# LANGUAGE DataKinds #-}
+{-# LANGUAGE DeriveGeneric #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE KindSignatures #-}
+{-# LANGUAGE QuantifiedConstraints #-}
+{-# LANGUAGE StandaloneDeriving #-}
+{-# LANGUAGE UndecidableInstances #-}
+
+module Main where
+
+import Data.Function
+import Data.Kind
+import GHC.Generics
+import GHC.TypeLits
+
+-- inlined generic-data imports:
+from' :: Generic a => a -> Rep a ()
+from' = from
+
+geq :: (Generic a, Eq (Rep a ())) => a -> a -> Bool
+geq = (==) `on` from'
+
+gcompare :: (Generic a, Ord (Rep a ())) => a -> a -> Ordering
+gcompare = compare `on` from'
+
+
+-- test case:
+data A (v :: Symbol -> Type -> Type) a b deriving (Generic,Generic1)
+
+instance (Eq a , (forall w z . Eq z => Eq (v w z)) , Eq b) => Eq (A v a b) where
+  {-# INLINE (==) #-}
+  (==) = geq
+
+instance (Ord a , (forall w z . Eq z => Eq (v w z)) , (forall w z . Ord z => Ord (v w z)) , Ord b) => Ord (A v a b) where
+  {-# INLINE compare #-}
+  compare = gcompare
+
+main :: IO ()
+main = pure ()


=====================================
testsuite/tests/typecheck/should_compile/all.T
=====================================
@@ -855,3 +855,4 @@ test('DeepSubsumption08', normal, compile, [''])
 test('DeepSubsumption09', normal, compile, [''])
 test('T21951a', normal, compile, ['-Wredundant-strictness-flags'])
 test('T21951b', normal, compile, ['-Wredundant-strictness-flags'])
+test('T21550', normal, compile, [''])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/15111af6adb1c85af5b17088134c9e71bee025e3

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/15111af6adb1c85af5b17088134c9e71bee025e3
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20220901/114c900b/attachment-0001.html>


More information about the ghc-commits mailing list