Fix typechecking of promoted empty lists
The `'[]` case in `tc_infer_hs_type` is smart enough to handle arity-0 uses of `'[]` (see the newly added `T23543` test case for an example), but the `'[]` case in `tc_hs_type` was not. We fix this by changing the `tc_hs_type` case to invoke `tc_infer_hs_type`, as prescribed in `Note [Future-proofing the type checker]`. There are some benign changes to test cases' expected output due to the new code path using `forall a. [a]` as the kind of `'[]` rather than `[k]`. Fixes #23543. (cherry picked from commit c335fb7c)
Showing
- compiler/GHC/Tc/Gen/HsType.hs 6 additions, 0 deletionscompiler/GHC/Tc/Gen/HsType.hs
- testsuite/tests/ghci/scripts/T15898.stderr 1 addition, 1 deletiontestsuite/tests/ghci/scripts/T15898.stderr
- testsuite/tests/ghci/scripts/T6018ghcifail.stderr 4 additions, 4 deletionstestsuite/tests/ghci/scripts/T6018ghcifail.stderr
- testsuite/tests/ghci/scripts/T7939.stdout 4 additions, 4 deletionstestsuite/tests/ghci/scripts/T7939.stdout
- testsuite/tests/typecheck/should_compile/T23543.hs 9 additions, 0 deletionstestsuite/tests/typecheck/should_compile/T23543.hs
- testsuite/tests/typecheck/should_compile/all.T 1 addition, 0 deletionstestsuite/tests/typecheck/should_compile/all.T
- testsuite/tests/typecheck/should_fail/T6018fail.stderr 4 additions, 4 deletionstestsuite/tests/typecheck/should_fail/T6018fail.stderr
Loading
Please register or sign in to comment