[NI] Split substitution of inferred type parametes into two steps

Substituting inferred type parameters with single substitutor leads
to incorrect behaviour in cases, when class' type parameters are used in constructor.
As a side effect of two-step substitution, intermediate descriptor is created,
which prevents incorrect substitution. To preserve this side effect, single
resulting substitutor was split into two substitutors: one for substituting fresh
variables and another for substituting inferred variables and known parameters.

^KT-32415 Fixed
This commit is contained in:
Pavel Kirpichenkov
2019-11-12 12:02:50 +03:00
parent b6af13f18d
commit 92dae5d8a9
6 changed files with 33 additions and 5 deletions
@@ -0,0 +1,5 @@
// !LANGUAGE: +NewInference
class B<O>(val obj: O) {
val v = B(obj)
}
@@ -0,0 +1,10 @@
package
public final class B</*0*/ O> {
public constructor B</*0*/ O>(/*0*/ obj: O)
public final val obj: O
public final val v: B<O>
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}