Assume code:
class A
class B
class Something {
def method(arg: A) = ???
def method(arg: B) = ???
}
class C
object C {
implicit def ctoa(c: C): A = ???
implicit def ctob(c: C): B = ???
}
Additionally:
- Classes
A
,B
andSomething
and their companions cannot be modified - There must be an implicit conversion from
C
toA
and fromC
toB
, their priority doesn't matter - Other than that, class
C
and its companion can be freely modified - Of course, more types, implicits etc. can be added
Now, is there a way to make this compile:
(new Something).method(new C)
?