Commit 14ac3725 authored by Ömer Sinan Ağacan's avatar Ömer Sinan Ağacan

Collect wildcards in sum types during renaming (#12711)

This patch also removes the "catch all" pattern in the function and
explicitly lists constructors to get a warning in the future if a new
`HsType` was added.

Reviewers: bgamari, austin, simonpj

Reviewed By: simonpj

Subscribers: simonpj, thomie

Differential Revision: https://phabricator.haskell.org/D2753

GHC Trac Issues: #12711
parent f4302534
......@@ -1025,6 +1025,7 @@ collectAnonWildCards lty = go lty
HsListTy ty -> go ty
HsPArrTy ty -> go ty
HsTupleTy _ tys -> gos tys
HsSumTy tys -> gos tys
HsOpTy ty1 _ ty2 -> go ty1 `mappend` go ty2
HsParTy ty -> go ty
HsIParamTy _ ty -> go ty
......@@ -1041,8 +1042,10 @@ collectAnonWildCards lty = go lty
HsQualTy { hst_ctxt = L _ ctxt
, hst_body = ty } -> gos ctxt `mappend` go ty
HsSpliceTy (HsSpliced _ (HsSplicedTy ty)) _ -> go $ L noSrcSpan ty
-- HsQuasiQuoteTy, HsSpliceTy, HsCoreTy, HsTyLit
_ -> mempty
HsSpliceTy{} -> mempty
HsCoreTy{} -> mempty
HsTyLit{} -> mempty
HsTyVar{} -> mempty
gos = mconcat . map go
......
:set -XUnboxedSums
:kind (# _ | _ #)
(# _ | _ #) :: TYPE 'GHC.Types.UnboxedSumRep
......@@ -22,6 +22,7 @@ test('thunk', only_ways(['normal']), compile_and_run, [''])
test('T12375', only_ways(['normal']), compile_and_run, [''])
test('empty_sum', only_ways(['normal']), compile_and_run, [''])
test('sum_rr', normal, compile_fail, [''])
test('T12711', only_ways(['ghci']), ghci_script, ['T12711.script'])
# TODO: Need to run this in --slow mode only
# test('sum_api_annots',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment