Fix ambiguity on callable reference for expect members
Expect members should always lose in resolution to non-expect members, be it simple calls or callable references. Note that there should be exactly one actual member for each expect member in correct code, so both ways to check for expect vs non-expect are correct: either before signature comparison, or after. #KT-20903 Fixed
This commit is contained in:
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
package test
|
||||
|
||||
expect fun foo(): String
|
||||
|
||||
fun g(f: () -> String): String = f()
|
||||
|
||||
fun test() {
|
||||
g(::<!JVM:DEPRECATION!>foo<!>)
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
package test
|
||||
|
||||
@Deprecated("To check that ::foo is resolved to actual fun foo when compiling common+jvm")
|
||||
actual fun foo(): String = ""
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// -- Module: <m1-common> --
|
||||
package
|
||||
|
||||
package test {
|
||||
public expect fun foo(): kotlin.String
|
||||
public fun g(/*0*/ f: () -> kotlin.String): kotlin.String
|
||||
public fun test(): kotlin.Unit
|
||||
}
|
||||
|
||||
|
||||
// -- Module: <m2-jvm> --
|
||||
package
|
||||
|
||||
package test {
|
||||
@kotlin.Deprecated(message = "To check that ::foo is resolved to actual fun foo when compiling common+jvm") public actual fun foo(): kotlin.String
|
||||
public fun g(/*0*/ f: () -> kotlin.String): kotlin.String
|
||||
public fun test(): kotlin.Unit
|
||||
}
|
||||
Reference in New Issue
Block a user