Skip to content

indentation syntax is confused by commas in extends and derives clause #22528

Closed as duplicate
@mberndt123

Description

@mberndt123

Hey,

Here's some simple code:
https://scastie.scala-lang.org/PEqZTW1YTxOOHk4L2zpzHw

trait Bar
trait Baz

def f =
  locally:
    trait Foo extends Bar, Baz

This works fine and defines a trait Foo inside that locally block.

Here's a slightly different version:
https://scastie.scala-lang.org/Tz39YMm4QG2D5PO9zbTD3w

trait Bar
trait Baz

def f =
  identity(
    locally:
      trait Foo extends Bar, Baz
  )

Here, the Scala 3.6.3 compiler reports an error: Not found: Baz

I think this is because it thinks of the comma in the extends clause as a function argument separator for the call to identity. The same problem also affects derives clauses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions