Skip to content

Scala 3 reporter and REPL do not respect message divider #14233

Closed
@som-snytt

Description

@som-snytt

Compiler version

3.1 as shown

Minimized code

  scalac -d /tmp postly.scala
postly.scala:3: error: postfix operator toString needs to be enabled
by making the implicit value scala.language.postfixOps visible.
This can be achieved by adding the import clause 'import scala.language.postfixOps'
or by setting the compiler option -language:postfixOps.
See the Scaladoc for value scala.language.postfixOps for a discussion
why the feature needs to be explicitly enabled.
  def f = 42 toString
             ^
1 error
  sdk use scala 3.1.0

Using scala version 3.1.0 in this shell.
  scalac -d /tmp postly.scala
-- Error: postly.scala:3:10 ---------------------------------------------------------------------------------------------------------------------
3 |  def f = 42 toString
  |          ^^
  |          postfix operator `toString` needs to be enabled
  |          by making the implicit value scala.language.postfixOps visible.
  |          ----
  |          This can be achieved by adding the import clause 'import scala.language.postfixOps'
  |          or by setting the compiler option -language:postfixOps.
  |          See the Scaladoc for value scala.language.postfixOps for a discussion
  |          why the feature needs to be explicitly enabled.
1 error found

Output

As shown.

Expectation

The ---- is meant to be stripped by the reporter. If the error must be displayed multiple times, the explanatory suffix after the divider can be omitted for the sake of brevity.

➜  scala
Welcome to Scala 3.1.0 (17.0.1, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.

scala> def f = 42 toString
-- Error:
1 |def f = 42 toString
  |        ^^
  |        postfix operator `toString` needs to be enabled
  |        by making the implicit value scala.language.postfixOps visible.
  |        ----
  |        This can be achieved by adding the import clause 'import scala.language.postfixOps'
  |        or by setting the compiler option -language:postfixOps.
  |        See the Scaladoc for value scala.language.postfixOps for a discussion
  |        why the feature needs to be explicitly enabled.

scala> def f = 42 toString
-- Error:
1 |def f = 42 toString
  |        ^^
  |        postfix operator `toString` needs to be enabled
  |        by making the implicit value scala.language.postfixOps visible.
  |        ----
  |        This can be achieved by adding the import clause 'import scala.language.postfixOps'
  |        or by setting the compiler option -language:postfixOps.
  |        See the Scaladoc for value scala.language.postfixOps for a discussion
  |        why the feature needs to be explicitly enabled.

scala>
➜  sdk use scala 2.13.7

Using scala version 2.13.7 in this shell.
➜  scala
Welcome to Scala 2.13.7 (OpenJDK 64-Bit Server VM, Java 17.0.1).
Type in expressions for evaluation. Or try :help.

scala> def f = 42 toString
                  ^
       error: postfix operator toString needs to be enabled
       by making the implicit value scala.language.postfixOps visible.
       This can be achieved by adding the import clause 'import scala.language.postfixOps'
       or by setting the compiler option -language:postfixOps.
       See the Scaladoc for value scala.language.postfixOps for a discussion
       why the feature needs to be explicitly enabled.

scala> def f = 42 toString
                  ^
       error: postfix operator toString needs to be enabled
       by making the implicit value scala.language.postfixOps visible.

scala>

Metadata

Metadata

Assignees

No one assigned

    Labels

    SpreeSuitable for a future Spreearea:replarea:reportingError reporting including formatting, implicit suggestions, etcitype:bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions