NI: Fix exception during callable references overload resolution
^KT-35847 Fixed
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
||||
// SKIP_TXT
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !CHECK_TYPE
|
||||
|
||||
fun <R> bar(f: () -> R): R = TODO()
|
||||
|
||||
fun Any.foo() = 1
|
||||
fun A.foo() = ""
|
||||
|
||||
class A {
|
||||
fun main() {
|
||||
bar(<!UNRESOLVED_REFERENCE!>::foo<!>) checkType { <!INAPPLICABLE_CANDIDATE!>_<!><String>() }
|
||||
}
|
||||
}
|
||||
compiler/testData/diagnostics/tests/callableReference/resolve/ambiguityWithBoundExtensionReceiver.kt
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// SKIP_TXT
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !CHECK_TYPE
|
||||
|
||||
fun <R> bar(f: () -> R): R = TODO()
|
||||
|
||||
fun Any.foo() = 1
|
||||
fun A.foo() = ""
|
||||
|
||||
class A {
|
||||
fun main() {
|
||||
bar(::foo) checkType { _<String>() }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// SKIP_TXT
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
import kotlin.reflect.KProperty1
|
||||
import kotlin.reflect.KFunction1
|
||||
|
||||
fun <T, R> has(property: KFunction1<T, R>) = null
|
||||
fun <T, R> has(property: KProperty1<T, R>) = null
|
||||
|
||||
fun toInt(s: String) = 10
|
||||
|
||||
object A {
|
||||
fun main() {
|
||||
has(::toInt) // throwing an exception here
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// SKIP_TXT
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
import kotlin.reflect.KProperty1
|
||||
import kotlin.reflect.KFunction1
|
||||
|
||||
fun <T, R> has(property: KFunction1<T, R>) = null
|
||||
fun <T, R> has(property: KProperty1<T, R>) = null
|
||||
|
||||
fun toInt(s: String) = 10
|
||||
|
||||
object A {
|
||||
fun main() {
|
||||
has(::toInt) // throwing an exception here
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user