[NI] Filter out type variable from its dependencies
Don't take into account complex variable dependency on itself when determining fixation status. ^KT-37621 Fixed
This commit is contained in:
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
// Issue: KT-37621
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
class Inv<T>
|
||||
class In<in I>
|
||||
class Out<out O>
|
||||
|
||||
inline fun <reified TB : Inv<TB>> invBound(): TB = TODO()
|
||||
inline fun <reified IB : In<IB>> inBound(): IB = TODO()
|
||||
inline fun <reified OB : Out<OB>> outBound(): OB = TODO()
|
||||
|
||||
inline fun <reified T : Inv<T>> testInv(): T {
|
||||
return try {
|
||||
invBound()
|
||||
} catch (ex: Exception) {
|
||||
throw Exception()
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <reified T : In<T>> testIn(): T {
|
||||
return try {
|
||||
inBound()
|
||||
} catch (ex: Exception) {
|
||||
throw Exception()
|
||||
}
|
||||
}
|
||||
|
||||
// Unexpected behaviour
|
||||
inline fun <reified T : Out<T>> testOut(): T {
|
||||
return try {
|
||||
outBound()
|
||||
} catch (ex: Exception) {
|
||||
throw Exception()
|
||||
}
|
||||
}
|
||||
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
// Issue: KT-37621
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
class Inv<T>
|
||||
class In<in I>
|
||||
class Out<out O>
|
||||
|
||||
inline fun <reified TB : Inv<TB>> invBound(): TB = TODO()
|
||||
inline fun <reified IB : In<IB>> inBound(): IB = TODO()
|
||||
inline fun <reified OB : Out<OB>> outBound(): OB = TODO()
|
||||
|
||||
inline fun <reified T : Inv<T>> testInv(): T {
|
||||
return try {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("T")!>invBound()<!>
|
||||
} catch (ex: Exception) {
|
||||
throw Exception()
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <reified T : In<T>> testIn(): T {
|
||||
return try {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("T")!>inBound()<!>
|
||||
} catch (ex: Exception) {
|
||||
throw Exception()
|
||||
}
|
||||
}
|
||||
|
||||
// Unexpected behaviour
|
||||
inline fun <reified T : Out<T>> testOut(): T {
|
||||
<!UNREACHABLE_CODE!>return<!> try {
|
||||
<!IMPLICIT_NOTHING_TYPE_ARGUMENT_IN_RETURN_POSITION, REIFIED_TYPE_FORBIDDEN_SUBSTITUTION, REIFIED_TYPE_FORBIDDEN_SUBSTITUTION!>outBound<!>()
|
||||
} catch (ex: Exception) {
|
||||
throw Exception()
|
||||
}
|
||||
}
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
package
|
||||
|
||||
public inline fun </*0*/ reified IB : In<IB>> inBound(): IB
|
||||
public inline fun </*0*/ reified TB : Inv<TB>> invBound(): TB
|
||||
public inline fun </*0*/ reified OB : Out<OB>> outBound(): OB
|
||||
public inline fun </*0*/ reified T : In<T>> testIn(): T
|
||||
public inline fun </*0*/ reified T : Inv<T>> testInv(): T
|
||||
public inline fun </*0*/ reified T : Out<T>> testOut(): T
|
||||
|
||||
public final class In</*0*/ in I> {
|
||||
public constructor In</*0*/ in 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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
public final class Out</*0*/ out O> {
|
||||
public constructor Out</*0*/ out 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
|
||||
}
|
||||
Reference in New Issue
Block a user