Skip to content

Commit 968a78e

Browse files
committed
Kotlin: Small simplification
Merge two `IrFunction` cases into one.
1 parent 3d5c815 commit 968a78e

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,21 +1450,21 @@ open class KotlinUsesExtractor(
14501450

14511451
fun getTypeParameterParentLabel(param: IrTypeParameter) =
14521452
param.parent.let {
1453-
(it as? IrFunction)?.let { fn ->
1454-
if (this is KotlinFileExtractor)
1455-
this.declarationStack.findOverriddenAttributes(fn)?.takeUnless {
1456-
// When extracting the `static fun f$default(...)` that accompanies `fun <T> f(val x: T? = defaultExpr, ...)`,
1457-
// `f$default` has no type parameters, and so there is no `f$default::T` to refer to.
1458-
// We have no good way to extract references to `T` in `defaultExpr`, so we just fall back on describing it
1459-
// in terms of `f::T`, even though that type variable ought to be out of scope here.
1460-
attribs -> attribs.typeParameters?.isEmpty() == true
1461-
}?.id
1462-
else
1463-
null
1464-
} ?:
14651453
when (it) {
14661454
is IrClass -> useClassSource(it)
1467-
is IrFunction -> useFunction(it, noReplace = true)
1455+
is IrFunction ->
1456+
(if (this is KotlinFileExtractor)
1457+
this.declarationStack.findOverriddenAttributes(it)?.takeUnless {
1458+
// When extracting the `static fun f$default(...)` that accompanies `fun <T> f(val x: T? = defaultExpr, ...)`,
1459+
// `f$default` has no type parameters, and so there is no `f$default::T` to refer to.
1460+
// We have no good way to extract references to `T` in `defaultExpr`, so we just fall back on describing it
1461+
// in terms of `f::T`, even though that type variable ought to be out of scope here.
1462+
attribs -> attribs.typeParameters?.isEmpty() == true
1463+
}?.id
1464+
else
1465+
null
1466+
) ?:
1467+
useFunction(it, noReplace = true)
14681468
else -> { logger.error("Unexpected type parameter parent $it"); null }
14691469
}
14701470
}

0 commit comments

Comments
 (0)