[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

#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