WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions