https://kotlinlang.org logo
#compose
Title
# compose
t

themishkun

08/20/2019, 8:47 AM
And what about SAM conversions inside effect hooks (not sure how these constructs called properly)?
Copy code
@Composable
fun foo() {
    +onActive {
        (0..10).maxWith(Comparator<Int> { a, b -> a.compareTo(b) })
    }
}
this code above throws long compilation error but this code below runs fine
Copy code
@Composable
fun foo() {
    +onActive {
        (0..10).maxWith(object : Comparator<Int> {
            override fun compare(a: Int, b: Int): Int {
                return a.compareTo(b)
            }
        })
    }
}
l

Luca Nicoletti

08/20/2019, 8:52 AM
Yep, every lamba which doesn’t explicitly define the params type will break compile. They’ve been working on merging and solving this: https://twitter.com/intelligibabble/status/1153789182247985154
Plus, I think also `object`s which inherits from `sealed class`es cause some trouble
t

themishkun

08/20/2019, 8:54 AM
Sad, but at least this issue is being addressed
l

Luca Nicoletti

08/20/2019, 9:00 AM
Really sad, trust me, I’ve been blocked by this from weeks. But since they’re already working on it I’m relieved
j

jim

08/26/2019, 5:43 PM
AFAIK, this should now be working, as of our merge that went in on Friday afternoon!
l

Luca Nicoletti

08/26/2019, 5:46 PM
I'll give a try in some hours :)
Thanks
2 Views