K2: Fix ISE from inference on delegate vars with implicit types

See the test data.
ISE happened because at some point after incomplete `getValue` resolution
of `a` property, we updated in the `transformAccessors` the property type
to the `Variable(Y)` type and then used it as a 3rd argument for
`setValue` call which is incorrect because the variable belongs
to a different constraint system (from `getValue`).

Mostly, the fix is just a repeating K1 behavior, namely postponing
`setValue` resolution until delegate inference is completed.

^KT-59066 Fixed
This commit is contained in:
Denis.Zharkov
2023-06-09 11:36:47 +02:00
committed by Space Team
parent b8c4a4c80a
commit 41933facbb
9 changed files with 175 additions and 7 deletions
@@ -8974,12 +8974,24 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/delegatedProperty/missedSetter.kt");
}
@Test
@TestMetadata("noInferenceFromGetValueThroughSetValue.kt")
public void testNoInferenceFromGetValueThroughSetValue() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/noInferenceFromGetValueThroughSetValue.kt");
}
@Test
@TestMetadata("noInferenceFromWrappedDelegate.kt")
public void testNoInferenceFromWrappedDelegate() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/noInferenceFromWrappedDelegate.kt");
}
@Test
@TestMetadata("noPreliminarySetterInferenceForImplicitlyTypedVar.kt")
public void testNoPreliminarySetterInferenceForImplicitlyTypedVar() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/noPreliminarySetterInferenceForImplicitlyTypedVar.kt");
}
@Test
@TestMetadata("nonDefaultAccessors.kt")
public void testNonDefaultAccessors() throws Exception {
@@ -8974,12 +8974,24 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/delegatedProperty/missedSetter.kt");
}
@Test
@TestMetadata("noInferenceFromGetValueThroughSetValue.kt")
public void testNoInferenceFromGetValueThroughSetValue() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/noInferenceFromGetValueThroughSetValue.kt");
}
@Test
@TestMetadata("noInferenceFromWrappedDelegate.kt")
public void testNoInferenceFromWrappedDelegate() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/noInferenceFromWrappedDelegate.kt");
}
@Test
@TestMetadata("noPreliminarySetterInferenceForImplicitlyTypedVar.kt")
public void testNoPreliminarySetterInferenceForImplicitlyTypedVar() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/noPreliminarySetterInferenceForImplicitlyTypedVar.kt");
}
@Test
@TestMetadata("nonDefaultAccessors.kt")
public void testNonDefaultAccessors() throws Exception {