Convert FunctionBase to Kotlin, add type parameter to Lambda
This will make it possible to avoid raw types when inheriting from both FunctionBase and Function<R>. This change adds a generic type parameter to FunctionBase and Lambda which is not source-breaking under our policy because both FunctionBase and Lambda are internal classes (located in package kotlin.jvm.internal)
This commit is contained in:
committed by
Ilya Gorbunov
parent
e35ebff4e1
commit
51979b9ffa
+5
-9
@@ -132,13 +132,11 @@ internal interface SuspendFunction
|
||||
@SinceKotlin("1.3")
|
||||
// Restricted suspension lambdas inherit from this class
|
||||
internal abstract class RestrictedSuspendLambda(
|
||||
private val arity: Int,
|
||||
public override val arity: Int,
|
||||
completion: Continuation<Any?>?
|
||||
) : RestrictedContinuationImpl(completion), FunctionBase, SuspendFunction {
|
||||
) : RestrictedContinuationImpl(completion), FunctionBase<Any?>, SuspendFunction {
|
||||
constructor(arity: Int) : this(arity, null)
|
||||
|
||||
public override fun getArity(): Int = arity
|
||||
|
||||
public override fun toString(): String =
|
||||
if (completion == null)
|
||||
Reflection.renderLambdaToString(this) // this is lambda
|
||||
@@ -149,16 +147,14 @@ internal abstract class RestrictedSuspendLambda(
|
||||
@SinceKotlin("1.3")
|
||||
// Suspension lambdas inherit from this class
|
||||
internal abstract class SuspendLambda(
|
||||
private val arity: Int,
|
||||
public override val arity: Int,
|
||||
completion: Continuation<Any?>?
|
||||
) : ContinuationImpl(completion), FunctionBase, SuspendFunction {
|
||||
) : ContinuationImpl(completion), FunctionBase<Any?>, SuspendFunction {
|
||||
constructor(arity: Int) : this(arity, null)
|
||||
|
||||
public override fun getArity(): Int = arity
|
||||
|
||||
public override fun toString(): String =
|
||||
if (completion == null)
|
||||
Reflection.renderLambdaToString(this) // this is lambda
|
||||
else
|
||||
super.toString() // this is continuation
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user