João Horta Alves
12/02/2024, 10:21 AMpost
and put
routes. Is this a known issue?Roman Golyshev
12/02/2024, 12:39 PMJoão Horta Alves
12/02/2024, 1:28 PMIntelliJ IDEA 2024.3 (Ultimate Edition)
Build #IU-243.21565.193, built on November 13, 2024
> A small reproducer would be really appreciated š
Turns out it's pretty simple to reproduce:
import io.ktor.resources.*
import io.ktor.server.resources.*
import io.ktor.server.routing.*
@Resource("/test")
class TestResource
fun Route.testRouting() {
post<TestResource> {
TODO()
}
}
Error:
Debug.kt:9:5 Overload resolution ambiguity between candidates:
fun <reified T : Any> Route.post(noinline body: suspend RoutingContext.(T) -> Unit): Route
fun <reified R : Any> Route.post(crossinline body: suspend RoutingContext.(R) -> Unit): Route
Adding import io.ktor.server.resources.post
to that code fixes the error, but K2 will remove that import, while K1 keeps it there.
PS: Tested in kotlin 2.1 and 2.0Roman Golyshev
12/02/2024, 1:42 PMJoão Horta Alves
12/02/2024, 1:43 PM