[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 2 commits: Add more instances for Compose: Fractional, RealFrac, Floating, RealFloat
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Sun Jan 14 09:36:50 UTC 2024
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
e9537194 by Jason Shipman at 2024-01-14T04:36:44-05:00
Add more instances for Compose: Fractional, RealFrac, Floating, RealFloat
CLC proposal #226 https://github.com/haskell/core-libraries-committee/issues/226
- - - - -
f1a2f989 by Sebastian Graf at 2024-01-14T04:36:44-05:00
Pmc: COMPLETE pragmas associated with Family TyCons should apply to representation TyCons as well (#24326)
Fixes #24326.
- - - - -
10 changed files:
- compiler/GHC/Types/CompleteMatch.hs
- libraries/base/changelog.md
- libraries/base/src/Data/Functor/Compose.hs
- testsuite/tests/interface-stability/base-exports.stdout
- testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
- testsuite/tests/interface-stability/base-exports.stdout-mingw32
- testsuite/tests/interface-stability/base-exports.stdout-ws-32
- + testsuite/tests/pmcheck/complete_sigs/T24326.hs
- + testsuite/tests/pmcheck/complete_sigs/T24326.stderr
- testsuite/tests/pmcheck/complete_sigs/all.T
Changes:
=====================================
compiler/GHC/Types/CompleteMatch.hs
=====================================
@@ -35,6 +35,11 @@ completeMatchAppliesAtType ty cm = all @Maybe ty_matches (cmResultTyCon cm)
ty_matches sig_tc
| Just (tc, _arg_tys) <- splitTyConApp_maybe ty
, tc == sig_tc
+ || sig_tc `is_family_ty_con_of` tc
+ -- #24326: sig_tc might be the data Family TyCon of the representation
+ -- TyCon tc -- this CompleteMatch still applies
= True
| otherwise
= False
+ fam_tc `is_family_ty_con_of` repr_tc =
+ (fst <$> tyConFamInst_maybe repr_tc) == Just fam_tc
=====================================
libraries/base/changelog.md
=====================================
@@ -33,6 +33,8 @@
([CLC proposal #104](https://github.com/haskell/core-libraries-committee/issues/104))
+ * Add more instances for `Compose`: `Fractional`, `RealFrac`, `Floating`, `RealFloat` ([CLC proposal #226](https://github.com/haskell/core-libraries-committee/issues/226))
+
## 4.19.0.0 *October 2023*
* Add `{-# WARNING in "x-partial" #-}` to `Data.List.{head,tail}`.
Use `{-# OPTIONS_GHC -Wno-x-partial #-}` to disable it.
=====================================
libraries/base/src/Data/Functor/Compose.hs
=====================================
@@ -171,3 +171,11 @@ deriving instance Num (f (g a)) => Num (Compose f g a)
deriving instance Real (f (g a)) => Real (Compose f g a)
-- | @since 4.19.0.0
deriving instance Integral (f (g a)) => Integral (Compose f g a)
+-- | @since 4.20.0.0
+deriving instance Fractional (f (g a)) => Fractional (Compose f g a)
+-- | @since 4.20.0.0
+deriving instance RealFrac (f (g a)) => RealFrac (Compose f g a)
+-- | @since 4.20.0.0
+deriving instance Floating (f (g a)) => Floating (Compose f g a)
+-- | @since 4.20.0.0
+deriving instance RealFloat (f (g a)) => RealFloat (Compose f g a)
=====================================
testsuite/tests/interface-stability/base-exports.stdout
=====================================
@@ -11569,12 +11569,14 @@ instance GHC.Exception.Type.Exception GHC.IOPort.IOPortException -- Defined in
instance [safe] GHC.Exception.Type.Exception System.Timeout.Timeout -- Defined in ‘System.Timeout’
instance forall a k (b :: k). GHC.Float.Floating a => GHC.Float.Floating (Data.Functor.Const.Const a b) -- Defined in ‘Data.Functor.Const’
instance forall a. GHC.Float.RealFloat a => GHC.Float.Floating (Data.Complex.Complex a) -- Defined in ‘Data.Complex’
+instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Float.Floating (f (g a)) => GHC.Float.Floating (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’
instance forall a b. GHC.Float.Floating a => GHC.Float.Floating (Data.Functor.Contravariant.Op a b) -- Defined in ‘Data.Functor.Contravariant’
instance forall a. GHC.Float.Floating a => GHC.Float.Floating (Data.Functor.Identity.Identity a) -- Defined in ‘Data.Functor.Identity’
instance forall a. GHC.Float.Floating a => GHC.Float.Floating (Data.Ord.Down a) -- Defined in ‘Data.Ord’
instance GHC.Float.Floating GHC.Types.Double -- Defined in ‘GHC.Float’
instance GHC.Float.Floating GHC.Types.Float -- Defined in ‘GHC.Float’
instance forall a k (b :: k). GHC.Float.RealFloat a => GHC.Float.RealFloat (Data.Functor.Const.Const a b) -- Defined in ‘Data.Functor.Const’
+instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Float.RealFloat (f (g a)) => GHC.Float.RealFloat (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’
instance forall a. GHC.Float.RealFloat a => GHC.Float.RealFloat (Data.Functor.Identity.Identity a) -- Defined in ‘Data.Functor.Identity’
instance forall a. GHC.Float.RealFloat a => GHC.Float.RealFloat (Data.Ord.Down a) -- Defined in ‘Data.Ord’
instance GHC.Float.RealFloat GHC.Types.Double -- Defined in ‘GHC.Float’
@@ -11913,6 +11915,7 @@ instance GHC.Read.Read GHC.TypeNats.SomeNat -- Defined in ‘GHC.TypeNats’
instance forall a k (b :: k). GHC.Real.Fractional a => GHC.Real.Fractional (Data.Functor.Const.Const a b) -- Defined in ‘Data.Functor.Const’
instance forall a. GHC.Float.RealFloat a => GHC.Real.Fractional (Data.Complex.Complex a) -- Defined in ‘Data.Complex’
instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Real.Fractional (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’
+instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Real.Fractional (f (g a)) => GHC.Real.Fractional (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’
instance forall a b. GHC.Real.Fractional a => GHC.Real.Fractional (Data.Functor.Contravariant.Op a b) -- Defined in ‘Data.Functor.Contravariant’
instance forall a. GHC.Real.Fractional a => GHC.Real.Fractional (Data.Functor.Identity.Identity a) -- Defined in ‘Data.Functor.Identity’
instance forall a. GHC.Real.Fractional a => GHC.Real.Fractional (Data.Ord.Down a) -- Defined in ‘Data.Ord’
@@ -11960,6 +11963,7 @@ instance GHC.Real.Real GHC.Types.Double -- Defined in ‘GHC.Float’
instance GHC.Real.Real GHC.Types.Float -- Defined in ‘GHC.Float’
instance forall a k (b :: k). GHC.Real.RealFrac a => GHC.Real.RealFrac (Data.Functor.Const.Const a b) -- Defined in ‘Data.Functor.Const’
instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Real.RealFrac (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’
+instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Real.RealFrac (f (g a)) => GHC.Real.RealFrac (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’
instance forall a. GHC.Real.RealFrac a => GHC.Real.RealFrac (Data.Functor.Identity.Identity a) -- Defined in ‘Data.Functor.Identity’
instance forall a. GHC.Real.RealFrac a => GHC.Real.RealFrac (Data.Ord.Down a) -- Defined in ‘Data.Ord’
instance forall a. GHC.Real.Integral a => GHC.Real.RealFrac (GHC.Real.Ratio a) -- Defined in ‘GHC.Real’
=====================================
testsuite/tests/interface-stability/base-exports.stdout-javascript-unknown-ghcjs
=====================================
@@ -14342,12 +14342,14 @@ instance GHC.Exception.Type.Exception GHC.JS.Prim.WouldBlockException -- Defined
instance [safe] GHC.Exception.Type.Exception System.Timeout.Timeout -- Defined in ‘System.Timeout’
instance forall a k (b :: k). GHC.Float.Floating a => GHC.Float.Floating (Data.Functor.Const.Const a b) -- Defined in ‘Data.Functor.Const’
instance forall a. GHC.Float.RealFloat a => GHC.Float.Floating (Data.Complex.Complex a) -- Defined in ‘Data.Complex’
+instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Float.Floating (f (g a)) => GHC.Float.Floating (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’
instance forall a b. GHC.Float.Floating a => GHC.Float.Floating (Data.Functor.Contravariant.Op a b) -- Defined in ‘Data.Functor.Contravariant’
instance forall a. GHC.Float.Floating a => GHC.Float.Floating (Data.Functor.Identity.Identity a) -- Defined in ‘Data.Functor.Identity’
instance forall a. GHC.Float.Floating a => GHC.Float.Floating (Data.Ord.Down a) -- Defined in ‘Data.Ord’
instance GHC.Float.Floating GHC.Types.Double -- Defined in ‘GHC.Float’
instance GHC.Float.Floating GHC.Types.Float -- Defined in ‘GHC.Float’
instance forall a k (b :: k). GHC.Float.RealFloat a => GHC.Float.RealFloat (Data.Functor.Const.Const a b) -- Defined in ‘Data.Functor.Const’
+instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Float.RealFloat (f (g a)) => GHC.Float.RealFloat (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’
instance forall a. GHC.Float.RealFloat a => GHC.Float.RealFloat (Data.Functor.Identity.Identity a) -- Defined in ‘Data.Functor.Identity’
instance forall a. GHC.Float.RealFloat a => GHC.Float.RealFloat (Data.Ord.Down a) -- Defined in ‘Data.Ord’
instance GHC.Float.RealFloat GHC.Types.Double -- Defined in ‘GHC.Float’
@@ -14686,6 +14688,7 @@ instance GHC.Read.Read GHC.TypeNats.SomeNat -- Defined in ‘GHC.TypeNats’
instance forall a k (b :: k). GHC.Real.Fractional a => GHC.Real.Fractional (Data.Functor.Const.Const a b) -- Defined in ‘Data.Functor.Const’
instance forall a. GHC.Float.RealFloat a => GHC.Real.Fractional (Data.Complex.Complex a) -- Defined in ‘Data.Complex’
instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Real.Fractional (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’
+instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Real.Fractional (f (g a)) => GHC.Real.Fractional (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’
instance forall a b. GHC.Real.Fractional a => GHC.Real.Fractional (Data.Functor.Contravariant.Op a b) -- Defined in ‘Data.Functor.Contravariant’
instance forall a. GHC.Real.Fractional a => GHC.Real.Fractional (Data.Functor.Identity.Identity a) -- Defined in ‘Data.Functor.Identity’
instance forall a. GHC.Real.Fractional a => GHC.Real.Fractional (Data.Ord.Down a) -- Defined in ‘Data.Ord’
@@ -14733,6 +14736,7 @@ instance GHC.Real.Real GHC.Types.Double -- Defined in ‘GHC.Float’
instance GHC.Real.Real GHC.Types.Float -- Defined in ‘GHC.Float’
instance forall a k (b :: k). GHC.Real.RealFrac a => GHC.Real.RealFrac (Data.Functor.Const.Const a b) -- Defined in ‘Data.Functor.Const’
instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Real.RealFrac (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’
+instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Real.RealFrac (f (g a)) => GHC.Real.RealFrac (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’
instance forall a. GHC.Real.RealFrac a => GHC.Real.RealFrac (Data.Functor.Identity.Identity a) -- Defined in ‘Data.Functor.Identity’
instance forall a. GHC.Real.RealFrac a => GHC.Real.RealFrac (Data.Ord.Down a) -- Defined in ‘Data.Ord’
instance forall a. GHC.Real.Integral a => GHC.Real.RealFrac (GHC.Real.Ratio a) -- Defined in ‘GHC.Real’
=====================================
testsuite/tests/interface-stability/base-exports.stdout-mingw32
=====================================
@@ -11838,12 +11838,14 @@ instance GHC.Exception.Type.Exception GHC.IOPort.IOPortException -- Defined in
instance [safe] GHC.Exception.Type.Exception System.Timeout.Timeout -- Defined in ‘System.Timeout’
instance forall a k (b :: k). GHC.Float.Floating a => GHC.Float.Floating (Data.Functor.Const.Const a b) -- Defined in ‘Data.Functor.Const’
instance forall a. GHC.Float.RealFloat a => GHC.Float.Floating (Data.Complex.Complex a) -- Defined in ‘Data.Complex’
+instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Float.Floating (f (g a)) => GHC.Float.Floating (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’
instance forall a b. GHC.Float.Floating a => GHC.Float.Floating (Data.Functor.Contravariant.Op a b) -- Defined in ‘Data.Functor.Contravariant’
instance forall a. GHC.Float.Floating a => GHC.Float.Floating (Data.Functor.Identity.Identity a) -- Defined in ‘Data.Functor.Identity’
instance forall a. GHC.Float.Floating a => GHC.Float.Floating (Data.Ord.Down a) -- Defined in ‘Data.Ord’
instance GHC.Float.Floating GHC.Types.Double -- Defined in ‘GHC.Float’
instance GHC.Float.Floating GHC.Types.Float -- Defined in ‘GHC.Float’
instance forall a k (b :: k). GHC.Float.RealFloat a => GHC.Float.RealFloat (Data.Functor.Const.Const a b) -- Defined in ‘Data.Functor.Const’
+instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Float.RealFloat (f (g a)) => GHC.Float.RealFloat (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’
instance forall a. GHC.Float.RealFloat a => GHC.Float.RealFloat (Data.Functor.Identity.Identity a) -- Defined in ‘Data.Functor.Identity’
instance forall a. GHC.Float.RealFloat a => GHC.Float.RealFloat (Data.Ord.Down a) -- Defined in ‘Data.Ord’
instance GHC.Float.RealFloat GHC.Types.Double -- Defined in ‘GHC.Float’
@@ -12191,6 +12193,7 @@ instance GHC.Read.Read GHC.TypeNats.SomeNat -- Defined in ‘GHC.TypeNats’
instance forall a k (b :: k). GHC.Real.Fractional a => GHC.Real.Fractional (Data.Functor.Const.Const a b) -- Defined in ‘Data.Functor.Const’
instance forall a. GHC.Float.RealFloat a => GHC.Real.Fractional (Data.Complex.Complex a) -- Defined in ‘Data.Complex’
instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Real.Fractional (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’
+instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Real.Fractional (f (g a)) => GHC.Real.Fractional (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’
instance forall a b. GHC.Real.Fractional a => GHC.Real.Fractional (Data.Functor.Contravariant.Op a b) -- Defined in ‘Data.Functor.Contravariant’
instance forall a. GHC.Real.Fractional a => GHC.Real.Fractional (Data.Functor.Identity.Identity a) -- Defined in ‘Data.Functor.Identity’
instance forall a. GHC.Real.Fractional a => GHC.Real.Fractional (Data.Ord.Down a) -- Defined in ‘Data.Ord’
@@ -12238,6 +12241,7 @@ instance GHC.Real.Real GHC.Types.Double -- Defined in ‘GHC.Float’
instance GHC.Real.Real GHC.Types.Float -- Defined in ‘GHC.Float’
instance forall a k (b :: k). GHC.Real.RealFrac a => GHC.Real.RealFrac (Data.Functor.Const.Const a b) -- Defined in ‘Data.Functor.Const’
instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Real.RealFrac (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’
+instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Real.RealFrac (f (g a)) => GHC.Real.RealFrac (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’
instance forall a. GHC.Real.RealFrac a => GHC.Real.RealFrac (Data.Functor.Identity.Identity a) -- Defined in ‘Data.Functor.Identity’
instance forall a. GHC.Real.RealFrac a => GHC.Real.RealFrac (Data.Ord.Down a) -- Defined in ‘Data.Ord’
instance forall a. GHC.Real.Integral a => GHC.Real.RealFrac (GHC.Real.Ratio a) -- Defined in ‘GHC.Real’
=====================================
testsuite/tests/interface-stability/base-exports.stdout-ws-32
=====================================
@@ -11573,12 +11573,14 @@ instance GHC.Exception.Type.Exception GHC.IOPort.IOPortException -- Defined in
instance [safe] GHC.Exception.Type.Exception System.Timeout.Timeout -- Defined in ‘System.Timeout’
instance forall a k (b :: k). GHC.Float.Floating a => GHC.Float.Floating (Data.Functor.Const.Const a b) -- Defined in ‘Data.Functor.Const’
instance forall a. GHC.Float.RealFloat a => GHC.Float.Floating (Data.Complex.Complex a) -- Defined in ‘Data.Complex’
+instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Float.Floating (f (g a)) => GHC.Float.Floating (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’
instance forall a b. GHC.Float.Floating a => GHC.Float.Floating (Data.Functor.Contravariant.Op a b) -- Defined in ‘Data.Functor.Contravariant’
instance forall a. GHC.Float.Floating a => GHC.Float.Floating (Data.Functor.Identity.Identity a) -- Defined in ‘Data.Functor.Identity’
instance forall a. GHC.Float.Floating a => GHC.Float.Floating (Data.Ord.Down a) -- Defined in ‘Data.Ord’
instance GHC.Float.Floating GHC.Types.Double -- Defined in ‘GHC.Float’
instance GHC.Float.Floating GHC.Types.Float -- Defined in ‘GHC.Float’
instance forall a k (b :: k). GHC.Float.RealFloat a => GHC.Float.RealFloat (Data.Functor.Const.Const a b) -- Defined in ‘Data.Functor.Const’
+instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Float.RealFloat (f (g a)) => GHC.Float.RealFloat (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’
instance forall a. GHC.Float.RealFloat a => GHC.Float.RealFloat (Data.Functor.Identity.Identity a) -- Defined in ‘Data.Functor.Identity’
instance forall a. GHC.Float.RealFloat a => GHC.Float.RealFloat (Data.Ord.Down a) -- Defined in ‘Data.Ord’
instance GHC.Float.RealFloat GHC.Types.Double -- Defined in ‘GHC.Float’
@@ -11917,6 +11919,7 @@ instance GHC.Read.Read GHC.TypeNats.SomeNat -- Defined in ‘GHC.TypeNats’
instance forall a k (b :: k). GHC.Real.Fractional a => GHC.Real.Fractional (Data.Functor.Const.Const a b) -- Defined in ‘Data.Functor.Const’
instance forall a. GHC.Float.RealFloat a => GHC.Real.Fractional (Data.Complex.Complex a) -- Defined in ‘Data.Complex’
instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Real.Fractional (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’
+instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Real.Fractional (f (g a)) => GHC.Real.Fractional (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’
instance forall a b. GHC.Real.Fractional a => GHC.Real.Fractional (Data.Functor.Contravariant.Op a b) -- Defined in ‘Data.Functor.Contravariant’
instance forall a. GHC.Real.Fractional a => GHC.Real.Fractional (Data.Functor.Identity.Identity a) -- Defined in ‘Data.Functor.Identity’
instance forall a. GHC.Real.Fractional a => GHC.Real.Fractional (Data.Ord.Down a) -- Defined in ‘Data.Ord’
@@ -11964,6 +11967,7 @@ instance GHC.Real.Real GHC.Types.Double -- Defined in ‘GHC.Float’
instance GHC.Real.Real GHC.Types.Float -- Defined in ‘GHC.Float’
instance forall a k (b :: k). GHC.Real.RealFrac a => GHC.Real.RealFrac (Data.Functor.Const.Const a b) -- Defined in ‘Data.Functor.Const’
instance forall k (a :: k). Data.Fixed.HasResolution a => GHC.Real.RealFrac (Data.Fixed.Fixed a) -- Defined in ‘Data.Fixed’
+instance forall k1 k2 (f :: k1 -> *) (g :: k2 -> k1) (a :: k2). GHC.Real.RealFrac (f (g a)) => GHC.Real.RealFrac (Data.Functor.Compose.Compose f g a) -- Defined in ‘Data.Functor.Compose’
instance forall a. GHC.Real.RealFrac a => GHC.Real.RealFrac (Data.Functor.Identity.Identity a) -- Defined in ‘Data.Functor.Identity’
instance forall a. GHC.Real.RealFrac a => GHC.Real.RealFrac (Data.Ord.Down a) -- Defined in ‘Data.Ord’
instance forall a. GHC.Real.Integral a => GHC.Real.RealFrac (GHC.Real.Ratio a) -- Defined in ‘GHC.Real’
=====================================
testsuite/tests/pmcheck/complete_sigs/T24326.hs
=====================================
@@ -0,0 +1,33 @@
+{-# OPTIONS_GHC -Wincomplete-patterns #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE PatternSynonyms #-}
+{-# LANGUAGE ViewPatterns #-}
+
+module T24326 where
+
+data family Foo
+data instance Foo = A | B
+{-# COMPLETE A :: Foo #-}
+
+class C a where
+ matches :: a -> Bool
+
+pattern P :: C a => a
+pattern P <- (matches -> True)
+
+data D = D Bool
+instance C D where { matches (D b) = b }
+
+data family B a
+data instance B Bool = BBool Bool
+instance C (B Bool) where { matches (BBool b) = b }
+{-# COMPLETE P :: B #-}
+
+f :: Foo -> Int
+f A = 0 -- should not warn
+
+f1 :: D -> ()
+f1 P = () -- should warn, because COMPLETE doesn't apply at D
+
+f2 :: B Bool -> ()
+f2 P = () -- should not warn
=====================================
testsuite/tests/pmcheck/complete_sigs/T24326.stderr
=====================================
@@ -0,0 +1,4 @@
+
+T24326.hs:30:1: warning: [GHC-62161] [-Wincomplete-patterns (in -Wextra)]
+ Pattern match(es) are non-exhaustive
+ In an equation for ‘f1’: Patterns of type ‘D’ not matched: _
=====================================
testsuite/tests/pmcheck/complete_sigs/all.T
=====================================
@@ -1,7 +1,9 @@
+setTestOpts(extra_hc_opts('-Wincomplete-patterns'))
+
test('completesig01', normal, compile, [''])
test('completesig02', normal, compile, [''])
-test('Completesig03', normal, multimod_compile, ['Completesig03', '-Wall'])
-test('completesig04', normal, compile, ['-Wincomplete-patterns'])
+test('Completesig03', normal, multimod_compile, ['Completesig03', ''])
+test('completesig04', normal, compile, [''])
test('completesig05', normal, compile, [''])
test('completesig06', normal, compile, [''])
test('completesig07', normal, compile, [''])
@@ -29,3 +31,4 @@ test('T18277', normal, compile, [''])
test('T18960', normal, compile, [''])
test('T18960b', normal, compile, [''])
test('T19475', normal, compile, [''])
+test('T24326', normal, compile, [''])
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ff9e4809c2be570314737ed52d85e10acc7fa42e...f1a2f9892b62824edfe44926ce5d97833c0c53bf
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ff9e4809c2be570314737ed52d85e10acc7fa42e...f1a2f9892b62824edfe44926ce5d97833c0c53bf
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/20240114/9a787b4c/attachment-0001.html>
More information about the ghc-commits
mailing list