Improve pattern to type pattern transformation (23739)
`pat_to_type_pat` function now can handle more patterns: - TuplePat - ListPat - LitPat - NPat - ConPat Allowing these new constructors in type patterns significantly increases possible shapes of type patterns without `type` keyword. This patch also changes how lookups in `lookupOccRnConstr` are performed, because we need to fall back into types when we didn't find a constructor on data level to perform `ConPat` to type transformation properly.
Showing
- compiler/GHC/Hs/Type.hs 47 additions, 0 deletionscompiler/GHC/Hs/Type.hs
- compiler/GHC/Rename/Env.hs 25 additions, 1 deletioncompiler/GHC/Rename/Env.hs
- compiler/GHC/Rename/Pat.hs 2 additions, 41 deletionscompiler/GHC/Rename/Pat.hs
- compiler/GHC/Tc/Gen/App.hs 6 additions, 13 deletionscompiler/GHC/Tc/Gen/App.hs
- compiler/GHC/Tc/Gen/Head.hs 3 additions, 41 deletionscompiler/GHC/Tc/Gen/Head.hs
- compiler/GHC/Tc/Gen/HsType.hs 24 additions, 1 deletioncompiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Gen/Pat.hs 94 additions, 39 deletionscompiler/GHC/Tc/Gen/Pat.hs
- compiler/GHC/Tc/Utils/Env.hs 42 additions, 0 deletionscompiler/GHC/Tc/Utils/Env.hs
- testsuite/tests/rename/should_fail/T19843c.stderr 6 additions, 3 deletionstestsuite/tests/rename/should_fail/T19843c.stderr
- testsuite/tests/type-data/should_fail/TDPattern.stderr 5 additions, 2 deletionstestsuite/tests/type-data/should_fail/TDPattern.stderr
- testsuite/tests/typecheck/should_compile/T23739a.hs 65 additions, 0 deletionstestsuite/tests/typecheck/should_compile/T23739a.hs
- testsuite/tests/typecheck/should_compile/all.T 1 addition, 0 deletionstestsuite/tests/typecheck/should_compile/all.T
- testsuite/tests/typecheck/should_fail/T23739b.hs 14 additions, 0 deletionstestsuite/tests/typecheck/should_fail/T23739b.hs
- testsuite/tests/typecheck/should_fail/T23739b.stderr 21 additions, 0 deletionstestsuite/tests/typecheck/should_fail/T23739b.stderr
- testsuite/tests/typecheck/should_fail/all.T 1 addition, 1 deletiontestsuite/tests/typecheck/should_fail/all.T
Loading
Please register or sign in to comment