[NI] Use new type substitutor instead of old in completion of callable references

It's necessary because of new type substitutor is eager than odl, so
  if there is a substitution of type parameter deep inside type arguments
  then second substitutor wins against first

#KT-35896 Fixed
This commit is contained in:
Dmitriy Novozhilov
2020-01-14 13:07:07 +03:00
parent 3428a17759
commit 88a1cb5a17
8 changed files with 86 additions and 12 deletions
@@ -0,0 +1,15 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
// ISSUE: KT-35896
interface B<E, SC>
class Inv<T>
class Foo<T>(x: Int): B<T, Inv<T>>
fun <T1, T2, S> bar(list: T2, fn: (S) -> B<T1, T2>) {}
fun <K> foo(list: Inv<K>) {
bar(list, ::Foo)
}
@@ -0,0 +1,15 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
// ISSUE: KT-35896
interface B<E, SC>
class Inv<T>
class Foo<T>(x: Int): B<T, Inv<T>>
fun <T1, T2, S> bar(list: T2, fn: (S) -> B<T1, T2>) {}
fun <K> foo(list: Inv<K>) {
bar(list, ::Foo)
}
@@ -0,0 +1,24 @@
package
public fun </*0*/ T1, /*1*/ T2, /*2*/ S> bar(/*0*/ list: T2, /*1*/ fn: (S) -> B<T1, T2>): kotlin.Unit
public fun </*0*/ K> foo(/*0*/ list: Inv<K>): kotlin.Unit
public interface B</*0*/ E, /*1*/ SC> {
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
}
public final class Foo</*0*/ T> : B<T, Inv<T>> {
public constructor Foo</*0*/ T>(/*0*/ x: kotlin.Int)
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
}
public final class Inv</*0*/ T> {
public constructor Inv</*0*/ T>()
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
}