Skip to content

Commit

Permalink
Fix receiver inconsistency when builder inference restriction disabled
Browse files Browse the repository at this point in the history
In 154e53c update of
extensionReceiverArgument in resolvedCall was accidentally moved into
language feature dependant block
  • Loading branch information
semoro committed Sep 5, 2022
1 parent f0fd2cf commit a17fc51
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 13 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -664,23 +664,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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a17fc51

Please sign in to comment.