Skip to content

False "right-associative extension method cannot start with using clause" error #24745

@TomasMikula

Description

@TomasMikula

Compiler version

3.7.4

Minimized code

https://scastie.scala-lang.org/BdGQYl82ROmShM8VigUKXQ

extension (s: String)
  def foo_::(using DummyImplicit): String = s

Output

right-associative extension method cannot start with using clause

Expectation

The restriction mentioned in the error message should not apply here. It should only apply to binary operators.

Quoted from https://docs.scala-lang.org/scala3/reference/contextual/right-associative-extension-methods.html (emphasis mine):

An extension method is treated as a right-associative operator (as in SLS §6.12.3) if it has a name ending in :, and is immediately followed by a single explicit term parameter

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions