Refactor GHCi UI to fix #16096
AbandonedPublic

Authored by osa1 on Dec 26 2018, 8:30 AM.

Details

Summary

Instead of parsing and executing a statement or declaration directly we
now parse them first and then execute in a separate step. This gives us
the flexibility to inspect the parsed declaration before execution.
Using this we now inspect parsed declarations, and if it's a single
declaration of form x = y we execute it as let x = y instead, fixing
Trac #16096.

To avoid any users of the modules I left execStmt and runDecls
unchanged and added execStmt' and runDecls' which work on parsed
statements/declarations.

Test Plan

This validates. Added a test.

osa1 created this revision.Dec 26 2018, 8:30 AM
osa1 planned changes to this revision.Dec 26 2018, 8:31 AM

I left some TODOs in the description.

osa1 added a comment.Dec 27 2018, 2:10 AM

This broke one test:

--- ghci/should_run/T7253.run/T7253.stderr.normalised   2018-12-27 11:09:50.906321533 +0300
+++ ghci/should_run/T7253.run/T7253.run.stderr.normalised       2018-12-27 11:09:50.906321533 +0300
@@ -1,7 +1,4 @@

-<interactive>:19:1: warning: [-Wunrecognised-pragmas (in -Wdefault)]
-    Unrecognised pragma
-
 <interactive>:61:1:
      Role mismatch on variable b:
         Annotation says phantom but role representational is required
*** unexpected failure for T7253(ghci)
osa1 updated this revision to Diff 19248.Dec 27 2018, 2:55 AM
  • Fix a bug, simplify things
osa1 updated this revision to Diff 19249.Dec 27 2018, 3:00 AM
  • Enable a broken test
osa1 edited the summary of this revision. (Show Details)Dec 27 2018, 3:00 AM
osa1 added inline comments.
testsuite/tests/ghci/scripts/all.T
265

This patch somehow fixed this test ... I looked at the ticket and it doesn't seem to be GHCi related. In any case I'm enabling this now.

osa1 updated this revision to Diff 19250.Dec 27 2018, 3:27 AM
  • Update test output
osa1 edited the test plan for this revision. (Show Details)Dec 27 2018, 3:27 AM
osa1 edited the summary of this revision. (Show Details)
osa1 updated this revision to Diff 19251.Dec 27 2018, 3:43 AM
  • Add test
osa1 edited the summary of this revision. (Show Details)Dec 27 2018, 3:44 AM
osa1 edited the test plan for this revision. (Show Details)
osa1 updated this revision to Diff 19252.Dec 27 2018, 4:13 AM
  • Remove duplication
osa1 edited the summary of this revision. (Show Details)Dec 27 2018, 4:14 AM