Robert Jaros
11/15/2023, 5:55 PMdmitriy.novozhilov
11/15/2023, 6:04 PMRobert Jaros
11/15/2023, 6:34 PMDefault argument values inside expect declaration 'KVServiceManager' are not allowed for methods actualized via fake override. Possible fix is to remove default argument values in members
dmitriy.novozhilov
11/15/2023, 6:38 PMRobert Jaros
11/15/2023, 6:38 PMThe following declaration is incompatible because actual function cannot have default argument values, they should be declared in the expected function
bobko
11/15/2023, 7:01 PMRobert Jaros
11/15/2023, 7:04 PMe: file:///home/rjaros/git/kvision/kvision-modules/kvision-server-javalin/src/jsMain/kotlin/io/kvision/remote/KVServiceManager.kt:29:95 Default argument values inside expect declaration 'KVServiceManager' are not allowed for methods actualized via fake override. Possible fix is to remove default argument values in members:
expect fun <reified RET> bind(noinline function: suspend T.() -> RET, method: HttpMethod = ..., route: String? = ...): Unit
expect fun <reified PAR, reified RET> bind(noinline function: suspend T.(PAR) -> RET, method: HttpMethod = ..., route: String? = ...): Unit
expect fun <reified PAR1, reified PAR2, reified RET> bind(noinline function: suspend T.(PAR1, PAR2) -> RET, method: HttpMethod = ..., route: String? = ...): Unit
expect fun <reified PAR1, reified PAR2, reified PAR3, reified RET> bind(noinline function: suspend T.(PAR1, PAR2, PAR3) -> RET, method: HttpMethod = ..., route: String? = ...): Unit
expect fun <reified PAR1, reified PAR2, reified PAR3, reified PAR4, reified RET> bind(noinline function: suspend T.(PAR1, PAR2, PAR3, PAR4) -> RET, method: HttpMethod = ..., route: String? = ...): Unit
expect fun <reified PAR1, reified PAR2, reified PAR3, reified PAR4, reified PAR5, reified RET> bind(noinline function: suspend T.(PAR1, PAR2, PAR3, PAR4, PAR5) -> RET, method: HttpMethod = ..., route: String? = ...): Unit
expect fun <reified PAR1, reified PAR2, reified PAR3, reified PAR4, reified PAR5, reified PAR6, reified RET> bind(noinline function: suspend T.(PAR1, PAR2, PAR3, PAR4, PAR5, PAR6) -> RET, method: HttpMethod = ..., route: String? = ...): Unit
expect fun <reified PAR1 : Any, reified PAR2 : Any> bind(noinline function: suspend T.(ReceiveChannel<PAR1>, SendChannel<PAR2>) -> Unit, route: String? = ...): Unit
expect fun <reified PAR : Any> bind(noinline function: suspend T.(SendChannel<PAR>) -> Unit, route: String? = ...): Unit
expect fun <reified RET> bindTabulatorRemote(noinline function: suspend T.(Int?, Int?, List<RemoteFilter>?, List<RemoteSorter>?, String?) -> RemoteData<RET>, route: String? = ...): Unit
e: file:///home/rjaros/git/kvision/kvision-modules/kvision-server-javalin/src/jvmMain/kotlin/io/kvision/remote/KVServiceManager.kt:58:5 Default argument values inside expect declaration 'KVServiceManager' are not allowed for methods actualized via fake override. Possible fix is to remove default argument values in members:
expect fun <reified RET> bind(noinline function: suspend T.() -> RET, method: HttpMethod = ..., route: String? = ...): Unit
expect fun <reified PAR, reified RET> bind(noinline function: suspend T.(PAR) -> RET, method: HttpMethod = ..., route: String? = ...): Unit
expect fun <reified PAR1, reified PAR2, reified RET> bind(noinline function: suspend T.(PAR1, PAR2) -> RET, method: HttpMethod = ..., route: String? = ...): Unit
expect fun <reified PAR1, reified PAR2, reified PAR3, reified RET> bind(noinline function: suspend T.(PAR1, PAR2, PAR3) -> RET, method: HttpMethod = ..., route: String? = ...): Unit
expect fun <reified PAR1, reified PAR2, reified PAR3, reified PAR4, reified RET> bind(noinline function: suspend T.(PAR1, PAR2, PAR3, PAR4) -> RET, method: HttpMethod = ..., route: String? = ...): Unit
expect fun <reified PAR1, reified PAR2, reified PAR3, reified PAR4, reified PAR5, reified RET> bind(noinline function: suspend T.(PAR1, PAR2, PAR3, PAR4, PAR5) -> RET, method: HttpMethod = ..., route: String? = ...): Unit
expect fun <reified PAR1, reified PAR2, reified PAR3, reified PAR4, reified PAR5, reified PAR6, reified RET> bind(noinline function: suspend T.(PAR1, PAR2, PAR3, PAR4, PAR5, PAR6) -> RET, method: HttpMethod = ..., route: String? = ...): Unit
expect fun <reified PAR1 : Any, reified PAR2 : Any> bind(noinline function: suspend T.(ReceiveChannel<PAR1>, SendChannel<PAR2>) -> Unit, route: String? = ...): Unit
expect fun <reified PAR : Any> bind(noinline function: suspend T.(SendChannel<PAR>) -> Unit, route: String? = ...): Unit
expect fun <reified RET> bindTabulatorRemote(noinline function: suspend T.(Int?, Int?, List<RemoteFilter>?, List<RemoteSorter>?, String?) -> RemoteData<RET>, route: String? = ...): Unit
bobko
11/15/2023, 7:22 PM// COMMON
expect open class KVServiceManager {
protected inline fun bind(route: String? = null)
}
// PLATFORM
open class KVServiceBinder {
internal inline fun bind(route: String?) {}
}
actual open class KVServiceManager : KVServiceBinder()
I confirm that it's exactly what we prohibited in https://youtrack.jetbrains.com/issue/KT-62036 because it wasn't properly supported.
Right now, I can only advise a workaround to declare an overload with substituted default args (the workaround is mentioned in the issue).
If we see that this prohibition breaks a lot of code we might want to reconsider, so thanks for letting us know. But until then we'd like to keep it prohibited (expect/actual classes is a Beta feature, that's why we can do that)Robert Jaros
11/15/2023, 7:41 PM