I have: ```fun FooBase.resolveNew(other: FooBase) ...
# codereview
d
I have:
Copy code
fun FooBase.resolveNew(other: FooBase) = when(this) {
   is Foo1 -> when(other) {
      is Foo1 -> ...
      ...
   }
   is Foo2 -> when(other) {
      is Foo1 -> ...
      ...
   }
}
is it preferred just to do this:
Copy code
fun FooBase.resolveNew(other: FooBase) = when(this) {
   this is Foo1 && other is Foo1 -> 
   ...
}
if there are some common branches between the
this
types? What does everybody do in this case?
j
Depending on how smart cast is enough smart. If it is enough smart, 2 (maybe K2 helps here)
d
I was doubtful since with 2 you loose the exhaustiveness of when... but 1 looks too overkill.