Overriding a final implicit class's equivalent definition shouldn't be possible.
trait Foo
trait Implicits {
final implicit class FooExtender(foo : Foo) {
def empty : Unit = {}
}
}
object Test extends Implicits {
override implicit def FooExtender(foo: Foo): Test.FooExtender = super.FooExtender(foo) //should not be allowed
}
Same issue as in scalc https://github.com/scala/bug/issues/11078
@smarter can you to point me to where the desugarimg of implicit classes takes place? I think I'll be able to fix this myself.
@soronpo I think it's https://github.com/lampepfl/dotty/blob/01c5eac2e7cf44d6fc59e87c969f7ede5abd3f2a/compiler/src/dotty/tools/dotc/ast/Desugar.scala#L582-L605 even the comment says so. The fault should be in the modifiers/flags: https://github.com/lampepfl/dotty/blob/01c5eac2e7cf44d6fc59e87c969f7ede5abd3f2a/compiler/src/dotty/tools/dotc/ast/Desugar.scala#L604.
PS: and thanks!
Most helpful comment
@soronpo I think it's https://github.com/lampepfl/dotty/blob/01c5eac2e7cf44d6fc59e87c969f7ede5abd3f2a/compiler/src/dotty/tools/dotc/ast/Desugar.scala#L582-L605 even the comment says so. The fault should be in the modifiers/flags: https://github.com/lampepfl/dotty/blob/01c5eac2e7cf44d6fc59e87c969f7ede5abd3f2a/compiler/src/dotty/tools/dotc/ast/Desugar.scala#L604.
PS: and thanks!