class A<T> {
fun <T> test2(p2: T) {}
fun <T> test2(p2: () -> T) {}
}
fun <T> A<T>.test3(p2: T) {}
fun <T> A<T>.test3(p2: () -> T) {}
fun <T> test1(p2: T) {}
fun <T> test1(p2: () -> T) {}
fun main() {
val a = A<Int>()
a.test2 { 2 }
test1 { 2 }
a.test3 { 2 } //Overload resolution ambiguity. All these functions match.
}
Why does IntelliJ IDEA suggest "Overload resolution ambiguity. " at the call site of test3? Examining the decompiled Java code, test3 doesn’t appear to have any notable distinctions from the other two methods, except for an extra receiver parameter.