Fix #8758 by assuming RankNTypes when checking GND code.
authorRichard Eisenberg <eir@cis.upenn.edu>
Sun, 9 Feb 2014 16:08:07 +0000 (11:08 -0500)
committerRichard Eisenberg <eir@cis.upenn.edu>
Sun, 9 Feb 2014 16:08:07 +0000 (11:08 -0500)
compiler/typecheck/TcDeriv.lhs
testsuite/tests/deriving/should_compile/T8758.hs [new file with mode: 0644]
testsuite/tests/deriving/should_compile/T8758a.hs [new file with mode: 0644]
testsuite/tests/deriving/should_compile/all.T

index f9f7c0a..8a4c19c 100644 (file)
@@ -1969,7 +1969,8 @@ genInst standalone_deriv oflag comauxs
                     , iBinds  = InstBindings
                         { ib_binds = gen_Newtype_binds loc clas tvs tys rhs_ty
                         , ib_pragmas = []
-                        , ib_extensions = [Opt_ImpredicativeTypes]
+                        , ib_extensions = [ Opt_ImpredicativeTypes
+                                          , Opt_RankNTypes ]
                         , ib_standalone_deriving = standalone_deriv } }
                 , emptyBag
                 , Just $ getName $ head $ tyConDataCons rep_tycon ) }
diff --git a/testsuite/tests/deriving/should_compile/T8758.hs b/testsuite/tests/deriving/should_compile/T8758.hs
new file mode 100644 (file)
index 0000000..86c54c4
--- /dev/null
@@ -0,0 +1,9 @@
+{-# LANGUAGE RankNTypes #-}
+
+module T8758 where
+
+class C m where
+  foo :: (forall b. b -> m b) -> c -> m c
+
+instance C [] where
+  foo f c = f c
\ No newline at end of file
diff --git a/testsuite/tests/deriving/should_compile/T8758a.hs b/testsuite/tests/deriving/should_compile/T8758a.hs
new file mode 100644 (file)
index 0000000..4b7fe44
--- /dev/null
@@ -0,0 +1,8 @@
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+
+module T8758a where
+
+import T8758
+
+newtype MyList a = Mk [a]
+  deriving C
\ No newline at end of file
index 02b067e..a7cc3df 100644 (file)
@@ -42,4 +42,5 @@ test('T7710', normal, compile, [''])
 test('AutoDeriveTypeable', normal, compile, [''])
 
 test('T8138', reqlib('primitive'), compile, ['-O2'])
-test('T8631', normal, compile, [''])
\ No newline at end of file
+test('T8631', normal, compile, [''])
+test('T8758', extra_clean(['T8758a.o', 'T8758a.hi']), multimod_compile, ['T8758a', '-v0'])
\ No newline at end of file