FIR: fix capturing on intersection types #KT-48109 Fixed
This commit is contained in:
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
FILE: use.kt
|
||||
public final class BeforeRunTask<T> : R|kotlin/Any| {
|
||||
public constructor<T>(): R|BeforeRunTask<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public abstract interface PersistentStateComponent<T> : R|kotlin/Any| {
|
||||
}
|
||||
public final fun <T> deserializeAndLoadState(component: R|PersistentStateComponent<T>|, clazz: R|java/lang/Class<T>| = Q|ComponentSerializationUtil|.R|/ComponentSerializationUtil.getStateClass|<R|ft<T!!, T?>|>(<getClass>(R|<local>/component|).R|kotlin/jvm/java|<R|CapturedType(out PersistentStateComponent<T>)|>)): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun use(beforeRunTask: R|BeforeRunTask<*>|): R|kotlin/Unit| {
|
||||
when () {
|
||||
(R|<local>/beforeRunTask| is R|PersistentStateComponent<*>|) -> {
|
||||
R|/deserializeAndLoadState|<R|CapturedType(*)|>(R|<local>/beforeRunTask|)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// FILE: ComponentSerializationUtil.java
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public final class ComponentSerializationUtil {
|
||||
@NotNull
|
||||
public static <S> Class<S> getStateClass(@NotNull Class<? extends PersistentStateComponent> aClass)
|
||||
{}
|
||||
}
|
||||
|
||||
// FILE: use.kt
|
||||
|
||||
class BeforeRunTask<T>
|
||||
|
||||
interface PersistentStateComponent<T>
|
||||
|
||||
fun <T> deserializeAndLoadState(
|
||||
component: PersistentStateComponent<T>,
|
||||
clazz: Class<T> = ComponentSerializationUtil.getStateClass(component::class.java)
|
||||
) {}
|
||||
|
||||
fun use(beforeRunTask: BeforeRunTask<*>) {
|
||||
if (beforeRunTask is PersistentStateComponent<*>) {
|
||||
deserializeAndLoadState(beforeRunTask)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user