[FIR JS] Add more tests for JS_NAME_CLASH diagnostic
^KT-61862 Related
This commit is contained in:
committed by
Space Team
parent
98fdaeb9a7
commit
f07028959d
+31
@@ -221,3 +221,34 @@ interface MyInterface {
|
||||
}
|
||||
|
||||
class MyClass : ExternalClass(), MyInterface
|
||||
|
||||
// FILE: InheritGenericOutExternalClass.kt
|
||||
package InheritGenericOutExternalClass
|
||||
open external class ExternalClass<out T> {
|
||||
open fun test(x: Int?): T
|
||||
open fun test(x: Int?, y: String?): T
|
||||
}
|
||||
|
||||
class MyClass : ExternalClass<Unit>()
|
||||
|
||||
// FILE: InheritGenericInExternalClass.kt
|
||||
package InheritGenericInExternalClass
|
||||
open external class ExternalClass<in T> {
|
||||
open fun test(x: T?): Int
|
||||
open fun test(x: T?, y: String?): Int
|
||||
}
|
||||
|
||||
class MyClass : ExternalClass<Int>() {
|
||||
fun test(x: Int?, y: Int?) = x ?: y ?: 1
|
||||
}
|
||||
|
||||
// FILE: InheritGenericInExternalClassClash.kt
|
||||
package InheritGenericInExternalClassClash
|
||||
open external class ExternalClass<in T> {
|
||||
open fun test(x: T?): Int
|
||||
<!JS_NAME_CLASH!>open fun test(x: T?, y: String?): Int<!>
|
||||
}
|
||||
|
||||
class MyClass : ExternalClass<Int>() {
|
||||
<!JS_NAME_CLASH!>override fun test(x: Int?)<!> = x ?: 1
|
||||
}
|
||||
|
||||
+64
@@ -17,6 +17,70 @@ package FinalExternalClass {
|
||||
}
|
||||
}
|
||||
|
||||
package InheritGenericInExternalClass {
|
||||
|
||||
public open external class ExternalClass</*0*/ in T> {
|
||||
public constructor ExternalClass</*0*/ in T>()
|
||||
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 fun test(/*0*/ x: T?): kotlin.Int
|
||||
public open fun test(/*0*/ x: T?, /*1*/ y: kotlin.String?): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class MyClass : InheritGenericInExternalClass.ExternalClass<kotlin.Int> {
|
||||
public constructor MyClass()
|
||||
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 test(/*0*/ x: kotlin.Int?): kotlin.Int
|
||||
public final fun test(/*0*/ x: kotlin.Int?, /*1*/ y: kotlin.Int?): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun test(/*0*/ x: kotlin.Int?, /*1*/ y: kotlin.String?): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
package InheritGenericInExternalClassClash {
|
||||
|
||||
public open external class ExternalClass</*0*/ in T> {
|
||||
public constructor ExternalClass</*0*/ in T>()
|
||||
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 fun test(/*0*/ x: T?): kotlin.Int
|
||||
public open fun test(/*0*/ x: T?, /*1*/ y: kotlin.String?): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class MyClass : InheritGenericInExternalClassClash.ExternalClass<kotlin.Int> {
|
||||
public constructor MyClass()
|
||||
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 test(/*0*/ x: kotlin.Int?): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun test(/*0*/ x: kotlin.Int?, /*1*/ y: kotlin.String?): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
package InheritGenericOutExternalClass {
|
||||
|
||||
public open external class ExternalClass</*0*/ out T> {
|
||||
public constructor ExternalClass</*0*/ out T>()
|
||||
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 fun test(/*0*/ x: kotlin.Int?): T
|
||||
public open fun test(/*0*/ x: kotlin.Int?, /*1*/ y: kotlin.String?): T
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class MyClass : InheritGenericOutExternalClass.ExternalClass<kotlin.Unit> {
|
||||
public constructor MyClass()
|
||||
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 test(/*0*/ x: kotlin.Int?): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun test(/*0*/ x: kotlin.Int?, /*1*/ y: kotlin.String?): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
package OpenExternalClassWithFinalMethods {
|
||||
|
||||
public open external class ExternalClass {
|
||||
|
||||
+6
@@ -8352,6 +8352,12 @@ public class FirJsBoxTestGenerated extends AbstractFirJsBoxTest {
|
||||
runTest("js/js.translator/testData/box/nameClashes/overloadMethodsWithSameParameterTypeName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("promiseThen.kt")
|
||||
public void testPromiseThen() throws Exception {
|
||||
runTest("js/js.translator/testData/box/nameClashes/promiseThen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyAndNativeMethod.kt")
|
||||
public void testPropertyAndNativeMethod() throws Exception {
|
||||
|
||||
+6
@@ -8458,6 +8458,12 @@ public class FirJsES6BoxTestGenerated extends AbstractFirJsES6BoxTest {
|
||||
runTest("js/js.translator/testData/box/nameClashes/overloadMethodsWithSameParameterTypeName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("promiseThen.kt")
|
||||
public void testPromiseThen() throws Exception {
|
||||
runTest("js/js.translator/testData/box/nameClashes/promiseThen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyAndNativeMethod.kt")
|
||||
public void testPropertyAndNativeMethod() throws Exception {
|
||||
|
||||
+6
@@ -8458,6 +8458,12 @@ public class IrBoxJsES6TestGenerated extends AbstractIrBoxJsES6Test {
|
||||
runTest("js/js.translator/testData/box/nameClashes/overloadMethodsWithSameParameterTypeName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("promiseThen.kt")
|
||||
public void testPromiseThen() throws Exception {
|
||||
runTest("js/js.translator/testData/box/nameClashes/promiseThen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyAndNativeMethod.kt")
|
||||
public void testPropertyAndNativeMethod() throws Exception {
|
||||
|
||||
+6
@@ -8352,6 +8352,12 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/nameClashes/overloadMethodsWithSameParameterTypeName.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("promiseThen.kt")
|
||||
public void testPromiseThen() throws Exception {
|
||||
runTest("js/js.translator/testData/box/nameClashes/promiseThen.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyAndNativeMethod.kt")
|
||||
public void testPropertyAndNativeMethod() throws Exception {
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
import kotlin.js.Promise
|
||||
|
||||
public class MyPromise(executor: ((Unit) -> Unit, (Throwable) -> Unit) -> Unit) : Promise<Unit>(executor)
|
||||
|
||||
fun box() = "OK"
|
||||
Reference in New Issue
Block a user