mirror of
https://github.com/github/codeql.git
synced 2025-12-18 01:33:15 +01:00
Add some error handling
This commit is contained in:
@@ -2917,8 +2917,22 @@ open class KotlinFileExtractor(
|
||||
}
|
||||
|
||||
val functionType = if (e.argument.type.isKFunction()) {
|
||||
// todo: add error handling to the below
|
||||
getFunctionalInterfaceType((e.argument.type as IrSimpleType).arguments.filterIsInstance<IrTypeProjection>().map { it.type })
|
||||
val st = e.argument.type as? IrSimpleType
|
||||
if (st == null) {
|
||||
logger.errorElement("Expected to find a simple type in SAM conversion.", e)
|
||||
return
|
||||
}
|
||||
|
||||
val typeArgs = mutableListOf<IrType>()
|
||||
for (arg in st.arguments) {
|
||||
if (arg !is IrTypeProjection) {
|
||||
logger.errorElement("Expected to find only type projections in SAM conversion.", e)
|
||||
return
|
||||
}
|
||||
typeArgs.add(arg.type)
|
||||
}
|
||||
|
||||
getFunctionalInterfaceType(typeArgs)
|
||||
} else {
|
||||
e.argument.type
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user