Skip to content

Strange behaviour in repl when using fewerBraces, first it does not work then it does #14491

Closed
@bjornregnell

Description

@bjornregnell

Compiler version

Scala 3.1.3-RC1-bin-SNAPSHOT-nonbootstrapped-git-ccd39b7 using repl in sbt from current dotty repo.

Minimized code and output

Welcome to Scala 3.1.3-RC1-bin-SNAPSHOT-nonbootstrapped-git-ccd39b7 (11.0.13, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
                                                                                                                               
scala> import language.experimental.fewerBraces
                                                                                                                               
scala> Seq(1,2,3).apply:   // press Alt+Enter to get new line
     |   1
-- Error: -----------  // this should work and not give this error
1 |Seq(1,2,3).apply:   
  |^^^^^^^^^^^^^^^^
  |missing arguments for method apply in trait SeqOps
1 error found
                                                                                                                               
scala> Seq(1,2,3).apply:  // don't press Alt+Enter
val res0: Int => Int = Lambda$14686/0x000000080384a040@44471878
                                                                                                                               
scala> Seq(1,2,3).apply:  // press Alt+Enter to get new line
     |   1
     | 
val res1: Int = 2   // now it suddenly works as should
                                                                                                                               
scala> 

Expectation

The first try above should work. Now it first does not work as expected; then it starts working after creating the first lambda by providing an empty arg.

Maybe it is cased by some kind of jline parsing issue?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions