Change shadowing mechanism of extension methods for on par implicit class behavior

Update: the proposal SIP-54 has been implemented and merged into the compiler. It is now available as an experimental feature that you can use as follows:

//> using scala 3.nightly

import scala.language.experimental.relaxedExtensionImports

object A:
  extension (s: String)
    def wow: Unit = println(s)
object B:
  extension (i: Int)
    def wow: Unit = println(i)

import A._
import B._
5.wow
"five".wow

(Based on this gist)

Note that you have to use a nightly build of the compiler.

Before we make it a stable feature, we would like to hear from the community if the current design and implementation work for you. In particular, we would be interested to know if there are still use cases where you used implicit classes in Scala 2 that you cannot migrate to extension methods in Scala 3.

8 Likes