Frequently seeing the following build error on `AS...
# compose
t
Frequently seeing the following build error on
AS 4.2 Canary 15
&
1.0.0-alpha04
:
Copy code
e: java.lang.IllegalArgumentException: Unbound type parameters are forbidden: [Unbound private symbol org.jetbrains.kotlin.ir.symbols.impl.IrTypeParameterSymbolImpl@4decb5a, Unbound private symbol org.jetbrains.kotlin.ir.symbols.impl.IrTypeParameterSymbolImpl@45aa5e3d]
Haven't had success with isolating it to anything in particular. Anyone know what might be causing this?
l
is there any more to the stack trace?
i’d be very interested in a minimal repro for this
i think the easiest way to repro would be to bisect / binary search the code by just commenting code out until it succeeds
👍🏼 1
t
@Leland Richardson [G] Here's the rest of the trace ran with
--stacktrace
i’d be very interested in a minimal repro for this
Let me try commenting stuff out
l
i see that that stack trace is from the incremental compiler. it might also be worth seeing if the exception happens / doesn’t happen depending on whether or not you are doing an incremental compile or not
💡 1
t
Tried turning off incremental comp, seeing a similar failure, albeit different trace ^^ @Leland Richardson [G]
l
thanks, good to know. it would be great if you could figure out what code is causing this. it is either a bug in the compose compiler (most likely) or a bug in the kotlin compiler
t
Still trying to pin it down. Its seems intermittent, so haven't gotten a good series of green builds
Will update this thread if anything turns up
l
thanks!
🙏🏼 1
t
@Leland Richardson [G] Update: A potential candidate seems to be a custom
ViewModelProvider.Factory
that I had created for DI purposes. It is accessed in a Composable via an Ambient like so:
Copy code
@Composable
internal fun ImageScreen() -> Unit) {
    val viewModel = viewModel<ImageViewModel>(factory = ViewModelFactoryAmbient.current)
}
The custom factory itself looks something like this:
Copy code
class ViewModelFactory(...) : ViewModelProvider.Factory {
    @Suppress("UNCHECKED_CAST")
    override fun <T : ViewModel> create(modelClass: Class<T>): T {
        return when {
            modelClass.isAssignableFrom(ImageViewModel::class.java) -> {
                ImageViewModel(...) as T
            }
            else -> throw IllegalArgumentException("...")
        }
    }
}
l
if you can come up with a small example that reproduces this, that would be very helpful
👍🏼 1
t
Ah this looks to be the issue: https://youtrack.jetbrains.com/issue/KT-41006 reportedly fixed in the unreleased kotlin
1.4.20
l
ah. nice find
t
Tried with
1.4.20-RC
, but then getting a different error 😅 . I am guessing Compose might need its own updates for
1.4.20
☝️ 1
l
yep. we are working on 1.4.20 support, but aren’t there yet
🙏🏼 2
t
Thank you! For the time being, going to pass the `ViewModel`s around via arguments instead of using the Compose viewinterop
viewModel
method.