Skip to content

[SR-1743] REPL doesn't handle multiline comments #4522

Open
@swift-ci

Description

@swift-ci
Previous ID SR-1743
Radar None
Original Reporter amasad (JIRA User)
Type Bug
Environment

Linux ubuntu 15
Swift version 3.0-dev (LLVM b361b0fc05, Clang 11493b0f62, Swift 24a0c3d)

Additional Detail from JIRA
Votes 3
Component/s LLDB for Swift
Labels Bug, REPL
Assignee None
Priority Medium

md5: 2215125dbc4176bab8cc45b90b06d4ca

Issue Description:

To reproduce:

In test.swift:

/*
hello world
*/
print("hello world")

Run:

cat test.swift | swift

Output:

Welcome to Swift version 3.0-dev (LLVM b361b0fc05, Clang 11493b0f62, Swift 24a0c3de75). Type :help for assistance.
<REPL>:3:6: error: unterminated '/*' comment
#line
     ^
     */
<REPL>:2:1: note: comment started here
/*
^

repl.swift:1:6: error: consecutive statements on a line must be separated by ';'
hello world
     ^
     ;

<REPL>:2:1: error: unexpected end of block comment
*/
^

hello world

Notice the errors about the comment.

The reason I'm piping into the REPL is because I use it programmatically (As a child process from another program) and that means it's not in TTY mode. Everything else work (including multiline code).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions