Kotlin SAM conversion: tolerate property refs used to implement a SAM interface

This commit is contained in:
Chris Smowton
2022-10-13 17:32:22 +01:00
parent 594812640e
commit 1efcf38a34
5 changed files with 233 additions and 1 deletions

View File

@@ -5036,7 +5036,10 @@ open class KotlinFileExtractor(
return
}
if (!st.isFunctionOrKFunction() && !st.isSuspendFunctionOrKFunction()) {
fun IrSimpleType.isKProperty() =
classFqName?.asString()?.startsWith("kotlin.reflect.KProperty") == true
if (!st.isFunctionOrKFunction() && !st.isSuspendFunctionOrKFunction() && !st.isKProperty()) {
logger.errorElement("Expected to find expression with function type in SAM conversion.", e)
return
}