[FE] Report ambiguity when label can refer to multiple receivers
This commit is contained in:
committed by
TeamCityServer
parent
fd7d000138
commit
ac27fda965
+6
@@ -10612,6 +10612,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("labelsFromClassNameForbidden.kt")
|
||||||
|
public void testLabelsFromClassNameForbidden() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/labelsFromClassNameForbidden.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("lazy.kt")
|
@TestMetadata("lazy.kt")
|
||||||
public void testLazy() throws Exception {
|
public void testLazy() throws Exception {
|
||||||
|
|||||||
+1
-1
@@ -437,7 +437,7 @@ fun getDeclarationLabels(lambdaOrFun: PsiElement?, descriptor: DeclarationDescri
|
|||||||
val result = HashSet<String>()
|
val result = HashSet<String>()
|
||||||
|
|
||||||
if (lambdaOrFun != null) {
|
if (lambdaOrFun != null) {
|
||||||
val label = LabelResolver.getLabelNamesIfAny(lambdaOrFun, addContextReceiverNames = false)
|
val label = LabelResolver.getLabelNamesIfAny(lambdaOrFun, addClassNameLabels = false)
|
||||||
if (label.isNotEmpty()) {
|
if (label.isNotEmpty()) {
|
||||||
result.add(label.single().asString())
|
result.add(label.single().asString())
|
||||||
}
|
}
|
||||||
|
|||||||
+6
@@ -10612,6 +10612,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("labelsFromClassNameForbidden.kt")
|
||||||
|
public void testLabelsFromClassNameForbidden() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/labelsFromClassNameForbidden.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("lazy.kt")
|
@TestMetadata("lazy.kt")
|
||||||
public void testLazy() throws Exception {
|
public void testLazy() throws Exception {
|
||||||
|
|||||||
+6
@@ -10612,6 +10612,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("labelsFromClassNameForbidden.kt")
|
||||||
|
public void testLabelsFromClassNameForbidden() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/labelsFromClassNameForbidden.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("lazy.kt")
|
@TestMetadata("lazy.kt")
|
||||||
public void testLazy() throws Exception {
|
public void testLazy() throws Exception {
|
||||||
|
|||||||
@@ -228,32 +228,36 @@ class FunctionDescriptorResolver(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val receiverToLabelMap = linkedMapOf<ReceiverParameterDescriptor, String>()
|
|
||||||
val extensionReceiver = receiverType?.let {
|
val extensionReceiver = receiverType?.let {
|
||||||
val splitter = AnnotationSplitter(storageManager, receiverType.annotations, EnumSet.of(AnnotationUseSiteTarget.RECEIVER))
|
val splitter = AnnotationSplitter(storageManager, it.annotations, EnumSet.of(AnnotationUseSiteTarget.RECEIVER))
|
||||||
DescriptorFactory.createExtensionReceiverParameterForCallable(
|
DescriptorFactory.createExtensionReceiverParameterForCallable(
|
||||||
functionDescriptor, it, splitter.getAnnotationsForTarget(AnnotationUseSiteTarget.RECEIVER)
|
functionDescriptor, it, splitter.getAnnotationsForTarget(AnnotationUseSiteTarget.RECEIVER)
|
||||||
)
|
)
|
||||||
}?.apply {
|
|
||||||
val extensionReceiverName = receiverTypeRef?.nameForReceiverLabel()
|
|
||||||
if (extensionReceiverName != null) {
|
|
||||||
receiverToLabelMap[this] = extensionReceiverName
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
val contextReceiverDescriptors = contextReceiverTypes.mapNotNull {
|
||||||
val contextReceiverDescriptors = contextReceiverTypes.mapNotNull { type ->
|
val splitter = AnnotationSplitter(storageManager, it.annotations, EnumSet.of(AnnotationUseSiteTarget.RECEIVER))
|
||||||
val splitter = AnnotationSplitter(storageManager, type.annotations, EnumSet.of(AnnotationUseSiteTarget.RECEIVER))
|
|
||||||
DescriptorFactory.createContextReceiverParameterForCallable(
|
DescriptorFactory.createContextReceiverParameterForCallable(
|
||||||
functionDescriptor, type, splitter.getAnnotationsForTarget(AnnotationUseSiteTarget.RECEIVER)
|
functionDescriptor, it, splitter.getAnnotationsForTarget(AnnotationUseSiteTarget.RECEIVER)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
contextReceiverDescriptors.zip(0 until contextReceivers.size).reversed()
|
|
||||||
.forEach { (contextReceiverDescriptor, i) ->
|
if (languageVersionSettings.supportsFeature(LanguageFeature.ContextReceivers)) {
|
||||||
contextReceivers[i].name()?.let {
|
val receiverToLabelMap = linkedMapOf<ReceiverParameterDescriptor, String>()
|
||||||
receiverToLabelMap[contextReceiverDescriptor] = it
|
if (receiverTypeRef != null && extensionReceiver != null) {
|
||||||
|
receiverTypeRef.nameForReceiverLabel()?.let {
|
||||||
|
receiverToLabelMap[extensionReceiver] = it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
trace.record(BindingContext.DESCRIPTOR_TO_NAMED_RECEIVERS, functionDescriptor, receiverToLabelMap)
|
contextReceiverDescriptors.zip(0 until contextReceivers.size).reversed()
|
||||||
|
.forEach { (contextReceiverDescriptor, i) ->
|
||||||
|
contextReceivers[i].name()?.let {
|
||||||
|
receiverToLabelMap[contextReceiverDescriptor] = it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
trace.record(BindingContext.DESCRIPTOR_TO_NAMED_RECEIVERS, functionDescriptor, receiverToLabelMap)
|
||||||
|
}
|
||||||
|
|
||||||
functionDescriptor.initialize(
|
functionDescriptor.initialize(
|
||||||
extensionReceiver,
|
extensionReceiver,
|
||||||
getDispatchReceiverParameterIfNeeded(container),
|
getDispatchReceiverParameterIfNeeded(container),
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.types.expressions
|
package org.jetbrains.kotlin.types.expressions
|
||||||
|
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
|
import org.jetbrains.kotlin.config.LanguageFeature
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.diagnostics.Errors.LABEL_NAME_CLASH
|
import org.jetbrains.kotlin.diagnostics.Errors.LABEL_NAME_CLASH
|
||||||
import org.jetbrains.kotlin.diagnostics.Errors.UNRESOLVED_REFERENCE
|
import org.jetbrains.kotlin.diagnostics.Errors.UNRESOLVED_REFERENCE
|
||||||
@@ -33,12 +34,12 @@ object LabelResolver {
|
|||||||
private fun getElementsByLabelName(
|
private fun getElementsByLabelName(
|
||||||
labelName: Name,
|
labelName: Name,
|
||||||
labelExpression: KtSimpleNameExpression,
|
labelExpression: KtSimpleNameExpression,
|
||||||
isThisExpression: Boolean
|
classNameLabelsEnabled: Boolean
|
||||||
): Set<KtElement> {
|
): Set<KtElement> {
|
||||||
val elements = linkedSetOf<KtElement>()
|
val elements = linkedSetOf<KtElement>()
|
||||||
var parent: PsiElement? = labelExpression.parent
|
var parent: PsiElement? = labelExpression.parent
|
||||||
while (parent != null) {
|
while (parent != null) {
|
||||||
val names = getLabelNamesIfAny(parent, isThisExpression)
|
val names = getLabelNamesIfAny(parent, classNameLabelsEnabled)
|
||||||
if (names.contains(labelName)) {
|
if (names.contains(labelName)) {
|
||||||
elements.add(getExpressionUnderLabel(parent as KtExpression))
|
elements.add(getExpressionUnderLabel(parent as KtExpression))
|
||||||
}
|
}
|
||||||
@@ -47,7 +48,7 @@ object LabelResolver {
|
|||||||
return elements
|
return elements
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getLabelNamesIfAny(element: PsiElement, addContextReceiverNames: Boolean): List<Name> {
|
fun getLabelNamesIfAny(element: PsiElement, addClassNameLabels: Boolean): List<Name> {
|
||||||
val result = mutableListOf<Name>()
|
val result = mutableListOf<Name>()
|
||||||
when (element) {
|
when (element) {
|
||||||
is KtLabeledExpression -> result.addIfNotNull(element.getLabelNameAsName())
|
is KtLabeledExpression -> result.addIfNotNull(element.getLabelNameAsName())
|
||||||
@@ -60,10 +61,10 @@ object LabelResolver {
|
|||||||
is KtPropertyAccessor -> element.property
|
is KtPropertyAccessor -> element.property
|
||||||
else -> return result
|
else -> return result
|
||||||
}
|
}
|
||||||
if (addContextReceiverNames) {
|
if (addClassNameLabels) {
|
||||||
|
functionOrProperty.receiverTypeReference?.nameForReceiverLabel()?.let { result.add(Name.identifier(it)) }
|
||||||
functionOrProperty.contextReceivers
|
functionOrProperty.contextReceivers
|
||||||
.mapNotNullTo(result) { it.name()?.let { s -> Name.identifier(s) } }
|
.mapNotNullTo(result) { it.name()?.let { s -> Name.identifier(s) } }
|
||||||
functionOrProperty.receiverTypeReference?.nameForReceiverLabel()?.let { result.add(Name.identifier(it)) }
|
|
||||||
}
|
}
|
||||||
val name = functionOrProperty.nameAsName ?: getLabelForFunctionalExpression(functionOrProperty)
|
val name = functionOrProperty.nameAsName ?: getLabelForFunctionalExpression(functionOrProperty)
|
||||||
result.addIfNotNull(name)
|
result.addIfNotNull(name)
|
||||||
@@ -129,9 +130,9 @@ object LabelResolver {
|
|||||||
labelName: Name,
|
labelName: Name,
|
||||||
labelExpression: KtSimpleNameExpression,
|
labelExpression: KtSimpleNameExpression,
|
||||||
trace: BindingTrace,
|
trace: BindingTrace,
|
||||||
isThisExpression: Boolean
|
classNameLabelsEnabled: Boolean
|
||||||
): KtElement? {
|
): KtElement? {
|
||||||
val list = getElementsByLabelName(labelName, labelExpression, isThisExpression)
|
val list = getElementsByLabelName(labelName, labelExpression, classNameLabelsEnabled)
|
||||||
if (list.isEmpty()) return null
|
if (list.isEmpty()) return null
|
||||||
|
|
||||||
if (list.size > 1) {
|
if (list.size > 1) {
|
||||||
@@ -175,15 +176,28 @@ object LabelResolver {
|
|||||||
return LabeledReceiverResolutionResult.labelResolutionSuccess(thisReceiver)
|
return LabeledReceiverResolutionResult.labelResolutionSuccess(thisReceiver)
|
||||||
}
|
}
|
||||||
0 -> {
|
0 -> {
|
||||||
val element = resolveNamedLabel(labelName, targetLabel, context.trace, expression is KtThisExpression)
|
val element = resolveNamedLabel(
|
||||||
|
labelName, targetLabel, context.trace,
|
||||||
|
classNameLabelsEnabled = expression is KtThisExpression
|
||||||
|
&& context.languageVersionSettings.supportsFeature(LanguageFeature.ContextReceivers)
|
||||||
|
)
|
||||||
val declarationDescriptor = context.trace.bindingContext[DECLARATION_TO_DESCRIPTOR, element]
|
val declarationDescriptor = context.trace.bindingContext[DECLARATION_TO_DESCRIPTOR, element]
|
||||||
if (declarationDescriptor is FunctionDescriptor) {
|
if (declarationDescriptor is FunctionDescriptor) {
|
||||||
val receiverToLabelMap =
|
val receiverToLabelMap = context.trace.bindingContext[
|
||||||
context.trace.bindingContext[DESCRIPTOR_TO_NAMED_RECEIVERS, if (declarationDescriptor is PropertyAccessorDescriptor) declarationDescriptor.correspondingProperty else declarationDescriptor]
|
DESCRIPTOR_TO_NAMED_RECEIVERS,
|
||||||
val thisReceiver = receiverToLabelMap?.entries?.find {
|
if (declarationDescriptor is PropertyAccessorDescriptor) declarationDescriptor.correspondingProperty else declarationDescriptor
|
||||||
|
]
|
||||||
|
val thisReceivers = receiverToLabelMap?.entries?.filter {
|
||||||
it.value == labelName.identifier
|
it.value == labelName.identifier
|
||||||
}?.key ?: declarationDescriptor.extensionReceiverParameter
|
}?.map { it.key } ?: emptyList()
|
||||||
if (thisReceiver != null) {
|
val thisReceiver = when {
|
||||||
|
thisReceivers.isEmpty() -> declarationDescriptor.extensionReceiverParameter
|
||||||
|
thisReceivers.size == 1 -> thisReceivers.single()
|
||||||
|
else -> {
|
||||||
|
BindingContextUtils.reportAmbiguousLabel(context.trace, targetLabel, declarationsByLabel)
|
||||||
|
return LabeledReceiverResolutionResult.labelResolutionFailed()
|
||||||
|
}
|
||||||
|
}?.also {
|
||||||
context.trace.record(LABEL_TARGET, targetLabel, element)
|
context.trace.record(LABEL_TARGET, targetLabel, element)
|
||||||
context.trace.record(REFERENCE_TARGET, referenceExpression, declarationDescriptor)
|
context.trace.record(REFERENCE_TARGET, referenceExpression, declarationDescriptor)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// !LANGUAGE: +ContextReceivers
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
fun List<Int>.decimateEveryEvenThird() = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>sequence<!> {
|
fun List<Int>.decimateEveryEvenThird() = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>sequence<!> {
|
||||||
|
|||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// !LANGUAGE: +ContextReceivers
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
|
||||||
fun List<Int>.decimateEveryEvenThird() = sequence {
|
fun List<Int>.decimateEveryEvenThird() = sequence {
|
||||||
|
|||||||
Vendored
+12
@@ -0,0 +1,12 @@
|
|||||||
|
fun List<Int>.f() {
|
||||||
|
this<!UNRESOLVED_LABEL!>@List<!>.size
|
||||||
|
}
|
||||||
|
|
||||||
|
context(String)
|
||||||
|
fun Int.f() {
|
||||||
|
this<!UNRESOLVED_LABEL!>@String<!>.length
|
||||||
|
this<!UNRESOLVED_LABEL!>@Int<!>.toDouble()
|
||||||
|
}
|
||||||
|
|
||||||
|
context(String)
|
||||||
|
val p: String get() = this<!UNRESOLVED_LABEL!>@String<!>
|
||||||
Vendored
+12
@@ -0,0 +1,12 @@
|
|||||||
|
fun List<Int>.f() {
|
||||||
|
this<!UNRESOLVED_REFERENCE!>@List<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>size<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
<!UNSUPPORTED_FEATURE!>context(String)<!>
|
||||||
|
fun Int.f() {
|
||||||
|
this<!UNRESOLVED_REFERENCE!>@String<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>length<!>
|
||||||
|
this<!UNRESOLVED_REFERENCE!>@Int<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>toDouble<!>()
|
||||||
|
}
|
||||||
|
|
||||||
|
<!UNSUPPORTED_FEATURE!>context(String)<!>
|
||||||
|
val p: String get() = this<!UNRESOLVED_REFERENCE!>@String<!>
|
||||||
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public val p: kotlin.String
|
||||||
|
public fun kotlin.Int.f(): kotlin.Unit
|
||||||
|
public fun kotlin.collections.List<kotlin.Int>.f(): kotlin.Unit
|
||||||
+11
-1
@@ -4,7 +4,17 @@ class A<T>(val a: T)
|
|||||||
class B(val b: Any)
|
class B(val b: Any)
|
||||||
class C(val c: Any)
|
class C(val c: Any)
|
||||||
|
|
||||||
context(A<Int>, A<String>, B) fun f() {
|
context(A<String>) fun A<Int>.f() {
|
||||||
|
this<!UNRESOLVED_LABEL!>@A<!>.a.length
|
||||||
|
}
|
||||||
|
|
||||||
|
<!CONFLICTING_OVERLOADS!>context(A<String>, B) fun f()<!> {
|
||||||
|
this<!UNRESOLVED_LABEL!>@A<!>.a.length
|
||||||
|
this<!UNRESOLVED_LABEL!>@B<!>.b
|
||||||
|
<!NO_THIS!>this<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
<!CONFLICTING_OVERLOADS!>context(A<Int>, A<String>, B) fun f()<!> {
|
||||||
this<!UNRESOLVED_LABEL!>@A<!>.a.length
|
this<!UNRESOLVED_LABEL!>@A<!>.a.length
|
||||||
this<!UNRESOLVED_LABEL!>@B<!>.b
|
this<!UNRESOLVED_LABEL!>@B<!>.b
|
||||||
<!NO_THIS!>this<!>
|
<!NO_THIS!>this<!>
|
||||||
|
|||||||
Vendored
+12
-2
@@ -4,14 +4,24 @@ class A<T>(val a: T)
|
|||||||
class B(val b: Any)
|
class B(val b: Any)
|
||||||
class C(val c: Any)
|
class C(val c: Any)
|
||||||
|
|
||||||
context(A<Int>, A<String>, B) fun f() {
|
context(A<String>) fun A<Int>.f() {
|
||||||
|
this<!AMBIGUOUS_LABEL!>@A<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>a<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>length<!>
|
||||||
|
}
|
||||||
|
|
||||||
|
context(A<String>, B) fun f() {
|
||||||
this@A.a.length
|
this@A.a.length
|
||||||
this@B.b
|
this@B.b
|
||||||
<!NO_THIS!>this<!>
|
<!NO_THIS!>this<!>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context(A<Int>, A<String>, B) fun f() {
|
||||||
|
this<!AMBIGUOUS_LABEL!>@A<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>a<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>length<!>
|
||||||
|
this@B.b
|
||||||
|
<!NO_THIS!>this<!>
|
||||||
|
}
|
||||||
|
|
||||||
context(A<Int>, A<String>, B) fun C.f() {
|
context(A<Int>, A<String>, B) fun C.f() {
|
||||||
this@A.a.length
|
this<!AMBIGUOUS_LABEL!>@A<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>a<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>length<!>
|
||||||
this@B.b
|
this@B.b
|
||||||
this@C.c
|
this@C.c
|
||||||
this@f.c
|
this@f.c
|
||||||
|
|||||||
Vendored
+3
@@ -1,6 +1,8 @@
|
|||||||
package
|
package
|
||||||
|
|
||||||
public fun f(): kotlin.Unit
|
public fun f(): kotlin.Unit
|
||||||
|
public fun f(): kotlin.Unit
|
||||||
|
public fun A<kotlin.Int>.f(): kotlin.Unit
|
||||||
public fun C.f(): kotlin.Unit
|
public fun C.f(): kotlin.Unit
|
||||||
|
|
||||||
public final class A</*0*/ T> {
|
public final class A</*0*/ T> {
|
||||||
@@ -26,3 +28,4 @@ public final class C {
|
|||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-1
@@ -4,7 +4,21 @@ class A<T>(val a: T)
|
|||||||
class B(val b: Any)
|
class B(val b: Any)
|
||||||
class C(val c: Any)
|
class C(val c: Any)
|
||||||
|
|
||||||
<!MUST_BE_INITIALIZED!>context(A<Int>, A<String>, B) var p: Int<!>
|
<!MUST_BE_INITIALIZED!>context(A<String>, B) var <!REDECLARATION!>p<!>: Int<!>
|
||||||
|
get() {
|
||||||
|
this<!UNRESOLVED_LABEL!>@A<!>.a.length
|
||||||
|
this<!UNRESOLVED_LABEL!>@B<!>.b
|
||||||
|
<!NO_THIS!>this<!>
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
set(value) {
|
||||||
|
this<!UNRESOLVED_LABEL!>@A<!>.a.length
|
||||||
|
this<!UNRESOLVED_LABEL!>@B<!>.b
|
||||||
|
<!NO_THIS!>this<!>
|
||||||
|
field = value
|
||||||
|
}
|
||||||
|
|
||||||
|
<!MUST_BE_INITIALIZED!>context(A<Int>, A<String>, B) var <!REDECLARATION!>p<!>: Int<!>
|
||||||
get() {
|
get() {
|
||||||
this<!UNRESOLVED_LABEL!>@A<!>.a.toDouble()
|
this<!UNRESOLVED_LABEL!>@A<!>.a.toDouble()
|
||||||
this<!UNRESOLVED_LABEL!>@A<!>.a.length
|
this<!UNRESOLVED_LABEL!>@A<!>.a.length
|
||||||
|
|||||||
Vendored
+17
-3
@@ -4,9 +4,8 @@ class A<T>(val a: T)
|
|||||||
class B(val b: Any)
|
class B(val b: Any)
|
||||||
class C(val c: Any)
|
class C(val c: Any)
|
||||||
|
|
||||||
context(A<Int>, A<String>, B) var p: Int
|
context(A<String>, B) var p: Int
|
||||||
get() {
|
get() {
|
||||||
this@A.a.<!UNRESOLVED_REFERENCE!>toDouble<!>()
|
|
||||||
this@A.a.length
|
this@A.a.length
|
||||||
this@B.b
|
this@B.b
|
||||||
<!NO_THIS!>this<!>
|
<!NO_THIS!>this<!>
|
||||||
@@ -19,9 +18,24 @@ context(A<Int>, A<String>, B) var p: Int
|
|||||||
<!UNRESOLVED_REFERENCE!>field<!> = value
|
<!UNRESOLVED_REFERENCE!>field<!> = value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context(A<Int>, A<String>, B) var p: Int
|
||||||
|
get() {
|
||||||
|
this<!AMBIGUOUS_LABEL!>@A<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>a<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>toDouble<!>()
|
||||||
|
this<!AMBIGUOUS_LABEL!>@A<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>a<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>length<!>
|
||||||
|
this@B.b
|
||||||
|
<!NO_THIS!>this<!>
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
set(value) {
|
||||||
|
this<!AMBIGUOUS_LABEL!>@A<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>a<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>length<!>
|
||||||
|
this@B.b
|
||||||
|
<!NO_THIS!>this<!>
|
||||||
|
<!UNRESOLVED_REFERENCE!>field<!> = value
|
||||||
|
}
|
||||||
|
|
||||||
context(A<Int>, A<String>, B) val C.p: Int
|
context(A<Int>, A<String>, B) val C.p: Int
|
||||||
get() {
|
get() {
|
||||||
this@A.a.length
|
this<!AMBIGUOUS_LABEL!>@A<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>a<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>length<!>
|
||||||
this@B.b
|
this@B.b
|
||||||
this@C.c
|
this@C.c
|
||||||
this@p.c
|
this@p.c
|
||||||
|
|||||||
compiler/testData/diagnostics/tests/extensions/contextReceivers/thisWithReceiverLabelsProperties.txt
Vendored
+1
@@ -1,5 +1,6 @@
|
|||||||
package
|
package
|
||||||
|
|
||||||
|
public var p: kotlin.Int
|
||||||
public var p: kotlin.Int
|
public var p: kotlin.Int
|
||||||
public val C.p: kotlin.Int
|
public val C.p: kotlin.Int
|
||||||
|
|
||||||
|
|||||||
Generated
+6
@@ -10618,6 +10618,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.kt");
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/insideDeclaration.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("labelsFromClassNameForbidden.kt")
|
||||||
|
public void testLabelsFromClassNameForbidden() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/extensions/contextReceivers/labelsFromClassNameForbidden.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("lazy.kt")
|
@TestMetadata("lazy.kt")
|
||||||
public void testLazy() throws Exception {
|
public void testLazy() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user