Fix receiver inconsistency when builder inference restriction disabled
In 154e53c701 update of
extensionReceiverArgument in resolvedCall was accidentally moved into
language feature dependant block
This commit is contained in:
+6
@@ -14453,6 +14453,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/multiLambdaRestrictionDisabled.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noBuilderInferenceRestrictionReceiverInconsistency.kt")
|
||||
public void testNoBuilderInferenceRestrictionReceiverInconsistency() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/noBuilderInferenceRestrictionReceiverInconsistency.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertySubstitution.kt")
|
||||
public void testPropertySubstitution() throws Exception {
|
||||
|
||||
+6
@@ -14453,6 +14453,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/multiLambdaRestrictionDisabled.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noBuilderInferenceRestrictionReceiverInconsistency.kt")
|
||||
public void testNoBuilderInferenceRestrictionReceiverInconsistency() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/noBuilderInferenceRestrictionReceiverInconsistency.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertySubstitution.kt")
|
||||
public void testPropertySubstitution() throws Exception {
|
||||
|
||||
+6
@@ -14453,6 +14453,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/multiLambdaRestrictionDisabled.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noBuilderInferenceRestrictionReceiverInconsistency.kt")
|
||||
public void testNoBuilderInferenceRestrictionReceiverInconsistency() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/noBuilderInferenceRestrictionReceiverInconsistency.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertySubstitution.kt")
|
||||
public void testPropertySubstitution() throws Exception {
|
||||
|
||||
+13
-13
@@ -663,23 +663,23 @@ internal object CheckReceivers : ResolutionPart() {
|
||||
)
|
||||
|
||||
1 -> {
|
||||
var extensionReceiverArgument = resolvedCall.extensionReceiverArgument
|
||||
if (extensionReceiverArgument == null) {
|
||||
extensionReceiverArgument = chooseExtensionReceiverCandidate() ?: return
|
||||
resolvedCall.extensionReceiverArgument = extensionReceiverArgument
|
||||
}
|
||||
val checkBuilderInferenceRestriction =
|
||||
!callComponents.languageVersionSettings
|
||||
.supportsFeature(LanguageFeature.NoBuilderInferenceWithoutAnnotationRestriction)
|
||||
if (checkBuilderInferenceRestriction) {
|
||||
var extensionReceiverArgument = resolvedCall.extensionReceiverArgument
|
||||
if (extensionReceiverArgument == null) {
|
||||
extensionReceiverArgument = chooseExtensionReceiverCandidate() ?: return
|
||||
resolvedCall.extensionReceiverArgument = extensionReceiverArgument
|
||||
}
|
||||
if (extensionReceiverArgument.receiver.receiverValue.type is StubTypeForBuilderInference) {
|
||||
addDiagnostic(
|
||||
StubBuilderInferenceReceiver(
|
||||
extensionReceiverArgument,
|
||||
candidateDescriptor.extensionReceiverParameter!!
|
||||
)
|
||||
if (checkBuilderInferenceRestriction &&
|
||||
extensionReceiverArgument.receiver.receiverValue.type is StubTypeForBuilderInference
|
||||
) {
|
||||
addDiagnostic(
|
||||
StubBuilderInferenceReceiver(
|
||||
extensionReceiverArgument,
|
||||
candidateDescriptor.extensionReceiverParameter!!
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
checkReceiver(
|
||||
resolvedCall.extensionReceiverArgument,
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// FIR_IDENTICAL
|
||||
// SKIP_TXT
|
||||
// WITH_STDLIB
|
||||
// LANGUAGE: +NoBuilderInferenceWithoutAnnotationRestriction
|
||||
|
||||
class A
|
||||
class B
|
||||
|
||||
var B.foo: Boolean
|
||||
get() = true
|
||||
set(value) {}
|
||||
|
||||
private fun A.bar(b: B) {
|
||||
b.foo = true
|
||||
}
|
||||
Generated
+6
@@ -14459,6 +14459,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/multiLambdaRestrictionDisabled.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noBuilderInferenceRestrictionReceiverInconsistency.kt")
|
||||
public void testNoBuilderInferenceRestrictionReceiverInconsistency() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/noBuilderInferenceRestrictionReceiverInconsistency.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertySubstitution.kt")
|
||||
public void testPropertySubstitution() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user