Quick question on Kotlin language: is there a reas...
# kotlin-dsl
k
Quick question on Kotlin language: is there a reason why
Copy code
val foobar by if (flag) {
    tasks.registering(Foo::class)
} else {
    tasks.registering(Bar::class)
}
fails to compile?
e
it compiles successfully for me
k
Odd. It must be an older version of Kotlin (from an older version of Gradle) that the error I'm seeing is specific to.
v
Well, what is the error you are seeing?
Besides that "question on Kotlin language" is better suited for the Kotlin Slack, than the Gradle Slack. 😉
Depending on the problem you get, you could maybe also instead do
Copy code
val foobar by tasks.registering(if (flag) Foo::class else Bar::class))