Skip to content

Conversation

@vaibhav410
Copy link

Fix REPL: Handle :: operator correctly to allow multi-line input (Fixes #24142)


🐛 Problem

The Scala 3 REPL incorrectly terminated multi-line input when the :: operator was entered on a line by itself (e.g., when constructing a list). This issue effectively broke common list construction patterns in the REPL.

Failing Behavior (Before Fix):
The REPL assumes the statement is complete and terminates the input prematurely.

scala> 1 ::
<-- REPL immediately exits multi-line input mode here


solution:
scala> 1 ::
     | 2 ::
     | Nil
val resX: List[Int] = List(1, 2)
<img width="1288" height="178" alt="Screenshot 2025-11-06 213623" src="https://github.com/user-attachments/assets/3efa6867-d98e-4460-9e0d-2f92e1b85a56" />

Copy link
Contributor

@bracevac bracevac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. To contribute, you need to sign the CLA
  2. How is the problem this PR solves connected to issue #24142?
    I can successfully enter and evaluate a multi-line expression with :: on 3.7.3.
  3. Generously assuming a human being created this.

*.png binary
*.class binary
*.jar binary
*.jar binary
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fail to see how this file and change set is relevant to the issue.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix for issue #24142

Hi @bracevac,
I’ve signed the Akka CLA (confirmed via email).
Also removed the unintended .gitattributes change — it was added accidentally.
This PR now only includes the REPL :: fix related to issue #24142.
Thanks for reviewing!

@SethTisue
Copy link
Member

as the test failure in CI shows, this breaks tab completion on REPL commands such as :quit and :help and such

@SethTisue SethTisue marked this pull request as draft November 12, 2025 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Colon as operator part at beginning of line in REPL

3 participants