Does anyone know why this is still an issue in Kot...
# announcements
d
Does anyone know why this is still an issue in Kotlin latest version? https://youtrack.jetbrains.com/issue/KT-3212
o
Use
Foo().repeat(3){ -> println("test") }
to resolve to first one. It’s ambiguous by design.
👏 1
d
Sounds like workaround..
o
Why workaround? Full form of lambda is
{ p1,p2,p3 -> … }
and it is assignable to functional type with specified number of parameters. There is a short lambda form, without parameter list and
->
, and it is assignable to any functional type. Hence, when there is an overload with different functional type, it is assignable to both, so it results in ambiguity. It’s just you can’t use short form when there are overloads.
👍 1
d
ah OK, didn't spot where is the difference, thank you
it is really working yeah 😄