diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2022-07-18 11:47:52 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2022-07-20 22:30:53 -0400 |
commit | b889f123bcb3c5a70f19389297109d0a48406149 (patch) | |
tree | 34c497d8380289773e85100dfe6101937133d76f | |
parent | ddf6c67057c176bdf1fddb01fd93de89978d5f49 (diff) | |
download | haskell-b889f123bcb3c5a70f19389297109d0a48406149.tar.gz |
Add tests that -XHaskell98 and -XHaskell2010 enable DeepSubsumption
(cherry picked from commit 5c4fbaf53f258d64aeb66a8172e13dc559eb8d8b)
-rw-r--r-- | compiler/GHC/Driver/Session.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/showIface/LanguageExts.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/DeepSubsumption06.hs | 12 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/DeepSubsumption07.hs | 12 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/all.T | 2 |
5 files changed, 30 insertions, 1 deletions
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs index 0ef6eb3ab6..386253bddc 100644 --- a/compiler/GHC/Driver/Session.hs +++ b/compiler/GHC/Driver/Session.hs @@ -1359,12 +1359,14 @@ languageExtensions (Just Haskell98) LangExt.DatatypeContexts, LangExt.TraditionalRecordSyntax, LangExt.FieldSelectors, - LangExt.NondecreasingIndentation + LangExt.NondecreasingIndentation, -- strictly speaking non-standard, but we always had this -- on implicitly before the option was added in 7.1, and -- turning it off breaks code, so we're keeping it on for -- backwards compatibility. Cabal uses -XHaskell98 by -- default unless you specify another language. + LangExt.DeepSubsumption + -- Non-standard but enabled for backwards compatability (see GHC proposal #511) ] languageExtensions (Just Haskell2010) diff --git a/testsuite/tests/showIface/LanguageExts.stdout b/testsuite/tests/showIface/LanguageExts.stdout index c155327230..1e0a2a89be 100644 --- a/testsuite/tests/showIface/LanguageExts.stdout +++ b/testsuite/tests/showIface/LanguageExts.stdout @@ -12,6 +12,7 @@ docs: Just Haskell98 language extensions: MonomorphismRestriction + DeepSubsumption ImplicitPrelude NPlusKPatterns PatternGuards diff --git a/testsuite/tests/typecheck/should_compile/DeepSubsumption06.hs b/testsuite/tests/typecheck/should_compile/DeepSubsumption06.hs new file mode 100644 index 0000000000..6e8b64c2c2 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/DeepSubsumption06.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE NoPolyKinds #-} +{-# LANGUAGE RankNTypes #-} +module DeepSubsumption06 where + +class Profunctor p where + dimap :: (s -> a) -> (b -> t) -> p i a b -> p i s t + +type Iso s t a b = forall p i . Profunctor p => p i a b -> p i s t + +iso :: (s -> a) -> (b -> t) -> Iso s t a b +-- iso f g = dimap f g +iso = dimap diff --git a/testsuite/tests/typecheck/should_compile/DeepSubsumption07.hs b/testsuite/tests/typecheck/should_compile/DeepSubsumption07.hs new file mode 100644 index 0000000000..1c70025051 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/DeepSubsumption07.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE NoPolyKinds #-} +{-# LANGUAGE RankNTypes #-} +module DeepSubsumption07 where + +class Profunctor p where + dimap :: (s -> a) -> (b -> t) -> p i a b -> p i s t + +type Iso s t a b = forall p i . Profunctor p => p i a b -> p i s t + +iso :: (s -> a) -> (b -> t) -> Iso s t a b +-- iso f g = dimap f g +iso = dimap diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 21fb2a098f..8ba46671e3 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -837,3 +837,5 @@ test('DeepSubsumption02', normal, compile, ['']) test('DeepSubsumption03', normal, compile, ['']) test('DeepSubsumption04', normal, compile, ['']) test('DeepSubsumption05', normal, compile, ['']) +test('DeepSubsumption06', normal, compile, ['-XHaskell98']) +test('DeepSubsumption07', normal, compile, ['-XHaskell2010']) |