GHCi should not defer typed holes
ClosedPublic

Authored by thomie on Nov 25 2015, 4:40 AM.

Details

Summary

In the function tcUserStmt in compiler/typecheck/TcRnDriver.hs, before
going over the different ways ('plans') to lift an expression typed at
the prompt into the GHCi monad, Opt_DeferTypeErrors is disabled. Here is
the accompanying comment:

  • Ensure that type errors don't get deferred when type checking the
  • naked expression. Deferring type errors here is unhelpful because the
  • expression gets evaluated right away anyway. It also would potentially
  • emit redundant type-error warnings, one from each plan. ; plan <- unsetGOptM Opt_DeferTypeErrors $

Since Opt_DeferTypeErrors implies Opt_DeferTypedHoles,
Opt_DeferTypedHoles should be disabled here as well. This improves
the error message for T10248 (it doesn't mention ghciStepIO anymore).
This is a partial fix for Trac #10249, and a complete fix for Trac #11130.

Depends on D1526

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
thomie updated this revision to Diff 5313.Nov 25 2015, 4:40 AM
thomie retitled this revision from to GHCi should not defer typed holes.
thomie updated this object.
thomie edited the test plan for this revision. (Show Details)
thomie updated the Trac tickets for this revision.
thomie added inline comments.Nov 25 2015, 4:51 AM
compiler/typecheck/TcRnDriver.hs
1643

@austin: here's an example of what we discussed recently, about Phabricator and multiple related commits. D1526 changed the above comment ever so slightly, so this patch won't apply to master without it.

++<<<<<<< HEAD
 +        -- emit two redundant type-error warnings, one from each plan.
 +        ; plan <- unsetGOptM Opt_DeferTypeErrors $ runPlans [
++=======
+         -- emit redundant type-error warnings, one from each plan.
+         ; plan <- unsetGOptM Opt_DeferTypeErrors $
+                   unsetGOptM Opt_DeferTypedHoles $ runPlans [
++>>>>>>> 130e3bf... GHCi should not defer typed holes

Which option would you recommend:

  • Use 'Depends On', as I have currently done.
  • Submit this patch without using 'Depends on, ignore validate result.
  • Wait for review and landing of D1526, and only then submit this patch.
  • Combine the two patches into one patch because they change the same function in the same file.

I think we should update the wiki page on Phabricator once we've figured this out.

simonpj accepted this revision.Nov 25 2015, 6:50 AM
simonpj added a reviewer: simonpj.
simonpj added a subscriber: simonpj.

Great!

This revision is now accepted and ready to land.Nov 25 2015, 6:50 AM
thomie updated this revision to Diff 5321.Nov 25 2015, 9:55 AM
thomie edited edge metadata.

Update test output

This revision was automatically updated to reflect the committed changes.