Disallow using named arguments for members of header classes
#KT-17083 Fixed
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
header class Foo(zzz: Int) {
|
||||
constructor(aaa: Boolean)
|
||||
|
||||
fun f1(xxx: String): String
|
||||
}
|
||||
|
||||
header fun f2(xxx: Int)
|
||||
|
||||
fun testCommon() {
|
||||
Foo(<!NAMED_ARGUMENTS_NOT_ALLOWED!>zzz<!> = 0)
|
||||
val f = Foo(<!NAMED_ARGUMENTS_NOT_ALLOWED!>aaa<!> = true)
|
||||
f.f1(<!NAMED_ARGUMENTS_NOT_ALLOWED!>xxx<!> = "")
|
||||
f2(xxx = 42)
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
impl class Foo(val aaa: Boolean) {
|
||||
impl constructor(zzz: Int) : this(zzz == 0)
|
||||
|
||||
impl fun f1(xxx: String) = xxx
|
||||
}
|
||||
|
||||
impl fun f2(xxx: Int) {}
|
||||
|
||||
fun testPlatform() {
|
||||
Foo(zzz = 0)
|
||||
val f = Foo(aaa = true)
|
||||
f.f1(xxx = "")
|
||||
f2(xxx = 42)
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// -- Module: <m1-common> --
|
||||
package
|
||||
|
||||
public header fun f2(/*0*/ xxx: kotlin.Int): kotlin.Unit
|
||||
public fun testCommon(): kotlin.Unit
|
||||
|
||||
public final header class Foo {
|
||||
public constructor Foo(/*0*/ aaa: kotlin.Boolean)
|
||||
public constructor Foo(/*0*/ zzz: kotlin.Int)
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final header fun f1(/*0*/ xxx: kotlin.String): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
|
||||
// -- Module: <m2-jvm> --
|
||||
package
|
||||
|
||||
public impl fun f2(/*0*/ xxx: kotlin.Int): kotlin.Unit
|
||||
public fun testCommon(): kotlin.Unit
|
||||
public fun testPlatform(): kotlin.Unit
|
||||
|
||||
public final impl class Foo {
|
||||
public constructor Foo(/*0*/ aaa: kotlin.Boolean)
|
||||
public constructor Foo(/*0*/ zzz: kotlin.Int)
|
||||
public final val aaa: kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final impl fun f1(/*0*/ xxx: kotlin.String): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user