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(
13361336 }
13371337
13381338 // 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)) {
13401340 logger.errorElement(" Failed to find a class declaring ${callTarget.name} starting at ${receiverClass.name} " , callTarget)
1341- listOf ()
1341+ return listOf ()
13421342 } else {
1343- var subbedType = receiverType
1343+ var subbedType: IrSimpleType = receiverType
13441344 ancestorTypes.forEach {
13451345 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
13471356 }
1348- subbedType.arguments
1357+ return subbedType.arguments
13491358 }
13501359 }
13511360
You can’t perform that action at this time.
0 commit comments