Fixed bug in vTable building + test
This commit is contained in:
+1
-1
@@ -89,7 +89,7 @@ internal class SpecialDeclarationsFactory(val context: Context) {
|
|||||||
val irFunction = overriddenFunctionDescriptor.descriptor
|
val irFunction = overriddenFunctionDescriptor.descriptor
|
||||||
val descriptor = irFunction.descriptor
|
val descriptor = irFunction.descriptor
|
||||||
assert(overriddenFunctionDescriptor.needBridge,
|
assert(overriddenFunctionDescriptor.needBridge,
|
||||||
{ "Function $descriptor is not needed in a bridge to call overridden function ${overriddenFunctionDescriptor.overriddenDescriptor}" })
|
{ "Function $descriptor is not needed in a bridge to call overridden function ${overriddenFunctionDescriptor.overriddenDescriptor.descriptor}" })
|
||||||
val bridgeDirections = overriddenFunctionDescriptor.bridgeDirections
|
val bridgeDirections = overriddenFunctionDescriptor.bridgeDirections
|
||||||
return bridgesDescriptors.getOrPut(irFunction to bridgeDirections) {
|
return bridgesDescriptors.getOrPut(irFunction to bridgeDirections) {
|
||||||
val newDescriptor = SimpleFunctionDescriptorImpl.create(
|
val newDescriptor = SimpleFunctionDescriptorImpl.create(
|
||||||
|
|||||||
+2
@@ -186,4 +186,6 @@ private val IrClass.sortedOverridableOrOverridingMethods: List<SimpleFunctionDes
|
|||||||
get() =
|
get() =
|
||||||
this.simpleFunctions()
|
this.simpleFunctions()
|
||||||
.filter { it.isOverridable || it.overriddenSymbols.isNotEmpty() }
|
.filter { it.isOverridable || it.overriddenSymbols.isNotEmpty() }
|
||||||
|
// TODO: extract method .isBridge()
|
||||||
|
.filterNot { it.name.asString().contains("<bridge-") }
|
||||||
.sortedBy { it.functionName.localHash.value }
|
.sortedBy { it.functionName.localHash.value }
|
||||||
|
|||||||
@@ -958,6 +958,12 @@ task bridges_linkTest(type: LinkKonanTest) {
|
|||||||
lib = "codegen/bridges/linkTest_lib.kt"
|
lib = "codegen/bridges/linkTest_lib.kt"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task bridges_linkTest2(type: LinkKonanTest) {
|
||||||
|
goldValue = "true\n"
|
||||||
|
source = "codegen/bridges/linkTest2_main.kt"
|
||||||
|
lib = "codegen/bridges/linkTest2_lib.kt"
|
||||||
|
}
|
||||||
|
|
||||||
task bridges_special(type: RunKonanTest) {
|
task bridges_special(type: RunKonanTest) {
|
||||||
goldValue = "Ok\n"
|
goldValue = "Ok\n"
|
||||||
source = "codegen/bridges/special.kt"
|
source = "codegen/bridges/special.kt"
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
sealed class Tag {
|
||||||
|
abstract fun value(): Any
|
||||||
|
}
|
||||||
|
|
||||||
|
sealed class TagBoolean : Tag() {
|
||||||
|
abstract override fun value(): Boolean
|
||||||
|
|
||||||
|
object True : TagBoolean() {
|
||||||
|
override fun value() = true
|
||||||
|
}
|
||||||
|
|
||||||
|
object False : TagBoolean() {
|
||||||
|
override fun value() = false
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
fun main(args: Array<String>) {
|
||||||
|
val test: TagBoolean = TagBoolean.True
|
||||||
|
println(test.value())
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user