From 6eedbd83a19cad94414b37f984b6e9c2b0c0b2e4 Mon Sep 17 00:00:00 2001 From: Ryan Scott Date: Tue, 14 May 2019 15:04:02 -0400 Subject: Some forall-related cleanup in deriving code * Tweak the parser to allow `deriving` clauses to mention explicit `forall`s or kind signatures without gratuitous parentheses. (This fixes #14332 as a consequence.) * Allow Haddock comments on `deriving` clauses with explicit `forall`s. This requires corresponding changes in Haddock. --- testsuite/tests/haddock/should_compile_flag_haddock/T11768.hs | 7 +++++++ testsuite/tests/haddock/should_compile_flag_haddock/T11768.stderr | 2 ++ 2 files changed, 9 insertions(+) (limited to 'testsuite/tests/haddock') diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/T11768.hs b/testsuite/tests/haddock/should_compile_flag_haddock/T11768.hs index 5689b42380..5e7369cdc0 100644 --- a/testsuite/tests/haddock/should_compile_flag_haddock/T11768.hs +++ b/testsuite/tests/haddock/should_compile_flag_haddock/T11768.hs @@ -1,6 +1,12 @@ +{-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-} module T11768 where +class C a b + data Foo = Foo deriving Eq -- ^ Documenting a single type @@ -8,6 +14,7 @@ data Bar = Bar deriving ( Eq -- ^ Documenting one of multiple types , Ord ) + deriving anyclass ( forall a. C a {- ^ Documenting forall type -} ) -- | Documenting a standalone deriving instance deriving instance Read Bar diff --git a/testsuite/tests/haddock/should_compile_flag_haddock/T11768.stderr b/testsuite/tests/haddock/should_compile_flag_haddock/T11768.stderr index 997c2ef24c..6de1b2b851 100644 --- a/testsuite/tests/haddock/should_compile_flag_haddock/T11768.stderr +++ b/testsuite/tests/haddock/should_compile_flag_haddock/T11768.stderr @@ -1,12 +1,14 @@ ==================== Parser ==================== module T11768 where +class C a b data Foo = Foo deriving Eq " Documenting a single type" data Bar = Bar deriving (Eq " Documenting one of multiple types", Ord) + deriving anyclass (forall a. C a " Documenting forall type ") deriving instance Read Bar -- cgit v1.2.1