File tree Expand file tree Collapse file tree
java/kotlin-extractor/src/main/kotlin Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2917,8 +2917,22 @@ open class KotlinFileExtractor(
29172917 }
29182918
29192919 val functionType = if (e.argument.type.isKFunction()) {
2920- // todo: add error handling to the below
2921- getFunctionalInterfaceType((e.argument.type as IrSimpleType ).arguments.filterIsInstance<IrTypeProjection >().map { it.type })
2920+ val st = e.argument.type as ? IrSimpleType
2921+ if (st == null ) {
2922+ logger.errorElement(" Expected to find a simple type in SAM conversion." , e)
2923+ return
2924+ }
2925+
2926+ val typeArgs = mutableListOf<IrType >()
2927+ for (arg in st.arguments) {
2928+ if (arg !is IrTypeProjection ) {
2929+ logger.errorElement(" Expected to find only type projections in SAM conversion." , e)
2930+ return
2931+ }
2932+ typeArgs.add(arg.type)
2933+ }
2934+
2935+ getFunctionalInterfaceType(typeArgs)
29222936 } else {
29232937 e.argument.type
29242938 }
You can’t perform that action at this time.
0 commit comments