diff options
author | Baldur Blöndal <baldurpet@gmail.com> | 2021-05-18 23:08:32 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-05-19 23:43:46 -0400 |
commit | 939a56e780b7cc55cf49b52c4222e0e8061e99b1 (patch) | |
tree | ad4cee91356a08993a72add2b46bf40bbf8c0481 | |
parent | 82b097b3d43521f775edb560f97eb37862de7a43 (diff) | |
download | haskell-939a56e780b7cc55cf49b52c4222e0e8061e99b1.tar.gz |
Added new regresion test for #18036 from ticket #19865.
-rw-r--r-- | testsuite/tests/typecheck/should_compile/T18036b.hs | 33 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/all.T | 1 |
2 files changed, 34 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/T18036b.hs b/testsuite/tests/typecheck/should_compile/T18036b.hs new file mode 100644 index 0000000000..0d4e78ead4 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T18036b.hs @@ -0,0 +1,33 @@ +-- https://gitlab.haskell.org/ghc/ghc/-/issues/19865 +{-# LANGUAGE ConstrainedClassMethods #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE TypeFamilies #-} + +{-# OPTIONS_GHC -Wredundant-constraints #-} + +module Main where + +-- declare class +class Mode t where + type Scalar t + myf :: Fractional (Scalar t) => t -> Scalar t -> t + + +-- declare data type + instance +data ReverseDouble a + +instance Mode (ReverseDouble s) where + type Scalar (ReverseDouble s) = Double + myf = undefined + + +-- declare a newtype and derive the instance from the above data type +newtype GDouble s a = GDouble (ReverseDouble s) + deriving newtype Mode + + + +main :: IO () +main = pure () diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 868771542e..7ebb9ae65c 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -720,6 +720,7 @@ test('T18005', normal, compile, ['']) test('T18023', normal, compile, ['']) test('T18036', normal, compile, ['']) test('T18036a', normal, compile, ['']) +test('T18036b', normal, compile, ['']) test('T17873', normal, compile, ['']) test('T18129', expect_broken(18129), compile, ['']) test('T18185', normal, compile, ['']) |