Devirtualization: bug fix
This commit is contained in:
+7
@@ -355,6 +355,7 @@ internal object Devirtualization {
|
||||
if (node.receiverType == DataFlowIR.Type.Virtual)
|
||||
continue@nodeLoop
|
||||
val receiverType = node.receiverType.resolved()
|
||||
val vCallReturnType = node.returnType.resolved()
|
||||
|
||||
DEBUG_OUTPUT(1) {
|
||||
println("Adding virtual callsite:")
|
||||
@@ -368,6 +369,12 @@ internal object Devirtualization {
|
||||
.forEach { println(" $it") }
|
||||
}
|
||||
|
||||
if (entryPoint == null && vCallReturnType.isFinal) {
|
||||
// If we are in a library and facing final return type then
|
||||
// this type can be returned by some user of this library, so propagate it explicitly.
|
||||
addInstantiatingClass(vCallReturnType)
|
||||
}
|
||||
|
||||
typesVirtualCallSites.getOrPut(receiverType, { mutableListOf() }).add(node)
|
||||
typeHierarchy.inheritorsOf(receiverType)
|
||||
.filter { instantiatingClasses.contains(it) }
|
||||
|
||||
Reference in New Issue
Block a user