JS: don't write native superclass to metadata. Fix KT-15007
This commit is contained in:
@@ -6758,6 +6758,12 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("exceptionIsInterface.kt")
|
||||||
|
public void testExceptionIsInterface() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/rtti/exceptionIsInterface.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("isComparable.kt")
|
@TestMetadata("isComparable.kt")
|
||||||
public void testIsComparable() throws Exception {
|
public void testIsComparable() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/rtti/isComparable.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/rtti/isComparable.kt");
|
||||||
@@ -6841,6 +6847,12 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
|||||||
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/rtti/stdlibEmptyListClass.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/rtti/stdlibEmptyListClass.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("subclassOfNativeIsInterface.kt")
|
||||||
|
public void testSubclassOfNativeIsInterface() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("js/js.translator/testData/box/rtti/subclassOfNativeIsInterface.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("js/js.translator/testData/box/safeCall")
|
@TestMetadata("js/js.translator/testData/box/safeCall")
|
||||||
|
|||||||
+9
-2
@@ -376,7 +376,12 @@ class ClassTranslator private constructor(
|
|||||||
if (supertypes.size == 1) {
|
if (supertypes.size == 1) {
|
||||||
val type = supertypes[0]
|
val type = supertypes[0]
|
||||||
val supertypeDescriptor = getClassDescriptorForType(type)
|
val supertypeDescriptor = getClassDescriptorForType(type)
|
||||||
return listOf(ReferenceTranslator.translateAsTypeReference(supertypeDescriptor, context()))
|
return if (!AnnotationsUtils.isNativeObject(supertypeDescriptor)) {
|
||||||
|
listOf(ReferenceTranslator.translateAsTypeReference(supertypeDescriptor, context()))
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
listOf()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val supertypeConstructors = mutableSetOf<TypeConstructor>()
|
val supertypeConstructors = mutableSetOf<TypeConstructor>()
|
||||||
@@ -392,7 +397,9 @@ class ClassTranslator private constructor(
|
|||||||
for (typeConstructor in sortedAllSuperTypes) {
|
for (typeConstructor in sortedAllSuperTypes) {
|
||||||
if (supertypeConstructors.contains(typeConstructor)) {
|
if (supertypeConstructors.contains(typeConstructor)) {
|
||||||
val supertypeDescriptor = getClassDescriptorForTypeConstructor(typeConstructor)
|
val supertypeDescriptor = getClassDescriptorForTypeConstructor(typeConstructor)
|
||||||
supertypesRefs += ReferenceTranslator.translateAsTypeReference(supertypeDescriptor, context())
|
if (!AnnotationsUtils.isNativeObject(supertypeDescriptor)) {
|
||||||
|
supertypesRefs += ReferenceTranslator.translateAsTypeReference(supertypeDescriptor, context())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return supertypesRefs
|
return supertypesRefs
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
interface I
|
||||||
|
|
||||||
|
class MyException: Exception(), I
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
var e: Any = MyException()
|
||||||
|
if (e !is I) return "fail1"
|
||||||
|
|
||||||
|
e = Exception()
|
||||||
|
if (e is I) return "fail2"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
function A() {
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
@native open class A
|
||||||
|
|
||||||
|
interface I
|
||||||
|
|
||||||
|
class B : A(), I
|
||||||
|
|
||||||
|
open class C : A()
|
||||||
|
|
||||||
|
class D : C(), I
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
var a: Any = A()
|
||||||
|
if (a is I) return "fail1"
|
||||||
|
|
||||||
|
a = B()
|
||||||
|
if (a !is I) return "fail2"
|
||||||
|
|
||||||
|
a = D()
|
||||||
|
if (a !is I) return "fail3"
|
||||||
|
|
||||||
|
a = C()
|
||||||
|
if (a is I) return "fail4"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user