Update inert_solved_dicts for ImplicitParams
When adding an implicit parameter dictionary to the inert set, we must make sure that it replaces any previous implicit parameter dictionaries that overlap, in order to get the appropriate shadowing behaviour, as in let ?x = 1 in let ?x = 2 in ?x We were already doing this for inert_cans, but we weren't doing the same thing for inert_solved_dicts, which lead to the bug reported in #23761. The fix is thus to make sure that, when handling an implicit parameter dictionary in updInertDicts, we update **both** inert_cans and inert_solved_dicts to ensure a new implicit parameter dictionary correctly shadows old ones. Fixes #23761
Showing
- compiler/GHC/Tc/Solver/Dict.hs 33 additions, 16 deletionscompiler/GHC/Tc/Solver/Dict.hs
- compiler/GHC/Tc/Solver/InertSet.hs 4 additions, 5 deletionscompiler/GHC/Tc/Solver/InertSet.hs
- compiler/GHC/Tc/Solver/Monad.hs 5 additions, 5 deletionscompiler/GHC/Tc/Solver/Monad.hs
- testsuite/tests/typecheck/should_run/T23761.hs 20 additions, 0 deletionstestsuite/tests/typecheck/should_run/T23761.hs
- testsuite/tests/typecheck/should_run/T23761.stdout 1 addition, 0 deletionstestsuite/tests/typecheck/should_run/T23761.stdout
- testsuite/tests/typecheck/should_run/T23761b.hs 24 additions, 0 deletionstestsuite/tests/typecheck/should_run/T23761b.hs
- testsuite/tests/typecheck/should_run/T23761b.stdout 1 addition, 0 deletionstestsuite/tests/typecheck/should_run/T23761b.stdout
- testsuite/tests/typecheck/should_run/all.T 2 additions, 0 deletionstestsuite/tests/typecheck/should_run/all.T
Loading
Please register or sign in to comment