Pull Up: Apply type substitution to parameters propagated to the target class
This commit is contained in:
@@ -52,6 +52,7 @@ import org.jetbrains.kotlin.resolve.calls.callUtil.getResolvedCall
|
||||
import org.jetbrains.kotlin.resolve.calls.resolvedCallUtil.getExplicitReceiverValue
|
||||
import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver
|
||||
import org.jetbrains.kotlin.resolve.source.getPsi
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
import java.util.*
|
||||
|
||||
class KotlinPullUpHelper(
|
||||
@@ -533,7 +534,12 @@ class KotlinPullUpHelper(
|
||||
}
|
||||
|
||||
with(constructor.getValueParameterList()!!) {
|
||||
info.usedParameters.forEach { addParameter(it) }
|
||||
info.usedParameters.forEach {
|
||||
val newParameter = addParameter(it)
|
||||
val originalType = data.sourceClassContext[BindingContext.VALUE_PARAMETER, it]!!.type
|
||||
newParameter.setType(data.sourceToTargetClassSubstitutor.substitute(originalType, Variance.INVARIANT) ?: originalType, false)
|
||||
newParameter.typeReference!!.addToShorteningWaitSet()
|
||||
}
|
||||
}
|
||||
targetToSourceConstructors[constructorElement]!!.forEach {
|
||||
val superCall: JetCallElement? = when (it) {
|
||||
|
||||
@@ -3,7 +3,7 @@ interface I
|
||||
|
||||
interface Z<T>
|
||||
|
||||
abstract class A<T: I, U: I, V>(x: X, y: Y) {
|
||||
abstract class A<T: I, U: I, V>(x: T, y: Any?) {
|
||||
// INFO: {"checked": "true"}
|
||||
val foo1: T
|
||||
// INFO: {"checked": "true"}
|
||||
|
||||
Reference in New Issue
Block a user