[GHC] #10508: comipleExpr or :def in GHCi rejects valid multiline expr or accepts invalid expr
#10508: comipleExpr or :def in GHCi rejects valid multiline expr or accepts invalid expr -------------------------------------+------------------------------------- Reporter: watashi | Owner: watashi Type: bug | Status: new Priority: normal | Milestone: Component: GHC API | Version: 7.10.1 Keywords: | Operating System: Linux Architecture: x86 | Type of failure: GHC rejects Test Case: | valid program Blocking: | Blocked By: Differential Revisions: | Related Tickets: -------------------------------------+------------------------------------- dynComipleExpr will accept invalid expr or reject valid expr because it compiles the expr as `"let _dynComipleExpr = (" ++ expr ++ ")"`. {{{#!hs -- tail -n 15 Test.hs forM_ exprs $ \expr -> handleSourceError printException $ do dyn <- dynCompileExpr expr liftIO $ print dyn where exprs = [ "" , "(),()" , "()" , "\"test\"" , unlines [ "[()]" , " :: [()]" ] ] -- ./Test /lib/ghc <<()>> <<((),())>> <<()>> <<[Char]>> <interactive>:2:2: parse error (possibly incorrect indentation or mismatched brackets) }}} As `:def` and `:cmd` uses `compileExpr`, they have the same problem: {{{ GHCi, version 7.10.1: http://www.haskell.org/ghc/ :? for help Prelude> :{ Prelude| :cmd return $ unlines Prelude| [ "1" Prelude| , "2" Prelude| ] Prelude| :} <interactive>:2:3: parse error (possibly incorrect indentation or mismatched brackets) Prelude> import Prelude (return, id, ShowS, IO) Prelude> :cmd return "0" <interactive>:1:42: Not in scope: type constructor or class ‘String’ Prelude> type String = ShowS Prelude> :cmd return id zsh: segmentation fault (core dumped) ghci }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10508> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10508: comipleExpr or :def in GHCi rejects valid multiline expr or accepts invalid expr -------------------------------------+------------------------------------- Reporter: watashi | Owner: watashi Type: bug | Status: new Priority: normal | Milestone: Component: GHC API | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86 Type of failure: GHC rejects | Test Case: valid program | Blocking: Blocked By: | Differential Revisions: Phab:D974 Related Tickets: | -------------------------------------+------------------------------------- Changes (by watashi): * differential: => Phab:D974 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10508#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10508: comipleExpr or :def in GHCi rejects valid multiline expr or accepts invalid expr -------------------------------------+------------------------------------- Reporter: watashi | Owner: watashi Type: bug | Status: new Priority: normal | Milestone: Component: GHC API | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86 Type of failure: GHC rejects | Test Case: valid program | Blocking: Blocked By: | Differential Revisions: Phab:D974 Related Tickets: | -------------------------------------+------------------------------------- Comment (by Simon Marlow <marlowsd@…>): In [changeset:"d20031d4c88b256cdae264cb05d9d850e973d956/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="d20031d4c88b256cdae264cb05d9d850e973d956" Add parseExpr and compileParsedExpr and use them in GHC API and GHCi Summary: This commit brings following changes and fixes: * Implement parseExpr and compileParsedExpr; * Fix compileExpr and dynCompilerExpr, which returned `()` for empty expr; * Fix :def and :cmd, which didn't work if `IO` or `String` is not in scope; * Use GHCiMonad instead IO in :def and :cmd; * Clean PrelInfo: delete dead comment and duplicate entries, add assertion. See new tests for more details. Test Plan: ./validate Reviewers: austin, dterei, simonmar Reviewed By: simonmar Subscribers: thomie, bgamari Differential Revision: https://phabricator.haskell.org/D974 GHC Trac Issues: #10508 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10508#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10508: comipleExpr or :def in GHCi rejects valid multiline expr or accepts invalid expr -------------------------------------+------------------------------------- Reporter: watashi | Owner: watashi Type: bug | Status: closed Priority: normal | Milestone: 7.12.1 Component: GHC API | Version: 7.10.1 Resolution: fixed | Keywords: Operating System: Linux | Architecture: x86 Type of failure: GHC rejects | Test Case: valid program | ghci/scripts/T10508 ghc- Blocked By: | api/T10508_api Related Tickets: | Blocking: | Differential Revisions: Phab:D974 -------------------------------------+------------------------------------- Changes (by thomie): * status: new => closed * testcase: => ghci/scripts/T10508 ghc-api/T10508_api * resolution: => fixed * milestone: => 7.12.1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10508#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC