Skip to content

Implicit class naming restrictions #3654

@allanrenucci

Description

@allanrenucci

The scala documentation imposes restrictions for naming of implicit classes:

There may not be any method, member or object in scope with the same name as the implicit class.

object Bar
implicit class Bar(x: Int) // BAD!

val x = 5
implicit class x(y: Int) // BAD!

However these restrictions don't seem to be enforced, the following code snipped compiles with scalac:

class Test {
  object Bar
  implicit class Bar(x: Int) // OK
}

class Test2 {
  val x = 5
  implicit class x(y: Int) // OK
}

What do we want to do in Dotty? I think it is related to #2464

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions