Make parameter names of fictitious function classes non-stable
To be able to change them when overriding invoke in subclasses without a warning
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
class Function1Impl : (String) -> Unit {
|
||||
override fun invoke(myParamName: String) {}
|
||||
}
|
||||
|
||||
fun test1(f: Function1Impl) {
|
||||
f("")
|
||||
f(<!NAMED_PARAMETER_NOT_FOUND!>p0<!> = ""<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
f(myParamName = "")
|
||||
f.invoke("")
|
||||
f.invoke(<!NAMED_PARAMETER_NOT_FOUND!>p0<!> = ""<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
f.invoke(myParamName = "")
|
||||
}
|
||||
|
||||
fun test2(f: (String) -> Unit) {
|
||||
f("")
|
||||
f(<!NAMED_ARGUMENTS_NOT_ALLOWED, NAMED_PARAMETER_NOT_FOUND!>p0<!> = ""<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
f(<!NAMED_ARGUMENTS_NOT_ALLOWED, NAMED_PARAMETER_NOT_FOUND!>myParamName<!> = ""<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
f.invoke("")
|
||||
f.invoke(<!NAMED_ARGUMENTS_NOT_ALLOWED, NAMED_PARAMETER_NOT_FOUND!>p0<!> = ""<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
f.invoke(<!NAMED_ARGUMENTS_NOT_ALLOWED, NAMED_PARAMETER_NOT_FOUND!>myParamName<!> = ""<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
}
|
||||
|
||||
fun test3(f: String.(String) -> Unit) {
|
||||
"".f("")
|
||||
"".f(<!NAMED_PARAMETER_NOT_FOUND!>p0<!> = ""<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
"".f(<!NAMED_PARAMETER_NOT_FOUND!>zzz<!> = ""<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package
|
||||
|
||||
internal fun test1(/*0*/ f: Function1Impl): kotlin.Unit
|
||||
internal fun test2(/*0*/ f: (kotlin.String) -> kotlin.Unit): kotlin.Unit
|
||||
internal fun test3(/*0*/ f: kotlin.String.(kotlin.String) -> kotlin.Unit): kotlin.Unit
|
||||
|
||||
internal final class Function1Impl : (kotlin.String) -> kotlin.Unit {
|
||||
public constructor Function1Impl()
|
||||
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*/ myParamName: kotlin.String): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
// !DIAGNOSTICS: -PARAMETER_NAME_CHANGED_ON_OVERRIDE
|
||||
|
||||
//If this test hangs, it means something is broken.
|
||||
object A {
|
||||
val iii = 42
|
||||
|
||||
Reference in New Issue
Block a user