KT-43525 forbid @JvmOverloads on mangled funs and hidden constructors
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
|
||||
inline class Str(val s: String)
|
||||
|
||||
@JvmOverloads
|
||||
fun test(so: String = "O", sk: String = "K") = Str(so + sk)
|
||||
|
||||
fun box(): String =
|
||||
test().s
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
|
||||
inline class Z(val x: Int)
|
||||
|
||||
@JvmOverloads
|
||||
fun testTopLevelFunction(x: Int = 0): Z = Z(x)
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
@kotlin.Metadata
|
||||
public final class JvmOverloadsOnTopLevelFunctionReturningInlineClassValueKt {
|
||||
// source: 'jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt'
|
||||
public synthetic static method testTopLevelFunction$default(p0: int, p1: int, p2: java.lang.Object): int
|
||||
public final static @kotlin.jvm.JvmOverloads method testTopLevelFunction(): int
|
||||
public final static @kotlin.jvm.JvmOverloads method testTopLevelFunction(p0: int): int
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Z {
|
||||
// source: 'jvmOverloadsOnTopLevelFunctionReturningInlineClassValue.kt'
|
||||
private final field x: int
|
||||
private synthetic method <init>(p0: int): void
|
||||
public synthetic final static method box-impl(p0: int): Z
|
||||
public static method constructor-impl(p0: int): int
|
||||
public method equals(p0: java.lang.Object): boolean
|
||||
public static method equals-impl(p0: int, p1: java.lang.Object): boolean
|
||||
public final static method equals-impl0(p0: int, p1: int): boolean
|
||||
public final method getX(): int
|
||||
public method hashCode(): int
|
||||
public static method hashCode-impl(p0: int): int
|
||||
public method toString(): java.lang.String
|
||||
public static method toString-impl(p0: int): java.lang.String
|
||||
public synthetic final method unbox-impl(): int
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
inline class Z(val x: Int)
|
||||
|
||||
@JvmOverloads
|
||||
fun testTopLevelFunction1(z: Z, x: Int = 0) {}
|
||||
|
||||
@JvmOverloads
|
||||
fun testTopLevelFunction2(x: Int, z: Z = Z(0)) {}
|
||||
|
||||
@JvmOverloads
|
||||
fun testTopLevelFunction3(x: Int = 0): Z = Z(x)
|
||||
|
||||
class C {
|
||||
@JvmOverloads
|
||||
constructor(i: Int, z: Z = Z(0))
|
||||
|
||||
@JvmOverloads
|
||||
constructor(s: String, z: Z, i: Int = 0)
|
||||
|
||||
@JvmOverloads
|
||||
fun testMemberFunction1(z: Z, x: Int = 0) {}
|
||||
|
||||
@JvmOverloads
|
||||
fun testMemberFunction2(x: Int, z: Z = Z(0)) {}
|
||||
|
||||
@JvmOverloads
|
||||
fun testMemberFunction3(x: Int = 0): Z = Z(x)
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !LANGUAGE: +InlineClasses
|
||||
|
||||
inline class Z(val x: Int)
|
||||
|
||||
<!OVERLOADS_ANNOTATION_MANGLED_FUNCTION!>@JvmOverloads<!>
|
||||
fun testTopLevelFunction1(z: Z, x: Int = 0) {}
|
||||
|
||||
<!OVERLOADS_ANNOTATION_MANGLED_FUNCTION!>@JvmOverloads<!>
|
||||
fun testTopLevelFunction2(x: Int, z: Z = Z(0)) {}
|
||||
|
||||
@JvmOverloads
|
||||
fun testTopLevelFunction3(x: Int = 0): Z = Z(x)
|
||||
|
||||
class C {
|
||||
<!OVERLOADS_ANNOTATION_HIDDEN_CONSTRUCTOR!>@JvmOverloads<!>
|
||||
constructor(i: Int, z: Z = Z(0))
|
||||
|
||||
<!OVERLOADS_ANNOTATION_HIDDEN_CONSTRUCTOR!>@JvmOverloads<!>
|
||||
constructor(s: String, z: Z, i: Int = 0)
|
||||
|
||||
<!OVERLOADS_ANNOTATION_MANGLED_FUNCTION!>@JvmOverloads<!>
|
||||
fun testMemberFunction1(z: Z, x: Int = 0) {}
|
||||
|
||||
<!OVERLOADS_ANNOTATION_MANGLED_FUNCTION!>@JvmOverloads<!>
|
||||
fun testMemberFunction2(x: Int, z: Z = Z(0)) {}
|
||||
|
||||
<!OVERLOADS_ANNOTATION_MANGLED_FUNCTION!>@JvmOverloads<!>
|
||||
fun testMemberFunction3(x: Int = 0): Z = Z(x)
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package
|
||||
|
||||
@kotlin.jvm.JvmOverloads public fun testTopLevelFunction1(/*0*/ z: Z, /*1*/ x: kotlin.Int = ...): kotlin.Unit
|
||||
@kotlin.jvm.JvmOverloads public fun testTopLevelFunction2(/*0*/ x: kotlin.Int, /*1*/ z: Z = ...): kotlin.Unit
|
||||
@kotlin.jvm.JvmOverloads public fun testTopLevelFunction3(/*0*/ x: kotlin.Int = ...): Z
|
||||
|
||||
public final class C {
|
||||
@kotlin.jvm.JvmOverloads public constructor C(/*0*/ i: kotlin.Int, /*1*/ z: Z = ...)
|
||||
@kotlin.jvm.JvmOverloads public constructor C(/*0*/ s: kotlin.String, /*1*/ z: Z, /*2*/ i: kotlin.Int = ...)
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
@kotlin.jvm.JvmOverloads public final fun testMemberFunction1(/*0*/ z: Z, /*1*/ x: kotlin.Int = ...): kotlin.Unit
|
||||
@kotlin.jvm.JvmOverloads public final fun testMemberFunction2(/*0*/ x: kotlin.Int, /*1*/ z: Z = ...): kotlin.Unit
|
||||
@kotlin.jvm.JvmOverloads public final fun testMemberFunction3(/*0*/ x: kotlin.Int = ...): Z
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final inline class Z {
|
||||
public constructor Z(/*0*/ x: kotlin.Int)
|
||||
public final val x: kotlin.Int
|
||||
public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user