https://kotlinlang.org logo
#coroutines
Title
# coroutines
e

eygraber

07/11/2019, 2:45 AM
I've been getting a warning for the following code. The warning is:
Non-applicable call for builder inference
and it occurs on the line that starts with
channel.send
Copy code
override val animationProgressChannel: ReceiveChannel<Float> = resumeScope.produce {
    lottieAnimation.addAnimatorUpdateListener { animation ->
      resumeScope.launch {
        channel.send(animation.animatedValue as Float) // Non-applicable call for builder inference (channel is highlighted)
      }
    }
  }
If I change it to
resumeScope.produce<Float>
the warning goes away, but the IDE suggests that I "remove the explicit type arguments". Anyone know what's up with that?
r

Ryan Mentley

07/11/2019, 3:09 AM
you should post the warning
g

gildor

07/11/2019, 3:39 AM
remove the explicit type arguments
Is not a warning, just a suggestion from IDE that you can remove explicit type because it inferred already from return type of the function
e

eygraber

07/11/2019, 4:46 AM
The warning is in the comment next to the expression (
channel.send...
). I'll highlight it as well
l

louiscad

07/11/2019, 6:07 AM
You should report it on kotl.in/issue with a screenshot for each of the 2 cases (and link it here).
g

gildor

07/11/2019, 6:44 AM
Yeah, it also may be a problem of new type inference enabled now by default for Kotlin Idea plugin
r

Ryan Mentley

07/11/2019, 7:44 AM
I like that the only Google Search result for that warning is the code where it's defined: https://www.google.com/search?q="Non-applicable+call+for+builder+inference"
😁 1
e

eygraber

07/16/2019, 2:31 AM
2 Views