Skip to content

Misleading leading infix error #23426

Open
@som-snytt

Description

@som-snytt

Compiler version

3.7

Minimized code

//> using scala 3.7.1

@main def test = println:
  true
  &&
  try java.lang.Boolean.valueOf("true")

Output

4 |  &&
  |  ^^
  |  end of statement expected but identifier found

Expectation

The problem is that the infix op is not followed by a "simple" expression.

The error message could say so.

It's not a leading infix issue per se:

3 |  true && try java.lang.Boolean.valueOf("true")
  |       ^^
  |       end of statement expected but identifier found

but I wanted the pun on misleading.

When the op is at EOL, it looks like I'm using the syntax wrong, that is, it makes me think some other syntax rule applies or I just don't know how to code in Scala 3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    better-errorsIssues concerned with improving confusing/unhelpful diagnostic messagesitype:enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions