KT-8879 Stackoverflow exception on completion from inference

#KT-8879 Fixed
Added ConstraintContext storing 'derivedFrom' variables.
This information is used to prevent infinite recursion:
if a variable was substituted in a type of a bound, it shouldn't be substituted there for the second time.
This commit is contained in:
Svetlana Isakova
2015-09-02 17:54:13 +03:00
parent 3c5de56e83
commit 4f28a0a9a1
10 changed files with 116 additions and 33 deletions
@@ -0,0 +1,12 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface Inv<I>
interface Inv2<I>
fun <T: Inv2<T>> foo(klass: Inv<T>): String? = null
fun <X> bar(): Inv<X> = null!!
fun test() {
<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>foo<!>(<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>bar<!>())
}
@@ -0,0 +1,17 @@
package
internal fun </*0*/ X> bar(): Inv<X>
internal fun </*0*/ T : Inv2<T>> foo(/*0*/ klass: Inv<T>): kotlin.String?
internal fun test(): kotlin.Unit
internal interface Inv</*0*/ I> {
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
}
internal interface Inv2</*0*/ I> {
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
}