summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2017-02-14 18:16:04 (GMT)
committerBen Gamari <ben@smart-cactus.org>2017-02-14 21:57:31 (GMT)
commit93e65c8ab7b468d69bf24d9dc2f197d24e5166f4 (patch)
tree4a327b358650f9cf4536c1b274aa528c04062d4a
parentf90e61ad6e5fa0655185f14ca128d507e489c4b7 (diff)
downloadghc-93e65c8ab7b468d69bf24d9dc2f197d24e5166f4.zip
ghc-93e65c8ab7b468d69bf24d9dc2f197d24e5166f4.tar.gz
ghc-93e65c8ab7b468d69bf24d9dc2f197d24e5166f4.tar.bz2
Don't warn about missing methods for instances in signatures.
Test Plan: validate Reviewers: bgamari, austin, dfeuer Reviewed By: dfeuer Subscribers: dfeuer, thomie Differential Revision: https://phabricator.haskell.org/D3134
-rw-r--r--compiler/typecheck/TcClassDcl.hs4
-rw-r--r--testsuite/tests/backpack/should_compile/all.T1
-rw-r--r--testsuite/tests/backpack/should_compile/bkp52.bkp10
-rw-r--r--testsuite/tests/backpack/should_compile/bkp52.stderr5
4 files changed, 19 insertions, 1 deletions
diff --git a/compiler/typecheck/TcClassDcl.hs b/compiler/typecheck/TcClassDcl.hs
index 716aed3..3b9e6ac 100644
--- a/compiler/typecheck/TcClassDcl.hs
+++ b/compiler/typecheck/TcClassDcl.hs
@@ -516,7 +516,9 @@ warnMissingAT :: Name -> TcM ()
warnMissingAT name
= do { warn <- woptM Opt_WarnMissingMethods
; traceTc "warn" (ppr name <+> ppr warn)
- ; warnTc (Reason Opt_WarnMissingMethods) warn -- Warn only if -Wmissing-methods
+ ; hsc_src <- fmap tcg_src getGblEnv
+ -- Warn only if -Wmissing-methods AND not a signature
+ ; warnTc (Reason Opt_WarnMissingMethods) (warn && hsc_src /= HsigFile)
(text "No explicit" <+> text "associated type"
<+> text "or default declaration for "
<+> quotes (ppr name)) }
diff --git a/testsuite/tests/backpack/should_compile/all.T b/testsuite/tests/backpack/should_compile/all.T
index 31bbfcf..683d913 100644
--- a/testsuite/tests/backpack/should_compile/all.T
+++ b/testsuite/tests/backpack/should_compile/all.T
@@ -43,6 +43,7 @@ test('bkp48', normal, backpack_compile, [''])
test('bkp49', normal, backpack_compile, [''])
test('bkp50', normal, backpack_compile, [''])
test('bkp51', normal, backpack_compile, [''])
+test('bkp52', normal, backpack_compile, [''])
test('T13149', expect_broken(13149), backpack_compile, [''])
test('T13214', normal, backpack_compile, [''])
diff --git a/testsuite/tests/backpack/should_compile/bkp52.bkp b/testsuite/tests/backpack/should_compile/bkp52.bkp
new file mode 100644
index 0000000..b60cd70
--- /dev/null
+++ b/testsuite/tests/backpack/should_compile/bkp52.bkp
@@ -0,0 +1,10 @@
+{-# LANGUAGE TypeFamilies #-}
+unit p where
+ module M where
+ class F a where
+ type T a :: *
+unit q where
+ dependency p
+ signature A where
+ import M
+ instance F Int
diff --git a/testsuite/tests/backpack/should_compile/bkp52.stderr b/testsuite/tests/backpack/should_compile/bkp52.stderr
new file mode 100644
index 0000000..5e67670
--- /dev/null
+++ b/testsuite/tests/backpack/should_compile/bkp52.stderr
@@ -0,0 +1,5 @@
+[1 of 2] Processing p
+ Instantiating p
+ [1 of 1] Compiling M ( p/M.hs, bkp52.out/p/M.o )
+[2 of 2] Processing q
+ [1 of 1] Compiling A[sig] ( q/A.hsig, nothing )