[FIR2IR] Fix check if interface is SAM
This commit is contained in:
@@ -470,7 +470,8 @@ fun FirClass<*>.irOrigin(firProvider: FirProvider): IrDeclarationOrigin = when {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun FirClass<*>.getSamIfAny(): FirSimpleFunction? =
|
fun FirClass<*>.getSamIfAny(): FirSimpleFunction? =
|
||||||
declarations.filterIsInstance<FirSimpleFunction>().singleOrNull { it.modality == Modality.ABSTRACT }
|
declarations.filterIsInstance<FirSimpleFunction>()
|
||||||
|
.singleOrNull { it.modality == Modality.ABSTRACT && !it.isPublicInObject(checkOnlyName = true) }
|
||||||
|
|
||||||
val IrType.isSamType: Boolean
|
val IrType.isSamType: Boolean
|
||||||
get() {
|
get() {
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ private fun FirRegularClass.hasMoreThenOneAbstractFunctionOrHasAbstractProperty(
|
|||||||
// "methods that are members of I that do not have the same signature as any public instance method of the class Object"
|
// "methods that are members of I that do not have the same signature as any public instance method of the class Object"
|
||||||
// It means that if an interface declares `int hashCode()` then the method won't be taken into account when
|
// It means that if an interface declares `int hashCode()` then the method won't be taken into account when
|
||||||
// checking if the interface is SAM.
|
// checking if the interface is SAM.
|
||||||
private fun FirSimpleFunction.isPublicInObject(checkOnlyName: Boolean): Boolean {
|
fun FirSimpleFunction.isPublicInObject(checkOnlyName: Boolean): Boolean {
|
||||||
if (name.asString() !in PUBLIC_METHOD_NAMES_IN_OBJECT) return false
|
if (name.asString() !in PUBLIC_METHOD_NAMES_IN_OBJECT) return false
|
||||||
if (checkOnlyName) return true
|
if (checkOnlyName) return true
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// KJS_WITH_FULL_RUNTIME
|
// KJS_WITH_FULL_RUNTIME
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// KJS_WITH_FULL_RUNTIME
|
// KJS_WITH_FULL_RUNTIME
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// KJS_WITH_FULL_RUNTIME
|
// KJS_WITH_FULL_RUNTIME
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user