[JS IR] Fix findInterfaceImplementation
isOrOverridesSynthesized uses descriptors which does not work with wrapped descriptors
This commit is contained in:
Generated
+5
@@ -27581,6 +27581,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/regressions/kt3903.kt");
|
runTest("compiler/testData/codegen/box/regressions/kt3903.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt39088.kt")
|
||||||
|
public void testKt39088() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/regressions/kt39088.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt4142.kt")
|
@TestMetadata("kt4142.kt")
|
||||||
public void testKt4142() throws Exception {
|
public void testKt4142() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/regressions/kt4142.kt");
|
runTest("compiler/testData/codegen/box/regressions/kt4142.kt");
|
||||||
|
|||||||
@@ -234,8 +234,6 @@ val IrBody.statements: List<IrStatement>
|
|||||||
val IrClass.defaultType: IrSimpleType
|
val IrClass.defaultType: IrSimpleType
|
||||||
get() = this.thisReceiver!!.type as IrSimpleType
|
get() = this.thisReceiver!!.type as IrSimpleType
|
||||||
|
|
||||||
val IrSimpleFunction.isSynthesized: Boolean get() = descriptor.kind == CallableMemberDescriptor.Kind.SYNTHESIZED
|
|
||||||
|
|
||||||
fun IrClass.isSubclassOf(ancestor: IrClass): Boolean {
|
fun IrClass.isSubclassOf(ancestor: IrClass): Boolean {
|
||||||
|
|
||||||
val alreadyVisited = mutableSetOf<IrClass>()
|
val alreadyVisited = mutableSetOf<IrClass>()
|
||||||
@@ -252,19 +250,9 @@ fun IrClass.isSubclassOf(ancestor: IrClass): Boolean {
|
|||||||
return this.hasAncestorInSuperTypes()
|
return this.hasAncestorInSuperTypes()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun IrSimpleFunction.isOrOverridesSynthesized(): Boolean {
|
|
||||||
if (isSynthesized) return true
|
|
||||||
|
|
||||||
if (isFakeOverride) return overriddenSymbols.all { it.owner.isOrOverridesSynthesized() }
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
fun IrSimpleFunction.findInterfaceImplementation(): IrSimpleFunction? {
|
fun IrSimpleFunction.findInterfaceImplementation(): IrSimpleFunction? {
|
||||||
if (isReal) return null
|
if (isReal) return null
|
||||||
|
|
||||||
if (isOrOverridesSynthesized()) return null
|
|
||||||
|
|
||||||
return resolveFakeOverride()?.run { if (parentAsClass.isInterface) this else null }
|
return resolveFakeOverride()?.run { if (parentAsClass.isInterface) this else null }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
// MODULE: lib
|
||||||
|
// FILE: lib.kt
|
||||||
|
|
||||||
|
package lib
|
||||||
|
|
||||||
|
interface Stoppable {
|
||||||
|
fun isStopped(): Boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
interface EventRo : Stoppable
|
||||||
|
|
||||||
|
interface Event : Stoppable {
|
||||||
|
override fun isStopped(): Boolean {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class EventBase : Event
|
||||||
|
|
||||||
|
interface MouseEventRo : EventRo
|
||||||
|
|
||||||
|
open class MouseEvent : EventBase(), MouseEventRo
|
||||||
|
|
||||||
|
// MODULE: main(lib)
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
if (lib.MouseEvent().isStopped()) {
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
|
||||||
|
return "Fail"
|
||||||
|
}
|
||||||
+5
@@ -29167,6 +29167,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/regressions/kt3903.kt");
|
runTest("compiler/testData/codegen/box/regressions/kt3903.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt39088.kt")
|
||||||
|
public void testKt39088() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/regressions/kt39088.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt4142.kt")
|
@TestMetadata("kt4142.kt")
|
||||||
public void testKt4142() throws Exception {
|
public void testKt4142() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/regressions/kt4142.kt");
|
runTest("compiler/testData/codegen/box/regressions/kt4142.kt");
|
||||||
|
|||||||
+5
@@ -26801,6 +26801,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/regressions/kt3903.kt");
|
runTest("compiler/testData/codegen/box/regressions/kt3903.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt39088.kt")
|
||||||
|
public void testKt39088() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/regressions/kt39088.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt4142.kt")
|
@TestMetadata("kt4142.kt")
|
||||||
public void testKt4142() throws Exception {
|
public void testKt4142() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/regressions/kt4142.kt");
|
runTest("compiler/testData/codegen/box/regressions/kt4142.kt");
|
||||||
|
|||||||
+5
@@ -27581,6 +27581,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/regressions/kt3903.kt");
|
runTest("compiler/testData/codegen/box/regressions/kt3903.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt39088.kt")
|
||||||
|
public void testKt39088() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/regressions/kt39088.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt4142.kt")
|
@TestMetadata("kt4142.kt")
|
||||||
public void testKt4142() throws Exception {
|
public void testKt4142() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/regressions/kt4142.kt");
|
runTest("compiler/testData/codegen/box/regressions/kt4142.kt");
|
||||||
|
|||||||
Generated
+5
@@ -22642,6 +22642,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
|||||||
runTest("compiler/testData/codegen/box/regressions/kt3903.kt");
|
runTest("compiler/testData/codegen/box/regressions/kt3903.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt39088.kt")
|
||||||
|
public void testKt39088() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/regressions/kt39088.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt4142.kt")
|
@TestMetadata("kt4142.kt")
|
||||||
public void testKt4142() throws Exception {
|
public void testKt4142() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/regressions/kt4142.kt");
|
runTest("compiler/testData/codegen/box/regressions/kt4142.kt");
|
||||||
|
|||||||
Generated
+5
@@ -22697,6 +22697,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/regressions/kt3903.kt");
|
runTest("compiler/testData/codegen/box/regressions/kt3903.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt39088.kt")
|
||||||
|
public void testKt39088() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/regressions/kt39088.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt4142.kt")
|
@TestMetadata("kt4142.kt")
|
||||||
public void testKt4142() throws Exception {
|
public void testKt4142() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/regressions/kt4142.kt");
|
runTest("compiler/testData/codegen/box/regressions/kt4142.kt");
|
||||||
|
|||||||
+5
@@ -22712,6 +22712,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/regressions/kt3903.kt");
|
runTest("compiler/testData/codegen/box/regressions/kt3903.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt39088.kt")
|
||||||
|
public void testKt39088() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/regressions/kt39088.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt4142.kt")
|
@TestMetadata("kt4142.kt")
|
||||||
public void testKt4142() throws Exception {
|
public void testKt4142() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/regressions/kt4142.kt");
|
runTest("compiler/testData/codegen/box/regressions/kt4142.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user