Disable error deferring in interactive statements
AbandonedPublic

Authored by tdammers on Jun 12 2018, 5:43 AM.

Details

Reviewers
bgamari
Trac Issues
#14963
Summary

The -fdefer-type-errors flag, as well as -fdefer-typed-holes and
-fdefer-out-of-scope-variables (which are implied by
-fdefer-type-errors) currently cause GHCi to crash on perfectly
well-typed programs (see Trac:Trac #14963).

Rather than fixing the underlying problem, we provide a workaround by
simply disabling the three offending extensions while running
interactive statements.

Documentation

Test Plan

./validate

tdammers created this revision.Jun 12 2018, 5:43 AM

@tdammers We have already disabled -fdefer-type-errors and -fdefer-typed-holes in GHCi (by Phab:D1527), see https://github.com/ghc/ghc/blob/master/compiler/typecheck/TcRnDriver.hs#L2070. I opened a ticket Trac #15259 yesterday to disable -fdefer-out-of-scope-variables as well, and fixed it by Phab:D4830. After doing that, the program given in Trac #14963 prints the result correctly and doesn't panic.

I think it's ok to allow -fdefer-type-errors in files to be load to ghci, which wouldn't cause a panic and is very helpful to develop and try partial finished programs. We only need to disable -fdefer-type-errors (as well as the other two -fdefer) to interactive inputs in ghci.

tdammers updated this revision to Diff 16857.Jun 12 2018, 9:39 AM
  • Override interactive dynflags, not session
  • Updated test output
tdammers updated this revision to Diff 16858.Jun 12 2018, 9:46 AM
  • Disable error deferring in interactive statements
  • Documentation
  • Test for Trac #14963 workaround
  • Updated test output

I think it's ok to allow -fdefer-type-errors in files to be load to ghci, which wouldn't cause a panic and is very helpful to develop and try partial finished programs. We only need to disable -fdefer-type-errors (as well as the other two -fdefer) to interactive inputs in ghci.

Correct, and that has been the plan all along; I just disabled them in the session DynFlags instead of the interactive DynFlags. Updated the patch by now, and everything seems to be passing now.

@tdammers We have already disabled -fdefer-type-errors and -fdefer-typed-holes in GHCi (by Phab:D1527), see https://github.com/ghc/ghc/blob/master/compiler/typecheck/TcRnDriver.hs#L2070. I opened a ticket Trac #15259 yesterday to disable -fdefer-out-of-scope-variables as well, and fixed it by Phab:D4830. After doing that, the program given in Trac #14963 prints the result correctly and doesn't panic.

Yes, just looked at your patch, and it looks like a more elegant solution overall than mine.