FIR resolve: add forgotten constraint subsystem from generic qualified access
This fixes exception in resolve of an attached test
This commit is contained in:
@@ -22,7 +22,6 @@ class CandidateFactory(
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
val system = bodyResolveComponents.inferenceComponents.createConstraintSystem()
|
val system = bodyResolveComponents.inferenceComponents.createConstraintSystem()
|
||||||
callInfo.explicitReceiver?.let { system.addSubsystemFromExpression(it) }
|
|
||||||
callInfo.arguments.forEach {
|
callInfo.arguments.forEach {
|
||||||
system.addSubsystemFromExpression(it)
|
system.addSubsystemFromExpression(it)
|
||||||
}
|
}
|
||||||
@@ -44,7 +43,7 @@ class CandidateFactory(
|
|||||||
|
|
||||||
fun PostponedArgumentsAnalyzer.Context.addSubsystemFromExpression(expression: FirExpression) {
|
fun PostponedArgumentsAnalyzer.Context.addSubsystemFromExpression(expression: FirExpression) {
|
||||||
when (expression) {
|
when (expression) {
|
||||||
is FirFunctionCall, is FirWhenExpression, is FirTryExpression, is FirCallableReferenceAccess ->
|
is FirFunctionCall, is FirQualifiedAccessExpression, is FirWhenExpression, is FirTryExpression, is FirCallableReferenceAccess ->
|
||||||
(expression as FirResolvable).candidate()?.let { addOtherSystem(it.system.asReadOnlyStorage()) }
|
(expression as FirResolvable).candidate()?.let { addOtherSystem(it.system.asReadOnlyStorage()) }
|
||||||
is FirWrappedArgumentExpression -> addSubsystemFromExpression(expression.expression)
|
is FirWrappedArgumentExpression -> addSubsystemFromExpression(expression.expression)
|
||||||
is FirBlock -> expression.returnExpressions().forEach { addSubsystemFromExpression(it) }
|
is FirBlock -> expression.returnExpressions().forEach { addSubsystemFromExpression(it) }
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
// FILE: StaticOwner.java
|
||||||
|
// FULL_JDK
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class StaticOwner {
|
||||||
|
@NotNull
|
||||||
|
public static <T> T newInstance(@NotNull Class<T> aClass) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: User.kt
|
||||||
|
|
||||||
|
interface Freezable
|
||||||
|
|
||||||
|
abstract class User<T : Freezable> {
|
||||||
|
|
||||||
|
private var settings: T = createSettings()
|
||||||
|
|
||||||
|
protected abstract fun createSettings(): T
|
||||||
|
|
||||||
|
fun foo() {
|
||||||
|
settings = StaticOwner.newInstance(settings.javaClass)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
FILE: User.kt
|
||||||
|
public abstract interface Freezable : R|kotlin/Any| {
|
||||||
|
}
|
||||||
|
public abstract class User<T : R|Freezable|> : R|kotlin/Any| {
|
||||||
|
public constructor<T : R|Freezable|>(): R|User<T>| {
|
||||||
|
super<R|kotlin/Any|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
private final var settings: R|T| = this@R|/User|.R|FakeOverride</User.createSettings: R|T|>|()
|
||||||
|
private get(): R|T|
|
||||||
|
private set(value: R|T|): R|kotlin/Unit|
|
||||||
|
|
||||||
|
protected abstract fun createSettings(): R|T|
|
||||||
|
|
||||||
|
public final fun foo(): R|kotlin/Unit| {
|
||||||
|
this@R|/User|.R|/User.settings| = Q|StaticOwner|.R|/StaticOwner.newInstance|<R|T|>(this@R|/User|.R|/User.settings|.R|kotlin/jvm/javaClass|)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Generated
+5
@@ -450,5 +450,10 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic
|
|||||||
public void testRawType() throws Exception {
|
public void testRawType() throws Exception {
|
||||||
runTest("compiler/fir/resolve/testData/resolve/stdlib/j+k/RawType.kt");
|
runTest("compiler/fir/resolve/testData/resolve/stdlib/j+k/RawType.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("StaticGenericMethod.kt")
|
||||||
|
public void testStaticGenericMethod() throws Exception {
|
||||||
|
runTest("compiler/fir/resolve/testData/resolve/stdlib/j+k/StaticGenericMethod.kt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user