diff options
author | Edward Z. Yang <ezyang@cs.stanford.edu> | 2017-02-14 13:16:04 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-02-14 16:57:31 -0500 |
commit | 93e65c8ab7b468d69bf24d9dc2f197d24e5166f4 (patch) | |
tree | 4a327b358650f9cf4536c1b274aa528c04062d4a | |
parent | f90e61ad6e5fa0655185f14ca128d507e489c4b7 (diff) | |
download | haskell-93e65c8ab7b468d69bf24d9dc2f197d24e5166f4.tar.gz |
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.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/backpack/should_compile/all.T | 1 | ||||
-rw-r--r-- | testsuite/tests/backpack/should_compile/bkp52.bkp | 10 | ||||
-rw-r--r-- | testsuite/tests/backpack/should_compile/bkp52.stderr | 5 |
4 files changed, 19 insertions, 1 deletions
diff --git a/compiler/typecheck/TcClassDcl.hs b/compiler/typecheck/TcClassDcl.hs index 716aed36b3..3b9e6ac431 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 31bbfcf019..683d913de1 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 0000000000..b60cd701ca --- /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 0000000000..5e6767032b --- /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 ) |