I'm curious if it would be possible to hide unused...
# compiler
t
I'm curious if it would be possible to hide unused parameter warnings when the given function has to conform to a given signature because of the way it is used. In the example below
RuiT0
requires the parameter, so
ruiExternalPatch333
must have that parameter. However, as it does not use the parameter (which is a valid use case) a warning appears.
Copy code
class RuiT0(
    val externalPatchFun : (fragment: RuiFragment<TestNode>) -> Unit
)

fun ruiBuilder333() {
    RuiT0(this::ruiExternalPatch333)
}
 
fun ruiExternalPatch333(fragment: RuiFragment<TestNode>) { // <--- `it` shows a warning

}
As far as I know there are two ways to solve this at the moment: • add an annotation to the parameter or to the function • disable the warning Disabling the warning is a clear no-go, it is a very useful warning. Adding the annotation is technically right but it adds a lot of visual clutter to the code, especially if the function in question has more than one parameters. The whole question might be a corner-case, also it might be quite hard to implement. I'm asking because there are two things that annoy me to no end: annotations and warnings.
k
A third option is a hacky workaround:
Copy code
fun ruiBuilder333() {
    RuiT0 { ruiExternalPatch333() }
}

fun ruiExternalPatch333() {} // <--- no args!