Prohibit @JvmName on functions that are assumed to be mangled

#KT-26454 In Progress
This commit is contained in:
Mikhail Zarechenskiy
2018-09-10 10:38:23 +03:00
parent 5f50977974
commit 55ef96e5c9
8 changed files with 52 additions and 9 deletions
@@ -0,0 +1,13 @@
// !LANGUAGE: +InlineClasses
// !DIAGNOSTICS: -UNUSED_PARAMETER
inline class Foo(val x: Int) {
<!INAPPLICABLE_JVM_NAME!>@JvmName("other")<!>
fun simple() {}
}
<!INAPPLICABLE_JVM_NAME!>@JvmName("bad")<!>
fun bar(f: Foo) {}
@JvmName("good")
fun baz(r: Result<Int>) {}
@@ -0,0 +1,13 @@
package
@kotlin.jvm.JvmName(name = "bad") public fun bar(/*0*/ f: Foo): kotlin.Unit
@kotlin.jvm.JvmName(name = "good") public fun baz(/*0*/ r: kotlin.Result<kotlin.Int>): kotlin.Unit
public final inline class Foo {
public constructor Foo(/*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
@kotlin.jvm.JvmName(name = "other") public final fun simple(): kotlin.Unit
public open override /*1*/ /*synthesized*/ fun toString(): kotlin.String
}
@@ -3,22 +3,18 @@
fun foo(x: Int): Int = 0
@JvmName("fooUInt")
fun foo(x: UInt): String = ""
fun foo(x: UByte): String = ""
fun foo(x: UShort): String = ""
fun foo(x: ULong): String = ""
fun fooByte(x: Byte): Int = 0
@JvmName("fooUByte")
fun fooByte(x: UByte): String = ""
fun fooShort(x: Short): Int = 0
@JvmName("fooUByte")
fun fooShort(x: UShort): String = ""
fun fooLong(x: Long): Int = 0
@JvmName("fooULong")
fun fooLong(x: ULong): String = ""
fun test() {
@@ -2,13 +2,13 @@ package
public fun foo(/*0*/ x: kotlin.Int): kotlin.Int
public fun foo(/*0*/ x: kotlin.UByte): kotlin.String
@kotlin.jvm.JvmName(name = "fooUInt") public fun foo(/*0*/ x: kotlin.UInt): kotlin.String
public fun foo(/*0*/ x: kotlin.UInt): kotlin.String
public fun foo(/*0*/ x: kotlin.ULong): kotlin.String
public fun foo(/*0*/ x: kotlin.UShort): kotlin.String
public fun fooByte(/*0*/ x: kotlin.Byte): kotlin.Int
@kotlin.jvm.JvmName(name = "fooUByte") public fun fooByte(/*0*/ x: kotlin.UByte): kotlin.String
public fun fooByte(/*0*/ x: kotlin.UByte): kotlin.String
public fun fooLong(/*0*/ x: kotlin.Long): kotlin.Int
@kotlin.jvm.JvmName(name = "fooULong") public fun fooLong(/*0*/ x: kotlin.ULong): kotlin.String
public fun fooLong(/*0*/ x: kotlin.ULong): kotlin.String
public fun fooShort(/*0*/ x: kotlin.Short): kotlin.Int
@kotlin.jvm.JvmName(name = "fooUByte") public fun fooShort(/*0*/ x: kotlin.UShort): kotlin.String
public fun fooShort(/*0*/ x: kotlin.UShort): kotlin.String
public fun test(): kotlin.Unit