KTIJ-20618 FIR IDE: Enforce resolved type bounds in ConeTypeContext.kt

When lazy resolve is involved, type bounds can be in an unresolved
state (e.g. `FirUserTypeRef` instead of `FirResolvedTypeRef`). To
enforce the resolve, we use `resolvedTypeBounds` where it might be
important

^KTIJ-20618 Fixed
This commit is contained in:
Roman Golyshev
2021-12-30 15:20:28 +03:00
committed by Space
parent a63351f5d1
commit 5964d8c566
7 changed files with 56 additions and 7 deletions
@@ -0,0 +1,18 @@
FILE: main.kt
public final fun <T> myRun(action: R|() -> T|): R|T| {
^myRun R|<local>/action|.R|SubstitutionOverride<kotlin/Function0.invoke: R|T|>|()
}
public final fun test(other: R|TypeWithBoundedGeneric<*>|): R|TypeWithBoundedGeneric<*>| {
^test R|/myRun|<R|TypeWithBoundedGeneric<*>|>(<L> = myRun@fun <anonymous>(): R|TypeWithBoundedGeneric<*>| <inline=NoInline> {
^ R|<local>/other|
}
)
}
public abstract interface SomeType : R|kotlin/Any| {
}
public abstract class TypeWithBoundedGeneric<T : R|SomeType|> : R|kotlin/Any| {
public constructor<T : R|SomeType|>(): R|TypeWithBoundedGeneric<T>| {
super<R|kotlin/Any|>()
}
}
@@ -0,0 +1,8 @@
// FILE: main.kt
fun <T> myRun(action: () -> T): T = action()
fun test(other: TypeWithBoundedGeneric<*>) = myRun { other }
interface SomeType
abstract class TypeWithBoundedGeneric<T : SomeType>