FE KT-47939 callable references to functional interface constructors
Allow callable references to Kotlin 'fun interface' constructors. Prohibit callable references to Java SAM interface constructors.
This commit is contained in:
committed by
TeamCityServer
parent
bfb6e73728
commit
1fd0dec5e7
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +AllowKotlinFunInterfaceConstructorReference +ProhibitJavaSamInterfaceConstructorReference
|
||||
|
||||
fun interface Foo {
|
||||
fun run()
|
||||
}
|
||||
|
||||
val x = ::Foo
|
||||
val y = Foo { }
|
||||
val z = ::<!JAVA_SAM_INTERFACE_CONSTRUCTOR_REFERENCE!>Runnable<!>
|
||||
+3
@@ -1,3 +1,6 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: -AllowKotlinFunInterfaceConstructorReference -ProhibitJavaSamInterfaceConstructorReference
|
||||
|
||||
fun interface Foo {
|
||||
fun run()
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
package
|
||||
|
||||
public val x: kotlin.reflect.KFunction1<() -> kotlin.Unit, Foo>
|
||||
public val y: Foo
|
||||
public val z: kotlin.reflect.KFunction1<() -> kotlin.Unit, java.lang.Runnable>
|
||||
|
||||
public fun interface Foo {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public abstract fun run(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
fun interface Foo {
|
||||
fun run()
|
||||
}
|
||||
|
||||
val x = ::<!FUN_INTERFACE_CONSTRUCTOR_REFERENCE!>Foo<!>
|
||||
val y = Foo { }
|
||||
val z = ::<!FUN_INTERFACE_CONSTRUCTOR_REFERENCE!>Runnable<!>
|
||||
Reference in New Issue
Block a user