[Git][ghc/ghc][master] Put COMPLETE sigs into ModDetails with -fno-code (#16682)
Marge Bot
gitlab at gitlab.haskell.org
Fri May 31 06:01:23 UTC 2019
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
e32786df by Ryan Scott at 2019-05-31T06:01:18Z
Put COMPLETE sigs into ModDetails with -fno-code (#16682)
`mkBootModDetailsTc`, which creates a special `ModDetails` when
`-fno-code` is enabled, was not properly filling in the `COMPLETE`
signatures from the `TcGblEnv`, resulting in incorrect pattern-match
coverage warnings. Easily fixed.
Fixes #16682.
- - - - -
4 changed files:
- compiler/main/TidyPgm.hs
- + testsuite/tests/patsyn/should_compile/T16682.hs
- + testsuite/tests/patsyn/should_compile/T16682a.hs
- testsuite/tests/patsyn/should_compile/all.T
Changes:
=====================================
compiler/main/TidyPgm.hs
=====================================
@@ -135,13 +135,14 @@ Plan A: mkBootModDetails: omit pragmas, make interfaces small
mkBootModDetailsTc :: HscEnv -> TcGblEnv -> IO ModDetails
mkBootModDetailsTc hsc_env
- TcGblEnv{ tcg_exports = exports,
- tcg_type_env = type_env, -- just for the Ids
- tcg_tcs = tcs,
- tcg_patsyns = pat_syns,
- tcg_insts = insts,
- tcg_fam_insts = fam_insts,
- tcg_mod = this_mod
+ TcGblEnv{ tcg_exports = exports,
+ tcg_type_env = type_env, -- just for the Ids
+ tcg_tcs = tcs,
+ tcg_patsyns = pat_syns,
+ tcg_insts = insts,
+ tcg_fam_insts = fam_insts,
+ tcg_complete_matches = complete_sigs,
+ tcg_mod = this_mod
}
= -- This timing isn't terribly useful since the result isn't forced, but
-- the message is useful to locating oneself in the compilation process.
@@ -156,13 +157,13 @@ mkBootModDetailsTc hsc_env
; dfun_ids = map instanceDFunId insts'
; type_env' = extendTypeEnvWithIds type_env2 dfun_ids
}
- ; return (ModDetails { md_types = type_env'
- , md_insts = insts'
- , md_fam_insts = fam_insts
- , md_rules = []
- , md_anns = []
- , md_exports = exports
- , md_complete_sigs = []
+ ; return (ModDetails { md_types = type_env'
+ , md_insts = insts'
+ , md_fam_insts = fam_insts
+ , md_rules = []
+ , md_anns = []
+ , md_exports = exports
+ , md_complete_sigs = complete_sigs
})
}
where
=====================================
testsuite/tests/patsyn/should_compile/T16682.hs
=====================================
@@ -0,0 +1,5 @@
+module T16682 where
+
+import T16682a
+
+f Unit = () -- Non-exhaustive patterns warning with -fno-code
=====================================
testsuite/tests/patsyn/should_compile/T16682a.hs
=====================================
@@ -0,0 +1,8 @@
+{-# language PatternSynonyms #-}
+module T16682a where
+
+pattern Unit = ()
+
+{-# complete Unit #-}
+
+f Unit = () -- No warnings
=====================================
testsuite/tests/patsyn/should_compile/all.T
=====================================
@@ -77,3 +77,5 @@ test('T14326', normal, compile, [''])
test('T14394', normal, ghci_script, ['T14394.script'])
test('T14552', normal, compile, [''])
test('T14498', normal, compile, [''])
+test('T16682', [extra_files(['T16682.hs', 'T16682a.hs'])],
+ multimod_compile, ['T16682', '-v0 -fwarn-incomplete-patterns -fno-code'])
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/e32786dfc9290e037f70cd942d5922217f2ab7cc
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/e32786dfc9290e037f70cd942d5922217f2ab7cc
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20190531/9c7a3672/attachment-0001.html>
More information about the ghc-commits
mailing list