[FIR] Infer type arguments for captured parameters of inner classes
KT-38992
This commit is contained in:
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
interface AbstractFirTreeBuilder
|
||||
|
||||
class FirTreeBuilder : AbstractFirTreeBuilder
|
||||
|
||||
abstract class AbstractBuilderConfigurator<T : AbstractFirTreeBuilder> {
|
||||
abstract class BuilderConfigurationContext
|
||||
|
||||
inner class LeafBuilderConfigurationContext : BuilderConfigurationContext()
|
||||
}
|
||||
|
||||
class BuilderConfigurator : AbstractBuilderConfigurator<FirTreeBuilder>() {
|
||||
fun test(func: (LeafBuilderConfigurationContext) -> Unit) {
|
||||
val context = LeafBuilderConfigurationContext()
|
||||
func(context)
|
||||
}
|
||||
}
|
||||
|
||||
class Outer<E> {
|
||||
inner class Inner
|
||||
|
||||
fun foo(x: (Inner) -> Unit, y: Inner.() -> Unit) {
|
||||
// each call reported as INAPPLICABLE because "Inner<E> is not a subtype of Inner"
|
||||
bar(Inner())
|
||||
x(Inner())
|
||||
Inner().y()
|
||||
}
|
||||
|
||||
fun bar(i: Inner) {}
|
||||
}
|
||||
Vendored
+62
@@ -0,0 +1,62 @@
|
||||
FILE: invokeWithReceiverAndArgument.kt
|
||||
public abstract interface AbstractFirTreeBuilder : R|kotlin/Any| {
|
||||
}
|
||||
public final class FirTreeBuilder : R|AbstractFirTreeBuilder| {
|
||||
public constructor(): R|FirTreeBuilder| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public abstract class AbstractBuilderConfigurator<T : R|AbstractFirTreeBuilder|> : R|kotlin/Any| {
|
||||
public constructor<T : R|AbstractFirTreeBuilder|>(): R|AbstractBuilderConfigurator<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public abstract class BuilderConfigurationContext : R|kotlin/Any| {
|
||||
public constructor(): R|AbstractBuilderConfigurator.BuilderConfigurationContext| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final inner class LeafBuilderConfigurationContext<T : R|AbstractFirTreeBuilder|> : R|AbstractBuilderConfigurator.BuilderConfigurationContext| {
|
||||
public constructor(): R|AbstractBuilderConfigurator.LeafBuilderConfigurationContext<T>| {
|
||||
super<R|AbstractBuilderConfigurator.BuilderConfigurationContext|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public final class BuilderConfigurator : R|AbstractBuilderConfigurator<FirTreeBuilder>| {
|
||||
public constructor(): R|BuilderConfigurator| {
|
||||
super<R|AbstractBuilderConfigurator<FirTreeBuilder>|>()
|
||||
}
|
||||
|
||||
public final fun test(func: R|(AbstractBuilderConfigurator.LeafBuilderConfigurationContext<FirTreeBuilder>) -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
lval context: R|AbstractBuilderConfigurator.LeafBuilderConfigurationContext<FirTreeBuilder>| = this@R|/BuilderConfigurator|.R|/AbstractBuilderConfigurator.LeafBuilderConfigurationContext.LeafBuilderConfigurationContext|()
|
||||
R|<local>/func|.R|FakeOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(R|<local>/context|)
|
||||
}
|
||||
|
||||
}
|
||||
public final class Outer<E> : R|kotlin/Any| {
|
||||
public constructor<E>(): R|Outer<E>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final inner class Inner<E> : R|kotlin/Any| {
|
||||
public constructor(): R|Outer.Inner<E>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final fun foo(x: R|(Outer.Inner<E>) -> kotlin/Unit|, y: R|Outer.Inner<E>.() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
this@R|/Outer|.R|/Outer.bar|(this@R|/Outer|.R|/Outer.Inner.Inner|())
|
||||
R|<local>/x|.R|FakeOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(this@R|/Outer|.R|/Outer.Inner.Inner|())
|
||||
R|<local>/y|.R|FakeOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(this@R|/Outer|.R|/Outer.Inner.Inner|())
|
||||
}
|
||||
|
||||
public final fun bar(i: R|Outer.Inner<E>|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
+10
-10
@@ -23,11 +23,11 @@ FILE: qualifiedSupertypeExtendedByOtherSupertype.kt
|
||||
}
|
||||
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
this@R|/Test|.super<R|IBase|>.R|/IBase.foo|()
|
||||
this@R|/Test|.super<R|IBase|>.R|/IBase.bar|()
|
||||
this@R|/Test|.super<R|IDerived|>.R|/IDerived.foo|()
|
||||
this@R|/Test|.super<R|IDerived|>.R|/IBase.bar|()
|
||||
this@R|/Test|.super<R|IDerived|>.R|/IDerived.qux|()
|
||||
this@R|/Test|.super<R|IBase<T>|>.R|/IBase.foo|()
|
||||
this@R|/Test|.super<R|IBase<T>|>.R|/IBase.bar|()
|
||||
this@R|/Test|.super<R|IDerived<T>|>.R|/IDerived.foo|()
|
||||
this@R|/Test|.super<R|IDerived<T>|>.R|/IBase.bar|()
|
||||
this@R|/Test|.super<R|IDerived<T>|>.R|/IDerived.qux|()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,13 +37,13 @@ FILE: qualifiedSupertypeExtendedByOtherSupertype.kt
|
||||
}
|
||||
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
this@R|/Test2|.super<R|IBase|>.R|/IBase.foo|()
|
||||
this@R|/Test2|.super<R|IBase|>.R|/IBase.bar|()
|
||||
this@R|/Test2|.super<R|IBase<T>|>.R|/IBase.foo|()
|
||||
this@R|/Test2|.super<R|IBase<T>|>.R|/IBase.bar|()
|
||||
this@R|/Test2|.super<R|AliasedIBase|>.R|/IBase.foo|()
|
||||
this@R|/Test2|.super<R|AliasedIBase|>.R|/IBase.bar|()
|
||||
this@R|/Test2|.super<R|IDerived|>.R|/IDerived.foo|()
|
||||
this@R|/Test2|.super<R|IDerived|>.R|/IBase.bar|()
|
||||
this@R|/Test2|.super<R|IDerived|>.R|/IDerived.qux|()
|
||||
this@R|/Test2|.super<R|IDerived<T>|>.R|/IDerived.foo|()
|
||||
this@R|/Test2|.super<R|IDerived<T>|>.R|/IBase.bar|()
|
||||
this@R|/Test2|.super<R|IDerived<T>|>.R|/IDerived.qux|()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,20 +13,20 @@ FILE: typeParameterVsNested.kt
|
||||
|
||||
}
|
||||
|
||||
public abstract val x: R|test/My.T|
|
||||
public get(): R|test/My.T|
|
||||
public abstract val x: R|test/My.T<T>|
|
||||
public get(): R|test/My.T<T>|
|
||||
|
||||
public abstract fun foo(arg: R|test/My.T|): R|kotlin/Unit|
|
||||
public abstract fun foo(arg: R|test/My.T<T>|): R|kotlin/Unit|
|
||||
|
||||
public abstract val y: R|test/My.T|
|
||||
public get(): R|test/My.T|
|
||||
public abstract val y: R|test/My.T<ERROR CLASS: Type argument not defined>|
|
||||
public get(): R|test/My.T<ERROR CLASS: Type argument not defined>|
|
||||
|
||||
public abstract val z: R|test/My.T|
|
||||
public get(): R|test/My.T|
|
||||
public abstract val z: R|test/My.T<ERROR CLASS: Type argument not defined>|
|
||||
public get(): R|test/My.T<ERROR CLASS: Type argument not defined>|
|
||||
|
||||
public final class Some : R|test/My.T| {
|
||||
public final class Some : R|test/My.T<T>| {
|
||||
public constructor(): R|test/My.Some| {
|
||||
super<R|test/My.T|>()
|
||||
super<R|test/My.T<T>|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
class A<T1, T2> {
|
||||
inner class B<K1, K2> {
|
||||
inner class C<U1, U2>
|
||||
|
||||
fun <R3> foo(c: C<R3, R3>) {}
|
||||
}
|
||||
|
||||
fun <R2, R3> foo(c: B<R2, R2>.C<R3, R3>) {}
|
||||
}
|
||||
|
||||
fun <R1, R2, R3> foo(c: A<R1, R1>.B<R2, R2>.C<R3, R3>) {}
|
||||
|
||||
fun <R3> foo(c: A.B.C<R3, R3>) {}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
FILE: capturedParametersOfInnerClasses.kt
|
||||
public final class A<T1, T2> : R|kotlin/Any| {
|
||||
public constructor<T1, T2>(): R|A<T1, T2>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final inner class B<K1, K2, T1, T2> : R|kotlin/Any| {
|
||||
public constructor<K1, K2>(): R|A.B<K1, K2, T1, T2>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final inner class C<U1, U2, K1, K2, T1, T2> : R|kotlin/Any| {
|
||||
public constructor<U1, U2>(): R|A.B.C<U1, U2, K1, K2, T1, T2>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final fun <R3> foo(c: R|A.B.C<R3, R3, K1, K2, T1, T2>|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public final fun <R2, R3> foo(c: R|A.B.C<R3, R3, R2, R2, T1, T2>|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
public final fun <R1, R2, R3> foo(c: R|A.B.C<R3, R3, R2, R2, R1, R1>|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun <R3> foo(c: R|A.B.C<R3, R3, ERROR CLASS: Type argument not defined, ERROR CLASS: Type argument not defined, ERROR CLASS: Type argument not defined, ERROR CLASS: Type argument not defined>|): R|kotlin/Unit| {
|
||||
}
|
||||
Reference in New Issue
Block a user