noncom
02/07/2018, 9:25 AMwhen
block. The type does not get inferred... here is a little reproducible gist: https://gist.github.com/noncom/ea3e57e676a799efe2943a34b06f2986Andreas Sinz
02/07/2018, 9:26 AMInt::one
instead of {one()}
noncom
02/07/2018, 9:31 AMnoncom
02/07/2018, 9:32 AM::
way does not allow for arguments afaik?Andreas Sinz
02/07/2018, 9:35 AM::
doesn't workAndreas Sinz
02/07/2018, 9:39 AM0 -> fun Int.() = one(10)
Andreas Sinz
02/07/2018, 9:40 AMAndreas Sinz
02/07/2018, 9:57 AM{ }
case 0 -> {
println("Case 0")
{ one(10) }
}
So in your example, kotlin thinks that { }
denotes the case-block, NOT that its a lambda. If you use 0 -> { { one(10) } }
it worksnoncom
02/07/2018, 10:29 AM