File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
java/kotlin-extractor/src/main/kotlin Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -1336,16 +1336,25 @@ open class KotlinFileExtractor(
1336
1336
}
1337
1337
1338
1338
// If a path was found, repeatedly substitute types to get the corresponding specialisation of that ancestor.
1339
- return if (! walkFrom(receiverClass)) {
1339
+ if (! walkFrom(receiverClass)) {
1340
1340
logger.errorElement(" Failed to find a class declaring ${callTarget.name} starting at ${receiverClass.name} " , callTarget)
1341
- listOf ()
1341
+ return listOf ()
1342
1342
} else {
1343
- var subbedType = receiverType
1343
+ var subbedType: IrSimpleType = receiverType
1344
1344
ancestorTypes.forEach {
1345
1345
val thisClass = subbedType.classifier.owner as IrClass
1346
- subbedType = it.substituteTypeArguments(thisClass.typeParameters, subbedType.arguments) as IrSimpleType
1346
+ if (thisClass !is IrClass ) {
1347
+ logger.errorElement(" Found ancestor with unexpected type ${thisClass.javaClass} " , callTarget)
1348
+ return listOf ()
1349
+ }
1350
+ val itSubbed = it.substituteTypeArguments(thisClass.typeParameters, subbedType.arguments)
1351
+ if (itSubbed !is IrSimpleType ) {
1352
+ logger.errorElement(" Substituted type has unexpected type ${itSubbed.javaClass} " , callTarget)
1353
+ return listOf ()
1354
+ }
1355
+ subbedType = itSubbed
1347
1356
}
1348
- subbedType.arguments
1357
+ return subbedType.arguments
1349
1358
}
1350
1359
}
1351
1360
You can’t perform that action at this time.
0 commit comments