[K2] Disappeared UNSUPPORTED

Prohibit named parameters in function types in supertype position

^KT-59881
This commit is contained in:
Anastasia.Nekrasova
2023-11-23 13:55:46 +02:00
committed by Space Team
parent 5147a5e805
commit 00119c6a97
8 changed files with 78 additions and 22 deletions
@@ -1,9 +0,0 @@
abstract class A : Function1<Any, Unit>
abstract class B : (Int)->Unit
// Named parameter is prohibited because of possible inconsistency between
// type declaration and actual override
class C : (x: Int)->Unit {
override fun invoke(p1: Int): Unit {}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
abstract class A : Function1<Any, Unit>
abstract class B : (Int)->Unit
@@ -6,4 +7,14 @@ abstract class B : (Int)->Unit
// type declaration and actual override
class C : (<!UNSUPPORTED!>x<!>: Int)->Unit {
override fun invoke(p1: Int): Unit {}
}
}
class D : (<!UNSUPPORTED!>Int<!>: Int)->Unit {
override fun invoke(p1: Int): Unit {}
}
class E : ((k: String) -> Unit) -> Unit {
override fun invoke(p1: (k: String) -> Unit) {
}
}
@@ -23,3 +23,20 @@ public final class C : (x: kotlin.Int) -> kotlin.Unit {
public open override /*1*/ fun invoke(/*0*/ p1: kotlin.Int): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class D : (Int: kotlin.Int) -> kotlin.Unit {
public constructor D()
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 open override /*1*/ fun invoke(/*0*/ p1: kotlin.Int): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class E : ((k: kotlin.String) -> kotlin.Unit) -> kotlin.Unit {
public constructor E()
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 open override /*1*/ fun invoke(/*0*/ p1: (k: kotlin.String) -> kotlin.Unit): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -1 +0,0 @@
class A : (categoryName: <!SYNTAX!><!>)<!SYNTAX!><!> <!SYNTAX!><!>{<!SYNTAX!><!>
@@ -1 +1,2 @@
// FIR_IDENTICAL
class A : (<!UNSUPPORTED!>categoryName<!>: <!SYNTAX!><!>)<!SYNTAX!><!> <!SYNTAX!><!>{<!SYNTAX!><!>
@@ -1,3 +0,0 @@
package typeReferenceError
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class Pair<!><<!SYNTAX!><!>:(<!UNSUPPORTED!>val<!> c: <!SYNTAX!><!SYNTAX!><!>fun<!><!SYNTAX!><!> <!UNRESOLVED_REFERENCE!>main<!><!NO_CONSTRUCTOR!>()<!>
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
package typeReferenceError
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class Pair<!><<!SYNTAX!><!>:(<!UNSUPPORTED!>val<!> <!UNSUPPORTED!>c<!>: <!SYNTAX!><!SYNTAX!><!>fun<!><!SYNTAX!><!> <!UNRESOLVED_REFERENCE!>main<!><!NO_CONSTRUCTOR!>()<!>