Skip to content

Commit 33e11b3

Browse files
committed
Kotlin: Simplify samMember computation
1 parent 4a02505 commit 33e11b3

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4057,17 +4057,14 @@ open class KotlinFileExtractor(
40574057
}
40584058

40594059
val typeOwner = e.typeOperandClassifier.owner
4060-
val samMember = if (typeOwner !is IrClass) {
4060+
if (typeOwner !is IrClass) {
40614061
logger.errorElement("Expected to find SAM conversion to IrClass. Found '${typeOwner.javaClass}' instead. Can't implement SAM interface.", e)
40624062
return
4063-
} else {
4064-
val samMember = typeOwner.declarations.filterIsInstance<IrFunction>().find { it is IrOverridableMember && it.modality == Modality.ABSTRACT }
4065-
if (samMember == null) {
4066-
logger.errorElement("Couldn't find SAM member in type '${typeOwner.kotlinFqName.asString()}'. Can't implement SAM interface.", e)
4067-
return
4068-
} else {
4069-
samMember
4070-
}
4063+
}
4064+
val samMember = typeOwner.declarations.filterIsInstance<IrFunction>().find { it is IrOverridableMember && it.modality == Modality.ABSTRACT }
4065+
if (samMember == null) {
4066+
logger.errorElement("Couldn't find SAM member in type '${typeOwner.kotlinFqName.asString()}'. Can't implement SAM interface.", e)
4067+
return
40714068
}
40724069

40734070
val javaResult = TypeResult(tw.getFreshIdLabel<DbClass>(), "", "")

0 commit comments

Comments
 (0)