Fix constructor call type access

This commit is contained in:
Tamas Vajk
2021-11-18 12:17:31 +01:00
committed by Ian Lynagh
parent b7e0828f78
commit b7faa33c60
7 changed files with 44 additions and 29 deletions

View File

@@ -1807,10 +1807,22 @@ open class KotlinFileExtractor(
extractExpressionExpr(dr, callable, id, -2)
}
val typeAccessType = if (isAnonymous) {
val c = (e.type as IrSimpleType).classifier.owner as IrClass
if (c.superTypes.size == 1) {
useType(c.superTypes.first())
} else {
useType(pluginContext.irBuiltIns.anyType)
}
} else {
type
}
val typeAccessId = tw.getFreshIdLabel<DbUnannotatedtypeaccess>()
tw.writeExprs_unannotatedtypeaccess(typeAccessId, typeAccessType.javaResult.id, typeAccessType.kotlinResult.id, id, -3)
tw.writeCallableEnclosingExpr(typeAccessId, callable)
if (e.typeArgumentsCount > 0) {
val typeAccessId = tw.getFreshIdLabel<DbUnannotatedtypeaccess>()
tw.writeExprs_unannotatedtypeaccess(typeAccessId, type.javaResult.id, type.kotlinResult.id, id, -3)
tw.writeCallableEnclosingExpr(typeAccessId, callable)
extractTypeArguments(e, typeAccessId, callable)
}
}