tapchicoma
02/02/2019, 5:05 PMitem1
is highlighted with "Cannot infer a type for this parameter. Please specify it explicitly"?
Is there a way to modify someWrapper()
to remove this error?Stefan Beyer
02/02/2019, 5:47 PMitem
instead of item1
, but aside from that, intuitively this should work... weird.Marc Knaup
02/02/2019, 6:15 PM{ item1 -> println(item) }.someWrapper()
is evaluated first and then it's not clear what the lambda is supposed to take or return.
Because that's unknown .someWrapper()
should also not resolve, but that's probably not indicated because it's a subsequent error, not the initial one.
Would item
(item1) have a type then the result of the lambda can be inferred as Unit
(from println
with known parameter type) and then .someWrapper()
should also work fine.
That everything is put into addReceiver
in the end is probably not considered because that would require that the expression is evaluated in the completely opposite order (outside to inside).tapchicoma
02/02/2019, 6:18 PMitem1
- then IDE highlights .someWrapper()
with wrong "type inference failed" errortapchicoma
02/02/2019, 6:19 PM