[JS FIR] Add JS_NAME_CLASH tests for constructors
^KT-64867 Related
This commit is contained in:
committed by
Space Team
parent
5da4d31d37
commit
3dd4a0d868
+49
@@ -0,0 +1,49 @@
|
||||
// FIR_DIFFERENCE
|
||||
// K1 doesn't detect a clash between constructors in one class.
|
||||
// It doesn't seem correct (KT-64976) because it leads to a clash in the generated JS code. K2 works correctly.
|
||||
// !DIAGNOSTICS: -OPT_IN_USAGE
|
||||
|
||||
@JsExport
|
||||
class ClassA {
|
||||
val x: String
|
||||
|
||||
@JsName("constructorA")
|
||||
constructor(y: String) {
|
||||
x = "fromString:$y"
|
||||
}
|
||||
|
||||
@JsName("constructorOther")
|
||||
constructor(y: Int) {
|
||||
x = "fromInt:$y"
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
class ClassB {
|
||||
val x: String
|
||||
|
||||
@JsName("constructorB")
|
||||
constructor(y: String) {
|
||||
x = "fromString:$y"
|
||||
}
|
||||
|
||||
@JsName("constructorOther")
|
||||
constructor(y: Int) {
|
||||
x = "fromInt:$y"
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
class ClassC {
|
||||
val x: String
|
||||
|
||||
@JsName("constructorC")
|
||||
<!JS_NAME_CLASH!>constructor(y: String)<!> {
|
||||
x = "fromString:$y"
|
||||
}
|
||||
|
||||
@JsName("constructorC")
|
||||
<!JS_NAME_CLASH!>constructor(y: Int)<!> {
|
||||
x = "fromInt:$y"
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
// FIR_DIFFERENCE
|
||||
// K1 doesn't detect a clash between constructors in one class.
|
||||
// It doesn't seem correct (KT-64976) because it leads to a clash in the generated JS code. K2 works correctly.
|
||||
// !DIAGNOSTICS: -OPT_IN_USAGE
|
||||
|
||||
@JsExport
|
||||
class ClassA {
|
||||
val x: String
|
||||
|
||||
@JsName("constructorA")
|
||||
constructor(y: String) {
|
||||
x = "fromString:$y"
|
||||
}
|
||||
|
||||
@JsName("constructorOther")
|
||||
constructor(y: Int) {
|
||||
x = "fromInt:$y"
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
class ClassB {
|
||||
val x: String
|
||||
|
||||
@JsName("constructorB")
|
||||
constructor(y: String) {
|
||||
x = "fromString:$y"
|
||||
}
|
||||
|
||||
@JsName("constructorOther")
|
||||
constructor(y: Int) {
|
||||
x = "fromInt:$y"
|
||||
}
|
||||
}
|
||||
|
||||
@JsExport
|
||||
class ClassC {
|
||||
val x: String
|
||||
|
||||
@JsName("constructorC")
|
||||
constructor(y: String) {
|
||||
x = "fromString:$y"
|
||||
}
|
||||
|
||||
@JsName("constructorC")
|
||||
constructor(y: Int) {
|
||||
x = "fromInt:$y"
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package
|
||||
|
||||
@kotlin.js.JsExport public final class ClassA {
|
||||
@kotlin.js.JsName(name = "constructorOther") public constructor ClassA(/*0*/ y: kotlin.Int)
|
||||
@kotlin.js.JsName(name = "constructorA") public constructor ClassA(/*0*/ y: kotlin.String)
|
||||
public final val x: kotlin.String
|
||||
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*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.js.JsExport public final class ClassB {
|
||||
@kotlin.js.JsName(name = "constructorOther") public constructor ClassB(/*0*/ y: kotlin.Int)
|
||||
@kotlin.js.JsName(name = "constructorB") public constructor ClassB(/*0*/ y: kotlin.String)
|
||||
public final val x: kotlin.String
|
||||
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*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@kotlin.js.JsExport public final class ClassC {
|
||||
@kotlin.js.JsName(name = "constructorC") public constructor ClassC(/*0*/ y: kotlin.Int)
|
||||
@kotlin.js.JsName(name = "constructorC") public constructor ClassC(/*0*/ y: kotlin.String)
|
||||
public final val x: kotlin.String
|
||||
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*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user