diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.java index 01edbd5b875..2673bdb5664 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.java @@ -33,6 +33,7 @@ import org.jetbrains.kotlin.resolve.calls.results.OverloadResolutionResults; import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowInfo; import org.jetbrains.kotlin.resolve.scopes.LexicalScope; import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver; +import org.jetbrains.kotlin.resolve.validation.OperatorValidator; import org.jetbrains.kotlin.resolve.validation.SymbolUsageValidator; import org.jetbrains.kotlin.types.DeferredType; import org.jetbrains.kotlin.types.JetType; @@ -174,7 +175,7 @@ public class DelegatedPropertyResolver { trace.record(DELEGATED_PROPERTY_PD_RESOLVED_CALL, propertyDescriptor, functionResults.getResultingCall()); } - /* Resolve get() or set() methods from delegate */ + /* Resolve getValue() or setValue() methods from delegate */ private void resolveDelegatedPropertyConventionMethod( @NotNull PropertyDescriptor propertyDescriptor, @NotNull JetExpression delegateExpression, @@ -213,6 +214,11 @@ public class DelegatedPropertyResolver { return; } + FunctionDescriptor resultingDescriptor = functionResults.getResultingDescriptor(); + if (!resultingDescriptor.isOperator()) { + OperatorValidator.Companion.report(delegateExpression, resultingDescriptor, trace); + } + ResolvedCall resultingCall = functionResults.getResultingCall(); PsiElement declaration = DescriptorToSourceUtils.descriptorToDeclaration(propertyDescriptor); if (declaration instanceof JetProperty) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/validation/OperatorValidator.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/validation/OperatorValidator.kt index 1e8788ed6b5..03665d38bb3 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/validation/OperatorValidator.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/validation/OperatorValidator.kt @@ -23,7 +23,6 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticSink import org.jetbrains.kotlin.diagnostics.Errors import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.resolve.BindingContext -import org.jetbrains.kotlin.resolve.bindingContextUtil.get import org.jetbrains.kotlin.resolve.BindingTrace import org.jetbrains.kotlin.resolve.calls.CallTransformer import org.jetbrains.kotlin.resolve.calls.tasks.isDynamic @@ -35,7 +34,7 @@ public class OperatorValidator : SymbolUsageValidator { override fun validateCall(resolvedCall: ResolvedCall<*>?, targetDescriptor: CallableDescriptor, trace: BindingTrace, element: PsiElement) { val functionDescriptor = targetDescriptor as? FunctionDescriptor ?: return - if (functionDescriptor.isDynamic() || ErrorUtils.isError(functionDescriptor)) return + if (!checkNotErrorOrDynamic(functionDescriptor)) return val jetElement = element as? JetElement ?: return val call = resolvedCall?.call ?: trace.bindingContext[BindingContext.CALL, jetElement] @@ -71,9 +70,15 @@ public class OperatorValidator : SymbolUsageValidator { companion object { fun report(element: JetElement, descriptor: FunctionDescriptor, sink: DiagnosticSink) { + if (!checkNotErrorOrDynamic(descriptor)) return + val containingDeclaration = descriptor.containingDeclaration val containingDeclarationName = containingDeclaration.fqNameUnsafe.asString() sink.report(Errors.OPERATOR_MODIFIER_REQUIRED.on(element, descriptor, containingDeclarationName)) } + + private fun checkNotErrorOrDynamic(functionDescriptor: FunctionDescriptor): Boolean { + return (!functionDescriptor.isDynamic() && !ErrorUtils.isError(functionDescriptor)) + } } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/DeprecatedGetSetPropertyDelegateConvention.kt b/compiler/testData/diagnostics/tests/DeprecatedGetSetPropertyDelegateConvention.kt index 2e94959306a..ba702214fd7 100644 --- a/compiler/testData/diagnostics/tests/DeprecatedGetSetPropertyDelegateConvention.kt +++ b/compiler/testData/diagnostics/tests/DeprecatedGetSetPropertyDelegateConvention.kt @@ -1,33 +1,33 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER class CustomDelegate { - fun get(thisRef: Any?, prop: PropertyMetadata): String = prop.name - fun set(thisRef: Any?, prop: PropertyMetadata, value: String) {} + operator fun get(thisRef: Any?, prop: PropertyMetadata): String = prop.name + operator fun set(thisRef: Any?, prop: PropertyMetadata, value: String) {} } class OkDelegate { - fun getValue(thisRef: Any?, prop: PropertyMetadata): String = prop.name - fun setValue(thisRef: Any?, prop: PropertyMetadata, value: String) {} + operator fun getValue(thisRef: Any?, prop: PropertyMetadata): String = prop.name + operator fun setValue(thisRef: Any?, prop: PropertyMetadata, value: String) {} } class CustomDelegate2 { - fun get(thisRef: Any?, prop: PropertyMetadata): String = prop.name - fun set(thisRef: Any?, prop: PropertyMetadata, value: String) {} + operator fun get(thisRef: Any?, prop: PropertyMetadata): String = prop.name + operator fun set(thisRef: Any?, prop: PropertyMetadata, value: String) {} - fun getValue(thisRef: Any?, prop: PropertyMetadata): Int = 5 - fun setValue(thisRef: Any?, prop: PropertyMetadata, value: Int) {} + operator fun getValue(thisRef: Any?, prop: PropertyMetadata): Int = 5 + operator fun setValue(thisRef: Any?, prop: PropertyMetadata, value: Int) {} } class CustomDelegate3 { - fun get(thisRef: Any?, prop: PropertyMetadata): String = prop.name - fun set(thisRef: Any?, prop: PropertyMetadata, value: String) {} + operator fun get(thisRef: Any?, prop: PropertyMetadata): String = prop.name + operator fun set(thisRef: Any?, prop: PropertyMetadata, value: String) {} } -fun OkDelegate.get(thisRef: Any?, prop: PropertyMetadata): Int = 4 -fun OkDelegate.set(thisRef: Any?, prop: PropertyMetadata, value: Int) {} +operator fun OkDelegate.get(thisRef: Any?, prop: PropertyMetadata): Int = 4 +operator fun OkDelegate.set(thisRef: Any?, prop: PropertyMetadata, value: Int) {} -fun CustomDelegate3.getValue(thisRef: Any?, prop: PropertyMetadata): Int = 4 -fun CustomDelegate3.setValue(thisRef: Any?, prop: PropertyMetadata, value: Int) {} +operator fun CustomDelegate3.getValue(thisRef: Any?, prop: PropertyMetadata): Int = 4 +operator fun CustomDelegate3.setValue(thisRef: Any?, prop: PropertyMetadata, value: Int) {} class Example { diff --git a/compiler/testData/diagnostics/tests/DeprecatedGetSetPropertyDelegateConvention.txt b/compiler/testData/diagnostics/tests/DeprecatedGetSetPropertyDelegateConvention.txt index 42e62e920a3..9f7c92dcb7b 100644 --- a/compiler/testData/diagnostics/tests/DeprecatedGetSetPropertyDelegateConvention.txt +++ b/compiler/testData/diagnostics/tests/DeprecatedGetSetPropertyDelegateConvention.txt @@ -1,36 +1,36 @@ package -public fun OkDelegate.get(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.Int -public fun CustomDelegate3.getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.Int -public fun OkDelegate.set(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ value: kotlin.Int): kotlin.Unit -public fun CustomDelegate3.setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ value: kotlin.Int): kotlin.Unit +public operator fun OkDelegate.get(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.Int +public operator fun CustomDelegate3.getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.Int +public operator fun OkDelegate.set(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ value: kotlin.Int): kotlin.Unit +public operator fun CustomDelegate3.setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ value: kotlin.Int): kotlin.Unit public final class CustomDelegate { public constructor CustomDelegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun get(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String + public final operator fun get(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun set(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ value: kotlin.String): kotlin.Unit + public final operator fun set(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ value: kotlin.String): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } public final class CustomDelegate2 { public constructor CustomDelegate2() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun get(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String - public final fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.Int + public final operator fun get(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun set(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ value: kotlin.String): kotlin.Unit - public final fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ value: kotlin.Int): kotlin.Unit + public final operator fun set(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ value: kotlin.String): kotlin.Unit + public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ value: kotlin.Int): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } public final class CustomDelegate3 { public constructor CustomDelegate3() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun get(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String + public final operator fun get(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun set(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ value: kotlin.String): kotlin.Unit + public final operator fun set(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ value: kotlin.String): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } @@ -52,8 +52,8 @@ public final class Example { public final class OkDelegate { public constructor OkDelegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ value: kotlin.String): kotlin.Unit + public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ value: kotlin.String): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/LateInit.kt b/compiler/testData/diagnostics/tests/LateInit.kt index 6b7a126019d..5720eeb4d0a 100644 --- a/compiler/testData/diagnostics/tests/LateInit.kt +++ b/compiler/testData/diagnostics/tests/LateInit.kt @@ -1,5 +1,5 @@ class CustomDelegate { - public fun getValue(thisRef: Any?, prop: PropertyMetadata): String = prop.name + operator fun getValue(thisRef: Any?, prop: PropertyMetadata): String = prop.name } public abstract class A(lateinit var p2: String) { diff --git a/compiler/testData/diagnostics/tests/LateInit.txt b/compiler/testData/diagnostics/tests/LateInit.txt index 97a812d3de8..e2dd8e1e56a 100644 --- a/compiler/testData/diagnostics/tests/LateInit.txt +++ b/compiler/testData/diagnostics/tests/LateInit.txt @@ -56,7 +56,7 @@ public final class B { public final class CustomDelegate { public constructor CustomDelegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/FieldAnnotations.kt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/FieldAnnotations.kt index fedbe43a1eb..8261ba7d41b 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/FieldAnnotations.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/FieldAnnotations.kt @@ -1,7 +1,7 @@ annotation class Ann class CustomDelegate { - public fun getValue(thisRef: Any?, prop: PropertyMetadata): String = prop.name + operator fun getValue(thisRef: Any?, prop: PropertyMetadata): String = prop.name } @field:Ann diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/FieldAnnotations.txt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/FieldAnnotations.txt index 5cd54f4d8f5..11b3e681c2e 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/FieldAnnotations.txt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/FieldAnnotations.txt @@ -10,7 +10,7 @@ package public final class CustomDelegate { public constructor CustomDelegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/GetterAnnotations.kt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/GetterAnnotations.kt index 13615356368..07c300c3191 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/GetterAnnotations.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/GetterAnnotations.kt @@ -1,7 +1,7 @@ annotation class Ann class CustomDelegate { - public fun getValue(thisRef: Any?, prop: PropertyMetadata): String = prop.name + operator fun getValue(thisRef: Any?, prop: PropertyMetadata): String = prop.name } @get:Ann diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/GetterAnnotations.txt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/GetterAnnotations.txt index d21defd9009..e6080a542cc 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/GetterAnnotations.txt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/GetterAnnotations.txt @@ -10,7 +10,7 @@ package public final class CustomDelegate { public constructor CustomDelegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/PropertyAnnotations.kt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/PropertyAnnotations.kt index e5e85fcaa8d..0ac9ec93b63 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/PropertyAnnotations.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/PropertyAnnotations.kt @@ -2,7 +2,7 @@ annotation class Ann annotation class Second class CustomDelegate { - public fun getValue(thisRef: Any?, prop: PropertyMetadata): String = prop.name + operator fun getValue(thisRef: Any?, prop: PropertyMetadata): String = prop.name } @property:Ann diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/PropertyAnnotations.txt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/PropertyAnnotations.txt index 507ca881931..1a7e95f54f3 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/PropertyAnnotations.txt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/PropertyAnnotations.txt @@ -10,7 +10,7 @@ package public final class CustomDelegate { public constructor CustomDelegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SetterAnnotations.kt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SetterAnnotations.kt index 23c9903091f..c5bf20d728e 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SetterAnnotations.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SetterAnnotations.kt @@ -1,8 +1,8 @@ annotation class Ann class CustomDelegate { - public fun getValue(thisRef: Any?, prop: PropertyMetadata): String = prop.name - fun setValue(thisRef: Any?, prop: PropertyMetadata, value: String) {} + operator fun getValue(thisRef: Any?, prop: PropertyMetadata): String = prop.name + operator fun setValue(thisRef: Any?, prop: PropertyMetadata, value: String) {} } @set:Ann diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SetterAnnotations.txt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SetterAnnotations.txt index 6ec39ff5b77..5e9da10d46c 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SetterAnnotations.txt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SetterAnnotations.txt @@ -10,9 +10,9 @@ package public final class CustomDelegate { public constructor CustomDelegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ value: kotlin.String): kotlin.Unit + public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ value: kotlin.String): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SparamAnnotations.kt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SparamAnnotations.kt index 48fb508b786..361071d22be 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SparamAnnotations.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SparamAnnotations.kt @@ -1,8 +1,8 @@ annotation class Ann class CustomDelegate { - public fun getValue(thisRef: Any?, prop: PropertyMetadata): String = prop.name - fun setValue(thisRef: Any?, prop: PropertyMetadata, value: String) {} + operator fun getValue(thisRef: Any?, prop: PropertyMetadata): String = prop.name + operator fun setValue(thisRef: Any?, prop: PropertyMetadata, value: String) {} } @setparam:Ann diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SparamAnnotations.txt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SparamAnnotations.txt index 781f288b8c8..97c967403fd 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SparamAnnotations.txt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SparamAnnotations.txt @@ -10,9 +10,9 @@ package public final class CustomDelegate { public constructor CustomDelegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ value: kotlin.String): kotlin.Unit + public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ value: kotlin.String): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassDelegatedProperties.kt b/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassDelegatedProperties.kt index 1e8ec539c35..4ad30ac19ff 100644 --- a/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassDelegatedProperties.kt +++ b/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassDelegatedProperties.kt @@ -1,5 +1,5 @@ class Del { - fun getValue(_this: Any?, p: PropertyMetadata): Int = 0 + operator fun getValue(_this: Any?, p: PropertyMetadata): Int = 0 } fun df(del: Del): Del = del diff --git a/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassDelegatedProperties.txt b/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassDelegatedProperties.txt index 1418464deef..039e04b0714 100644 --- a/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassDelegatedProperties.txt +++ b/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassDelegatedProperties.txt @@ -6,7 +6,7 @@ public fun test(/*0*/ del: kotlin.Any?): kotlin.Unit public final class Del { public constructor Del() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ _this: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ _this: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/absentErrorAboutInitializer.kt b/compiler/testData/diagnostics/tests/delegatedProperty/absentErrorAboutInitializer.kt index 4d656eeb425..3381fdbaa4e 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/absentErrorAboutInitializer.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/absentErrorAboutInitializer.kt @@ -3,7 +3,7 @@ val a: Int by Delegate() class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/absentErrorAboutInitializer.txt b/compiler/testData/diagnostics/tests/delegatedProperty/absentErrorAboutInitializer.txt index bb49ab03638..0b2e8cd88fc 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/absentErrorAboutInitializer.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/absentErrorAboutInitializer.txt @@ -5,7 +5,7 @@ public val a: kotlin.Int public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/absentErrorAboutType.kt b/compiler/testData/diagnostics/tests/delegatedProperty/absentErrorAboutType.kt index e336ead00b4..e9a96724c88 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/absentErrorAboutType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/absentErrorAboutType.kt @@ -3,7 +3,7 @@ val a by Delegate() class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/absentErrorAboutType.txt b/compiler/testData/diagnostics/tests/delegatedProperty/absentErrorAboutType.txt index bb49ab03638..0b2e8cd88fc 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/absentErrorAboutType.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/absentErrorAboutType.txt @@ -5,7 +5,7 @@ public val a: kotlin.Int public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/abstractDelegatedProperty.kt b/compiler/testData/diagnostics/tests/delegatedProperty/abstractDelegatedProperty.kt index 67712e45d1a..86ef0cee92b 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/abstractDelegatedProperty.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/abstractDelegatedProperty.kt @@ -5,7 +5,7 @@ abstract class A { } class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/abstractDelegatedProperty.txt b/compiler/testData/diagnostics/tests/delegatedProperty/abstractDelegatedProperty.txt index 5e1a3ad8855..eaf18b94192 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/abstractDelegatedProperty.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/abstractDelegatedProperty.txt @@ -11,7 +11,7 @@ public abstract class A { public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/backingField.kt b/compiler/testData/diagnostics/tests/delegatedProperty/backingField.kt index 22af3183d93..95e2b0f7899 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/backingField.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/backingField.kt @@ -7,7 +7,7 @@ class B { } class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/backingField.txt b/compiler/testData/diagnostics/tests/delegatedProperty/backingField.txt index 6a6ebf4d884..086c0819fd7 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/backingField.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/backingField.txt @@ -12,7 +12,7 @@ public final class B { public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/defaultGetter.kt b/compiler/testData/diagnostics/tests/delegatedProperty/defaultGetter.kt index 51e35629507..4c19d59e378 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/defaultGetter.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/defaultGetter.kt @@ -4,7 +4,7 @@ val a: Int by Delegate() get class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/defaultGetter.txt b/compiler/testData/diagnostics/tests/delegatedProperty/defaultGetter.txt index bb49ab03638..0b2e8cd88fc 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/defaultGetter.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/defaultGetter.txt @@ -5,7 +5,7 @@ public val a: kotlin.Int public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/defaultSetter.kt b/compiler/testData/diagnostics/tests/delegatedProperty/defaultSetter.kt index ba2a0eb958d..4ae1b933187 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/defaultSetter.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/defaultSetter.kt @@ -4,9 +4,9 @@ var a: Int by Delegate() private set class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } - fun setValue(t: Any?, p: PropertyMetadata, i: Int) {} + operator fun setValue(t: Any?, p: PropertyMetadata, i: Int) {} } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/defaultSetter.txt b/compiler/testData/diagnostics/tests/delegatedProperty/defaultSetter.txt index 3cc7f53f52d..7e14010bfa5 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/defaultSetter.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/defaultSetter.txt @@ -5,8 +5,8 @@ public var a: kotlin.Int public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ i: kotlin.Int): kotlin.Unit + public final operator fun setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ i: kotlin.Int): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTrait.kt b/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTrait.kt index 2fdda6e420a..55cdb35536b 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTrait.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTrait.kt @@ -13,7 +13,7 @@ fun foo() { } class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTrait.txt b/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTrait.txt index ba93f4735a5..0d719c00c68 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTrait.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTrait.txt @@ -20,7 +20,7 @@ public final class AImpl : A { public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTraitTypeMismatch.kt b/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTraitTypeMismatch.kt index 22c8d14fffe..895740f613b 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTraitTypeMismatch.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTraitTypeMismatch.kt @@ -13,7 +13,7 @@ fun foo() { } class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): String { + operator fun getValue(t: Any?, p: PropertyMetadata): String { return "" } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTraitTypeMismatch.txt b/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTraitTypeMismatch.txt index 397ffa6eac2..4c6874e1f11 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTraitTypeMismatch.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTraitTypeMismatch.txt @@ -20,7 +20,7 @@ public final class AImpl : A { public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.String public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/genericGetter.kt b/compiler/testData/diagnostics/tests/delegatedProperty/genericGetter.kt index 9b264fdb878..011a055adce 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/genericGetter.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/genericGetter.kt @@ -3,7 +3,7 @@ val a: Int by A(1) class A(i: T) { - fun getValue(t: Any?, p: PropertyMetadata): T { + operator fun getValue(t: Any?, p: PropertyMetadata): T { throw Exception() } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/genericGetter.txt b/compiler/testData/diagnostics/tests/delegatedProperty/genericGetter.txt index a06f9d88944..828738e4aa8 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/genericGetter.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/genericGetter.txt @@ -5,7 +5,7 @@ public val a: kotlin.Int public final class A { public constructor A(/*0*/ i: T) public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/getterWithSubtype.kt b/compiler/testData/diagnostics/tests/delegatedProperty/getterWithSubtype.kt index 661b9a7379c..6f48a5c3b7d 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/getterWithSubtype.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/getterWithSubtype.kt @@ -6,7 +6,7 @@ class Derived: Base() val a: Base by A() class A { - fun getValue(t: Any?, p: PropertyMetadata): Derived { + operator fun getValue(t: Any?, p: PropertyMetadata): Derived { return Derived() } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/getterWithSubtype.txt b/compiler/testData/diagnostics/tests/delegatedProperty/getterWithSubtype.txt index b1cada7be41..eff74c22ed0 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/getterWithSubtype.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/getterWithSubtype.txt @@ -5,7 +5,7 @@ public val a: Base public final class A { public constructor A() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): Derived + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): Derived public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inTrait.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inTrait.kt index bf5aaca1760..8f47df808e8 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inTrait.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inTrait.kt @@ -5,7 +5,7 @@ interface T { } class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inTrait.txt b/compiler/testData/diagnostics/tests/delegatedProperty/inTrait.txt index 796fe7a7ab5..138cff04a7a 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inTrait.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inTrait.txt @@ -3,7 +3,7 @@ package public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt index 17c78cadb23..836fc4d0d2c 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt @@ -21,12 +21,12 @@ fun getMyConcreteProperty() = MyProperty() class MyProperty { - public fun getValue(thisRef: R, desc: PropertyMetadata): T { + operator fun getValue(thisRef: R, desc: PropertyMetadata): T { println("get $thisRef ${desc.name}") return null as T } - public fun setValue(thisRef: R, desc: PropertyMetadata, value: T) { + operator fun setValue(thisRef: R, desc: PropertyMetadata, value: T) { println("set $thisRef ${desc.name} $value") } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.txt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.txt index b2180c535cb..0b0684ff826 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.txt @@ -26,9 +26,9 @@ package baz { public final class MyProperty { public constructor MyProperty() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata, /*2*/ value: T): kotlin.Unit + public final operator fun setValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata, /*2*/ value: T): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionGet.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionGet.kt index 0031f7ddb13..53cf2592c21 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionGet.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionGet.kt @@ -5,7 +5,7 @@ class A1 { } class MyProperty1 {} -fun MyProperty1.getValue(thisRef: Any?, desc: PropertyMetadata): String { +operator fun MyProperty1.getValue(thisRef: Any?, desc: PropertyMetadata): String { throw Exception("$thisRef $desc") } @@ -16,7 +16,7 @@ class A2 { } class MyProperty2 {} -fun MyProperty2.getValue(thisRef: Any?, desc: PropertyMetadata): T { +operator fun MyProperty2.getValue(thisRef: Any?, desc: PropertyMetadata): T { throw Exception("$thisRef $desc") } @@ -27,7 +27,7 @@ class A3 { class MyProperty3 {} - fun MyProperty3.getValue(thisRef: Any?, desc: PropertyMetadata): T { + operator fun MyProperty3.getValue(thisRef: Any?, desc: PropertyMetadata): T { throw Exception("$thisRef $desc") } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionGet.txt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionGet.txt index ea94f785dc2..8256aee6e18 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionGet.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionGet.txt @@ -1,8 +1,8 @@ package package foo { - public fun foo.MyProperty1.getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ desc: kotlin.PropertyMetadata): kotlin.String - public fun foo.MyProperty2.getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ desc: kotlin.PropertyMetadata): T + public operator fun foo.MyProperty1.getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ desc: kotlin.PropertyMetadata): kotlin.String + public operator fun foo.MyProperty2.getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ desc: kotlin.PropertyMetadata): T public final class A1 { public constructor A1() @@ -26,7 +26,7 @@ package foo { public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - public final fun foo.A3.MyProperty3.getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ desc: kotlin.PropertyMetadata): T + public final operator fun foo.A3.MyProperty3.getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ desc: kotlin.PropertyMetadata): T public final class MyProperty3 { public constructor MyProperty3() diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.kt index 8ed85b28049..9804fd102d2 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.kt @@ -13,7 +13,7 @@ class B { } class MyProperty { - public fun getValue(thisRef: R, desc: PropertyMetadata): T { + operator fun getValue(thisRef: R, desc: PropertyMetadata): T { throw Exception("$thisRef $desc") } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.txt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.txt index 50efc83ce87..4763b1c95b0 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.txt @@ -23,7 +23,7 @@ package foo { public final class MyProperty { public constructor MyProperty() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethodInGenericClass.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethodInGenericClass.kt index 14dc7ece411..2f708079683 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethodInGenericClass.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethodInGenericClass.kt @@ -1,24 +1,24 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER class A() { - fun getValue(t: Any?, p: PropertyMetadata): T = null!! - fun setValue(t: Any?, p: PropertyMetadata, x: T) = Unit + operator fun getValue(t: Any?, p: PropertyMetadata): T = null!! + operator fun setValue(t: Any?, p: PropertyMetadata, x: T) = Unit } var a1: Int by A() var a2: Int by A() class B() { - fun getValue(t: Any?, p: PropertyMetadata): T = null!! - fun setValue(t: Any?, p: PropertyMetadata, x: R) = Unit + operator fun getValue(t: Any?, p: PropertyMetadata): T = null!! + operator fun setValue(t: Any?, p: PropertyMetadata, x: R) = Unit } var b1: Int by B() var b2: Int by B() class C() { - fun getValue(t: Any?, p: PropertyMetadata): R = null!! - fun setValue(t: Any?, p: PropertyMetadata, x: T) = Unit + operator fun getValue(t: Any?, p: PropertyMetadata): R = null!! + operator fun setValue(t: Any?, p: PropertyMetadata, x: T) = Unit } var c1: Int by C() diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethodInGenericClass.txt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethodInGenericClass.txt index ae3eac0c521..62be92b6c4b 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethodInGenericClass.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethodInGenericClass.txt @@ -10,26 +10,26 @@ public var c2: kotlin.Int public final class A { public constructor A() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ x: T): kotlin.Unit + public final operator fun setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ x: T): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } public final class B { public constructor B() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ x: R): kotlin.Unit + public final operator fun setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ x: R): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } public final class C { public constructor C() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): R + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): R public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ x: T): kotlin.Unit + public final operator fun setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ x: T): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethods.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethods.kt index 7bf4f8b0812..d7e995ef705 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethods.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethods.kt @@ -8,16 +8,16 @@ val cObj = C() var c: String by cObj class A { - fun getValue(t: Any?, p: PropertyMetadata): T = null!! - fun setValue(t: Any?, p: PropertyMetadata, x: T) = Unit + operator fun getValue(t: Any?, p: PropertyMetadata): T = null!! + operator fun setValue(t: Any?, p: PropertyMetadata, x: T) = Unit } class B -fun B.getValue(t: Any?, p: PropertyMetadata): T = null!! -fun B.setValue(t: Any?, p: PropertyMetadata, x: T) = Unit +operator fun B.getValue(t: Any?, p: PropertyMetadata): T = null!! +operator fun B.setValue(t: Any?, p: PropertyMetadata, x: T) = Unit class C -inline fun C.getValue(t: Any?, p: PropertyMetadata): T = null!! -inline fun C.setValue(t: Any?, p: PropertyMetadata, x: T) = Unit +operator inline fun C.getValue(t: Any?, p: PropertyMetadata): T = null!! +operator inline fun C.setValue(t: Any?, p: PropertyMetadata, x: T) = Unit diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethods.txt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethods.txt index 62afbd71568..439717c88f0 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethods.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethods.txt @@ -5,17 +5,17 @@ public var a1: [ERROR : Type from delegate] public var b: kotlin.Int public var c: kotlin.String public val cObj: C -public fun B.getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): T -@kotlin.inline() public fun C.getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): T -public fun B.setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ x: T): kotlin.Unit -@kotlin.inline() public fun C.setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ x: T): kotlin.Unit +public operator fun B.getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): T +@kotlin.inline() public operator fun C.getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): T +public operator fun B.setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ x: T): kotlin.Unit +@kotlin.inline() public operator fun C.setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ x: T): kotlin.Unit public final class A { public constructor A() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ x: T): kotlin.Unit + public final operator fun setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ x: T): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/labeledDelegatedExpression.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/labeledDelegatedExpression.kt index d53ad723679..b189689b695 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/labeledDelegatedExpression.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/labeledDelegatedExpression.kt @@ -3,7 +3,7 @@ class A3 { class MyProperty {} - fun MyProperty.getValue(thisRef: Any?, desc: PropertyMetadata): T { + operator fun MyProperty.getValue(thisRef: Any?, desc: PropertyMetadata): T { throw Exception("$thisRef $desc") } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/labeledDelegatedExpression.txt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/labeledDelegatedExpression.txt index 4af5ac0d5f4..1f16009ca0f 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/labeledDelegatedExpression.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/labeledDelegatedExpression.txt @@ -6,7 +6,7 @@ public final class A3 { public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - public final fun A3.MyProperty.getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ desc: kotlin.PropertyMetadata): T + public final operator fun A3.MyProperty.getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ desc: kotlin.PropertyMetadata): T public final class MyProperty { public constructor MyProperty() diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.kt index 4a7dd85c6cf..a06cb1d2355 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.kt @@ -9,11 +9,11 @@ fun getMyProperty1() = MyProperty1() class MyProperty1 { - public fun getValue(thisRef: R, desc: PropertyMetadata): T { + operator fun getValue(thisRef: R, desc: PropertyMetadata): T { throw Exception() } - public fun setValue(i: Int, j: Int, k: Int) { + operator fun setValue(i: Int, j: Any, k: Int) { println("set") } } @@ -29,11 +29,11 @@ fun getMyProperty2() = MyProperty2() class MyProperty2 { - public fun getValue(thisRef: R, desc: PropertyMetadata): T { + operator fun getValue(thisRef: R, desc: PropertyMetadata): T { throw Exception() } - public fun setValue(i: Int) { + operator fun setValue(i: Int) { println("set") } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.txt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.txt index fa2c11bf1e1..98fee54da3a 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.txt @@ -26,18 +26,18 @@ package foo { public final class MyProperty1 { public constructor MyProperty1() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ i: kotlin.Int, /*1*/ j: kotlin.Int, /*2*/ k: kotlin.Int): kotlin.Unit + public final operator fun setValue(/*0*/ i: kotlin.Int, /*1*/ j: kotlin.Any, /*2*/ k: kotlin.Int): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } public final class MyProperty2 { public constructor MyProperty2() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ i: kotlin.Int): kotlin.Unit + public final operator fun setValue(/*0*/ i: kotlin.Int): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/noExpectedTypeForSupertypeConstraint.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/noExpectedTypeForSupertypeConstraint.kt index 45f7fe4747e..14f8daf1f6d 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/noExpectedTypeForSupertypeConstraint.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/noExpectedTypeForSupertypeConstraint.kt @@ -4,11 +4,11 @@ class A { class MyProperty { - public fun getValue(thisRef: R, desc: PropertyMetadata): T { + operator fun getValue(thisRef: R, desc: PropertyMetadata): T { throw Exception("$thisRef $desc") } - public fun setValue(thisRef: R, desc: PropertyMetadata, t: T) { + operator fun setValue(thisRef: R, desc: PropertyMetadata, t: T) { throw Exception("$thisRef $desc $t") } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/noExpectedTypeForSupertypeConstraint.txt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/noExpectedTypeForSupertypeConstraint.txt index b6747adeeed..02f321f3921 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/noExpectedTypeForSupertypeConstraint.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/noExpectedTypeForSupertypeConstraint.txt @@ -11,8 +11,8 @@ public final class A { public final class MyProperty { public constructor MyProperty() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata, /*2*/ t: T): kotlin.Unit + public final operator fun setValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata, /*2*/ t: T): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/useCompleterWithoutExpectedType.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/useCompleterWithoutExpectedType.kt index a3ba12e19e4..6f14e21f6ee 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/useCompleterWithoutExpectedType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/useCompleterWithoutExpectedType.kt @@ -9,5 +9,5 @@ class A { } class MyProperty { - public fun getValue(thisRef: R, desc: PropertyMetadata): Int = throw Exception("$thisRef $desc") + operator fun getValue(thisRef: R, desc: PropertyMetadata): Int = throw Exception("$thisRef $desc") } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/useCompleterWithoutExpectedType.txt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/useCompleterWithoutExpectedType.txt index 9e8c8249e7a..8eba76a5ddd 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/useCompleterWithoutExpectedType.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/useCompleterWithoutExpectedType.txt @@ -12,7 +12,7 @@ public final class A { public final class MyProperty { public constructor MyProperty() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedType.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedType.kt index 03949c69a5d..d9f2be2bc60 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedType.kt @@ -12,12 +12,12 @@ fun getMyProperty1() = MyProperty1() class MyProperty1 { - public fun getValue(thisRef: R, desc: PropertyMetadata): T { + operator fun getValue(thisRef: R, desc: PropertyMetadata): T { println("get $thisRef ${desc.name}") throw Exception() } - public fun setValue(thisRef: R, desc: PropertyMetadata, value: T) { + operator fun setValue(thisRef: R, desc: PropertyMetadata, value: T) { println("set $thisRef ${desc.name} $value") } } @@ -36,12 +36,12 @@ fun getMyProperty2() = MyProperty2() class MyProperty2 { - public fun getValue(thisRef: Any?, desc: PropertyMetadata): T { + operator fun getValue(thisRef: Any?, desc: PropertyMetadata): T { println("get $thisRef ${desc.name}") throw Exception() } - public fun setValue(thisRef: Any?, desc: PropertyMetadata, value: T) { + operator fun setValue(thisRef: Any?, desc: PropertyMetadata, value: T) { println("set $thisRef ${desc.name} $value") } } @@ -60,12 +60,12 @@ fun getMyProperty3() = MyProperty3() class MyProperty3 { - public fun getValue(thisRef: T, desc: PropertyMetadata): String { + operator fun getValue(thisRef: T, desc: PropertyMetadata): String { println("get $thisRef ${desc.name}") return "" } - public fun setValue(thisRef: Any?, desc: PropertyMetadata, value: T) { + operator fun setValue(thisRef: Any?, desc: PropertyMetadata, value: T) { println("set $thisRef ${desc.name} $value") } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedType.txt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedType.txt index cea46bc9ab4..706c81f77a6 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedType.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedType.txt @@ -42,27 +42,27 @@ package foo { public final class MyProperty1 { public constructor MyProperty1() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata, /*2*/ value: T): kotlin.Unit + public final operator fun setValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata, /*2*/ value: T): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } public final class MyProperty2 { public constructor MyProperty2() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ desc: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ desc: kotlin.PropertyMetadata): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ desc: kotlin.PropertyMetadata, /*2*/ value: T): kotlin.Unit + public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ desc: kotlin.PropertyMetadata, /*2*/ value: T): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } public final class MyProperty3 { public constructor MyProperty3() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ thisRef: T, /*1*/ desc: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ thisRef: T, /*1*/ desc: kotlin.PropertyMetadata): kotlin.String public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ desc: kotlin.PropertyMetadata, /*2*/ value: T): kotlin.Unit + public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ desc: kotlin.PropertyMetadata, /*2*/ value: T): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedTypeForVal.kt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedTypeForVal.kt index 3c5f688f9ec..a062b94a19e 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedTypeForVal.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedTypeForVal.kt @@ -12,7 +12,7 @@ fun getMyProperty1() = MyProperty1() class MyProperty1 { - public fun getValue(thisRef: R, desc: PropertyMetadata): T { + operator fun getValue(thisRef: R, desc: PropertyMetadata): T { println("get $thisRef ${desc.name}") throw Exception() } @@ -32,7 +32,7 @@ fun getMyProperty2() = MyProperty2() class MyProperty2 { - public fun getValue(thisRef: Any?, desc: PropertyMetadata): T { + operator fun getValue(thisRef: Any?, desc: PropertyMetadata): T { println("get $thisRef ${desc.name}") throw Exception() } @@ -52,7 +52,7 @@ fun getMyProperty3() = MyProperty3() class MyProperty3 { - public fun getValue(thisRef: T, desc: PropertyMetadata): String { + operator fun getValue(thisRef: T, desc: PropertyMetadata): String { println("get $thisRef ${desc.name}") return "" } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedTypeForVal.txt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedTypeForVal.txt index 7be9c542da3..c4dd1365481 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedTypeForVal.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedTypeForVal.txt @@ -42,7 +42,7 @@ package foo { public final class MyProperty1 { public constructor MyProperty1() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } @@ -50,7 +50,7 @@ package foo { public final class MyProperty2 { public constructor MyProperty2() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ desc: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ desc: kotlin.PropertyMetadata): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } @@ -58,7 +58,7 @@ package foo { public final class MyProperty3 { public constructor MyProperty3() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ thisRef: T, /*1*/ desc: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ thisRef: T, /*1*/ desc: kotlin.PropertyMetadata): kotlin.String public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/missedSetter.kt b/compiler/testData/diagnostics/tests/delegatedProperty/missedSetter.kt index 4d61bb40303..2b31a05f9c9 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/missedSetter.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/missedSetter.kt @@ -3,7 +3,7 @@ var a: Int by A() class A { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/missedSetter.txt b/compiler/testData/diagnostics/tests/delegatedProperty/missedSetter.txt index 80dcaaf3e28..da85a7b23f9 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/missedSetter.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/missedSetter.txt @@ -5,7 +5,7 @@ public var a: kotlin.Int public final class A { public constructor A() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDefferedType.kt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDefferedType.kt index fbee36c03cb..d59b037cfea 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDefferedType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDefferedType.kt @@ -5,5 +5,5 @@ class B { } class Delegate(val init: T) { - fun getValue(t: Any?, p: PropertyMetadata): Int = null!! + operator fun getValue(t: Any?, p: PropertyMetadata): Int = null!! } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDefferedType.txt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDefferedType.txt index 86b698cc2c7..9c697bec4d6 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDefferedType.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDefferedType.txt @@ -12,7 +12,7 @@ public final class Delegate { public constructor Delegate(/*0*/ init: T) public final val init: T public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.kt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.kt index b27ee45602b..c0323584573 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.kt @@ -3,7 +3,7 @@ val a: Int by Delegate() class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.txt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.txt index 8e646bf5991..d7f768f1e57 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.txt @@ -5,7 +5,7 @@ public val a: kotlin.Int public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public final fun propertyDelegated(/*0*/ p: kotlin.PropertyMetadata, /*1*/ i: kotlin.Int = ...): kotlin.Unit public final fun propertyDelegated(/*0*/ p: kotlin.PropertyMetadata, /*1*/ s: kotlin.String = ...): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.kt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.kt index 40946895e32..8144bdb5c5a 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.kt @@ -3,7 +3,7 @@ val a: Int by Delegate() class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.txt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.txt index 9fbef8ad842..aa61f767026 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.txt @@ -5,7 +5,7 @@ public val a: kotlin.Int public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public final fun propertyDelegated(/*0*/ p: kotlin.PropertyMetadata): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedMissing.kt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedMissing.kt index 9bfb986f8bb..efc74562df1 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedMissing.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedMissing.kt @@ -3,7 +3,7 @@ val a: Int by Delegate() class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedMissing.txt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedMissing.txt index bb49ab03638..0b2e8cd88fc 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedMissing.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedMissing.txt @@ -5,7 +5,7 @@ public val a: kotlin.Int public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedPrivate.kt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedPrivate.kt index a5be0a34c82..0b2343e5938 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedPrivate.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedPrivate.kt @@ -3,7 +3,7 @@ val a: Int by Delegate() class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedPrivate.txt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedPrivate.txt index 260de41acd5..af9619013eb 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedPrivate.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedPrivate.txt @@ -5,7 +5,7 @@ public val a: kotlin.Int public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int private final fun propertyDelegated(/*0*/ p: kotlin.PropertyMetadata): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.kt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.kt index bc2d7b10b73..f41d5402785 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.kt @@ -3,7 +3,7 @@ val a: Int by Delegate() class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.txt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.txt index 4a9261f274e..f048a9cf49f 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.txt @@ -5,7 +5,7 @@ public val a: kotlin.Int public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public final fun propertyDelegated(): kotlin.Unit public final fun propertyDelegated(/*0*/ a: kotlin.Int): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.kt b/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.kt index a8c26f81bbb..b27625e8269 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.kt @@ -8,7 +8,7 @@ val c by d val d by c class Delegate(i: Int) { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.txt b/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.txt index d9ed6e94f25..17c698578e2 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.txt @@ -8,7 +8,7 @@ public val d: [ERROR : ] public final class Delegate { public constructor Delegate(/*0*/ i: kotlin.Int) public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/redundantGetter.kt b/compiler/testData/diagnostics/tests/delegatedProperty/redundantGetter.kt index 5daa82aabf2..fa66bcf9c75 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/redundantGetter.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/redundantGetter.kt @@ -4,7 +4,7 @@ val a: Int by Delegate() get() = 1 class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/redundantGetter.txt b/compiler/testData/diagnostics/tests/delegatedProperty/redundantGetter.txt index bb49ab03638..0b2e8cd88fc 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/redundantGetter.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/redundantGetter.txt @@ -5,7 +5,7 @@ public val a: kotlin.Int public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/redundantSetter.kt b/compiler/testData/diagnostics/tests/delegatedProperty/redundantSetter.kt index fa56b4cedcf..206c6071de1 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/redundantSetter.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/redundantSetter.kt @@ -5,9 +5,9 @@ var a: Int by Delegate() set(i) {} class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } - fun setValue(t: Any?, p: PropertyMetadata, i: Int) {} + operator fun setValue(t: Any?, p: PropertyMetadata, i: Int) {} } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/redundantSetter.txt b/compiler/testData/diagnostics/tests/delegatedProperty/redundantSetter.txt index 3cc7f53f52d..7e14010bfa5 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/redundantSetter.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/redundantSetter.txt @@ -5,8 +5,8 @@ public var a: kotlin.Int public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ i: kotlin.Int): kotlin.Unit + public final operator fun setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ i: kotlin.Int): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/setterThisTypeMismatch.kt b/compiler/testData/diagnostics/tests/delegatedProperty/setterThisTypeMismatch.kt index ac0846f8b28..38a2bf6f654 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/setterThisTypeMismatch.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/setterThisTypeMismatch.kt @@ -9,8 +9,8 @@ var cTopLevel: Int by Delegate() class A class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } - fun setValue(t: A, p: PropertyMetadata, i: Int) {} + operator fun setValue(t: A, p: PropertyMetadata, i: Int) {} } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/setterThisTypeMismatch.txt b/compiler/testData/diagnostics/tests/delegatedProperty/setterThisTypeMismatch.txt index 9cf90aed897..16806ef17af 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/setterThisTypeMismatch.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/setterThisTypeMismatch.txt @@ -20,8 +20,8 @@ public final class D { public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ t: A, /*1*/ p: kotlin.PropertyMetadata, /*2*/ i: kotlin.Int): kotlin.Unit + public final operator fun setValue(/*0*/ t: A, /*1*/ p: kotlin.PropertyMetadata, /*2*/ i: kotlin.Int): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/setterWithSupertype.kt b/compiler/testData/diagnostics/tests/delegatedProperty/setterWithSupertype.kt index 218e21fdde2..e532580d7f9 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/setterWithSupertype.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/setterWithSupertype.kt @@ -6,10 +6,10 @@ class Derived: Base() var a: Derived by A() class A { - fun getValue(t: Any?, p: PropertyMetadata): Derived { + operator fun getValue(t: Any?, p: PropertyMetadata): Derived { return Derived() } - fun setValue(t: Any?, p: PropertyMetadata, i: Base) {} + operator fun setValue(t: Any?, p: PropertyMetadata, i: Base) {} } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/setterWithSupertype.txt b/compiler/testData/diagnostics/tests/delegatedProperty/setterWithSupertype.txt index b4cba5a4479..845a96986f8 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/setterWithSupertype.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/setterWithSupertype.txt @@ -5,9 +5,9 @@ public var a: Derived public final class A { public constructor A() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): Derived + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): Derived public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ i: Base): kotlin.Unit + public final operator fun setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ i: Base): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/thisInDelegate.kt b/compiler/testData/diagnostics/tests/delegatedProperty/thisInDelegate.kt index bece51a2080..b15aeba105e 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/thisInDelegate.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/thisInDelegate.kt @@ -7,7 +7,7 @@ class A { } class Delegate(i: Int) { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/thisInDelegate.txt b/compiler/testData/diagnostics/tests/delegatedProperty/thisInDelegate.txt index 4202ab486ae..99b974b86d8 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/thisInDelegate.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/thisInDelegate.txt @@ -13,7 +13,7 @@ public final class A { public final class Delegate { public constructor Delegate(/*0*/ i: kotlin.Int) public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/thisOfAnyType.kt b/compiler/testData/diagnostics/tests/delegatedProperty/thisOfAnyType.kt index 88a219f4878..a1f7f74fbd2 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/thisOfAnyType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/thisOfAnyType.kt @@ -7,8 +7,8 @@ class A { var aTopLevel: Int by Delegate() class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } - fun setValue(t: Any?, p: PropertyMetadata, a: Int) {} + operator fun setValue(t: Any?, p: PropertyMetadata, a: Int) {} } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/thisOfAnyType.txt b/compiler/testData/diagnostics/tests/delegatedProperty/thisOfAnyType.txt index 0f086cb5730..ea713274474 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/thisOfAnyType.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/thisOfAnyType.txt @@ -13,8 +13,8 @@ public final class A { public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ a: kotlin.Int): kotlin.Unit + public final operator fun setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ a: kotlin.Int): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/thisOfNothingNullableType.kt b/compiler/testData/diagnostics/tests/delegatedProperty/thisOfNothingNullableType.kt index 6410bbd30b9..2c1d38a1f10 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/thisOfNothingNullableType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/thisOfNothingNullableType.kt @@ -5,11 +5,11 @@ class A { var aTopLevel: Int by Delegate() class Delegate { - fun getValue(t: Nothing?, p: PropertyMetadata): Int { + operator fun getValue(t: Nothing?, p: PropertyMetadata): Int { p.equals(null) // to avoid UNUSED_PARAMETER warning return 1 } - fun setValue(t: Nothing?, p: PropertyMetadata, a: Int) { + operator fun setValue(t: Nothing?, p: PropertyMetadata, a: Int) { p.equals(a) // to avoid UNUSED_PARAMETER warning } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/thisOfNothingNullableType.txt b/compiler/testData/diagnostics/tests/delegatedProperty/thisOfNothingNullableType.txt index f10559a92b8..5f20d0cbb9b 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/thisOfNothingNullableType.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/thisOfNothingNullableType.txt @@ -13,8 +13,8 @@ public final class A { public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Nothing?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Nothing?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ t: kotlin.Nothing?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ a: kotlin.Int): kotlin.Unit + public final operator fun setValue(/*0*/ t: kotlin.Nothing?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ a: kotlin.Int): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetReturnType.kt b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetReturnType.kt index b3ff2e71f1a..83e911f1441 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetReturnType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetReturnType.kt @@ -3,7 +3,7 @@ val c: Int by Delegate() class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): String { + operator fun getValue(t: Any?, p: PropertyMetadata): String { return "" } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetReturnType.txt b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetReturnType.txt index bf9b9c0012a..1d9bc641260 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetReturnType.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetReturnType.txt @@ -5,7 +5,7 @@ public val c: kotlin.Int public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.String public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetWithGeneric.kt b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetWithGeneric.kt index 25081c8bef2..a62cfe3c78a 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetWithGeneric.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetWithGeneric.kt @@ -14,7 +14,7 @@ class C { val cTopLevel: Int by Delegate() class Delegate { - fun getValue(t: T, p: PropertyMetadata): Int { + operator fun getValue(t: T, p: PropertyMetadata): Int { return 1 } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetWithGeneric.txt b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetWithGeneric.txt index 6c4958c6087..281ccfaeb65 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetWithGeneric.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetWithGeneric.txt @@ -29,7 +29,7 @@ public final class C { public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: T, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: T, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForSetParameter.kt b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForSetParameter.kt index a9a4084edab..8b2da124d6b 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForSetParameter.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForSetParameter.kt @@ -7,8 +7,8 @@ class A { var aTopLevel: Int by Delegate() class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } - fun setValue(t: Any?, p: PropertyMetadata, i: String) {} + operator fun setValue(t: Any?, p: PropertyMetadata, i: String) {} } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForSetParameter.txt b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForSetParameter.txt index 96042f83bc6..66edecf0af6 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForSetParameter.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForSetParameter.txt @@ -13,8 +13,8 @@ public final class A { public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ i: kotlin.String): kotlin.Unit + public final operator fun setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ i: kotlin.String): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInSet.kt b/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInSet.kt index e99e2d43614..5dce405e074 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInSet.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInSet.kt @@ -7,9 +7,9 @@ class A { var aTopLevel: Int by Delegate() class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } - fun setValue(t: Any?, p: PropertyMetadata, a: Int, c: Int) {} + operator fun setValue(t: Any?, p: PropertyMetadata, a: Int, c: Int) {} } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInSet.txt b/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInSet.txt index af7519912ba..b154ac4e879 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInSet.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInSet.txt @@ -13,8 +13,8 @@ public final class A { public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ a: kotlin.Int, /*3*/ c: kotlin.Int): kotlin.Unit + public final operator fun setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ a: kotlin.Int, /*3*/ c: kotlin.Int): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/wrongSetterReturnType.kt b/compiler/testData/diagnostics/tests/delegatedProperty/wrongSetterReturnType.kt index 2a28c219069..ade67841bd2 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/wrongSetterReturnType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/wrongSetterReturnType.kt @@ -3,11 +3,11 @@ var b: Int by Delegate() class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: PropertyMetadata): Int { return 1 } - fun setValue(t: Any?, p: PropertyMetadata, i: Int): Int { + operator fun setValue(t: Any?, p: PropertyMetadata, i: Int): Int { return i } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/wrongSetterReturnType.txt b/compiler/testData/diagnostics/tests/delegatedProperty/wrongSetterReturnType.txt index fad4e0e4c74..3a7a1b48845 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/wrongSetterReturnType.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/wrongSetterReturnType.txt @@ -5,8 +5,8 @@ public var b: kotlin.Int public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ i: kotlin.Int): kotlin.Int + public final operator fun setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata, /*2*/ i: kotlin.Int): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/deprecated/functionUsage.kt b/compiler/testData/diagnostics/tests/deprecated/functionUsage.kt index 4c327ea7f50..b908ce6d7fd 100644 --- a/compiler/testData/diagnostics/tests/deprecated/functionUsage.kt +++ b/compiler/testData/diagnostics/tests/deprecated/functionUsage.kt @@ -1,8 +1,8 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION class UsefulClass(val param: Int = 2) { - fun getValue(instance: Any, property: PropertyMetadata) : Int = 1 - fun setValue(instance: Any, property: PropertyMetadata, value: Int) {} + operator fun getValue(instance: Any, property: PropertyMetadata) : Int = 1 + operator fun setValue(instance: Any, property: PropertyMetadata, value: Int) {} @Deprecated("message") fun member() {} diff --git a/compiler/testData/diagnostics/tests/deprecated/functionUsage.txt b/compiler/testData/diagnostics/tests/deprecated/functionUsage.txt index 686c86b55bc..8f339bdd1f7 100644 --- a/compiler/testData/diagnostics/tests/deprecated/functionUsage.txt +++ b/compiler/testData/diagnostics/tests/deprecated/functionUsage.txt @@ -45,9 +45,9 @@ public final class UsefulClass { public constructor UsefulClass(/*0*/ param: kotlin.Int = ...) public final val param: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ instance: kotlin.Any, /*1*/ property: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ instance: kotlin.Any, /*1*/ property: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int @kotlin.Deprecated(message = "message") public final fun member(): kotlin.Unit - public final fun setValue(/*0*/ instance: kotlin.Any, /*1*/ property: kotlin.PropertyMetadata, /*2*/ value: kotlin.Int): kotlin.Unit + public final operator fun setValue(/*0*/ instance: kotlin.Any, /*1*/ property: kotlin.PropertyMetadata, /*2*/ value: kotlin.Int): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/deprecated/propertyUsage.kt b/compiler/testData/diagnostics/tests/deprecated/propertyUsage.kt index e5585d8a22b..e557c38800c 100644 --- a/compiler/testData/diagnostics/tests/deprecated/propertyUsage.kt +++ b/compiler/testData/diagnostics/tests/deprecated/propertyUsage.kt @@ -2,10 +2,10 @@ class Delegate() { @Deprecated("text") - fun getValue(instance: Any, property: PropertyMetadata) : Int = 1 + operator fun getValue(instance: Any, property: PropertyMetadata) : Int = 1 @Deprecated("text") - fun setValue(instance: Any, property: PropertyMetadata, value: Int) {} + operator fun setValue(instance: Any, property: PropertyMetadata, value: Int) {} } class PropertyHolder { diff --git a/compiler/testData/diagnostics/tests/deprecated/propertyUsage.txt b/compiler/testData/diagnostics/tests/deprecated/propertyUsage.txt index eb62b2a76f1..ff641a063d4 100644 --- a/compiler/testData/diagnostics/tests/deprecated/propertyUsage.txt +++ b/compiler/testData/diagnostics/tests/deprecated/propertyUsage.txt @@ -7,9 +7,9 @@ public fun PropertyHolder.extFunction(): kotlin.Unit public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - @kotlin.Deprecated(message = "text") public final fun getValue(/*0*/ instance: kotlin.Any, /*1*/ property: kotlin.PropertyMetadata): kotlin.Int + @kotlin.Deprecated(message = "text") public final operator fun getValue(/*0*/ instance: kotlin.Any, /*1*/ property: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - @kotlin.Deprecated(message = "text") public final fun setValue(/*0*/ instance: kotlin.Any, /*1*/ property: kotlin.PropertyMetadata, /*2*/ value: kotlin.Int): kotlin.Unit + @kotlin.Deprecated(message = "text") public final operator fun setValue(/*0*/ instance: kotlin.Any, /*1*/ property: kotlin.PropertyMetadata, /*2*/ value: kotlin.Int): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/duplicateJvmSignature/specialNames/propertyMetadataCache.kt b/compiler/testData/diagnostics/tests/duplicateJvmSignature/specialNames/propertyMetadataCache.kt index 3c59d79c286..e6f1b8d6405 100644 --- a/compiler/testData/diagnostics/tests/duplicateJvmSignature/specialNames/propertyMetadataCache.kt +++ b/compiler/testData/diagnostics/tests/duplicateJvmSignature/specialNames/propertyMetadataCache.kt @@ -1,6 +1,6 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -fun Any.getValue(x: Any?, y: Any): Any = null!! +operator fun Any.getValue(x: Any?, y: Any): Any = null!! class C { val x by 1 diff --git a/compiler/testData/diagnostics/tests/duplicateJvmSignature/specialNames/propertyMetadataCache.txt b/compiler/testData/diagnostics/tests/duplicateJvmSignature/specialNames/propertyMetadataCache.txt index f5c5672e87b..f8986426e5e 100644 --- a/compiler/testData/diagnostics/tests/duplicateJvmSignature/specialNames/propertyMetadataCache.txt +++ b/compiler/testData/diagnostics/tests/duplicateJvmSignature/specialNames/propertyMetadataCache.txt @@ -2,7 +2,7 @@ package public val `$propertyMetadata`: kotlin.Array public val x: kotlin.Any -public fun kotlin.Any.getValue(/*0*/ x: kotlin.Any?, /*1*/ y: kotlin.Any): kotlin.Any +public operator fun kotlin.Any.getValue(/*0*/ x: kotlin.Any?, /*1*/ y: kotlin.Any): kotlin.Any public final class C { public constructor C() diff --git a/compiler/testData/diagnostics/tests/inference/substitutions/delegationAndInference.kt b/compiler/testData/diagnostics/tests/inference/substitutions/delegationAndInference.kt index abb18baea76..67d32c6df95 100644 --- a/compiler/testData/diagnostics/tests/inference/substitutions/delegationAndInference.kt +++ b/compiler/testData/diagnostics/tests/inference/substitutions/delegationAndInference.kt @@ -5,8 +5,8 @@ class A(val map: MutableMap) { var a: String by map.withDefault1 { "foo" } } -fun MutableMap.getValue(thisRef: Any?, property: PropertyMetadata): G = throw Exception() +operator fun MutableMap.getValue(thisRef: Any?, property: PropertyMetadata): G = throw Exception() -fun MutableMap.setValue(thisRef: Any?, property: PropertyMetadata, value: S) {} +operator fun MutableMap.setValue(thisRef: Any?, property: PropertyMetadata, value: S) {} fun MutableMap.withDefault1(default: (key: K) -> V): MutableMap = this \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/substitutions/delegationAndInference.txt b/compiler/testData/diagnostics/tests/inference/substitutions/delegationAndInference.txt index c96337fbeda..a8e4def0cf7 100644 --- a/compiler/testData/diagnostics/tests/inference/substitutions/delegationAndInference.txt +++ b/compiler/testData/diagnostics/tests/inference/substitutions/delegationAndInference.txt @@ -1,7 +1,7 @@ package -public fun kotlin.MutableMap.getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ property: kotlin.PropertyMetadata): G -public fun kotlin.MutableMap.setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ property: kotlin.PropertyMetadata, /*2*/ value: S): kotlin.Unit +public operator fun kotlin.MutableMap.getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ property: kotlin.PropertyMetadata): G +public operator fun kotlin.MutableMap.setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ property: kotlin.PropertyMetadata, /*2*/ value: S): kotlin.Unit public fun kotlin.MutableMap.withDefault1(/*0*/ default: (K) -> V): kotlin.MutableMap public final class A { diff --git a/compiler/testData/diagnostics/tests/modifiers/const/applicability.kt b/compiler/testData/diagnostics/tests/modifiers/const/applicability.kt index 3eb9dd3bfb3..06a2aa9c025 100644 --- a/compiler/testData/diagnostics/tests/modifiers/const/applicability.kt +++ b/compiler/testData/diagnostics/tests/modifiers/const/applicability.kt @@ -69,7 +69,7 @@ const val nonConstInitializer = foo() // ------------------ class Delegate { - fun getValue(thisRef: Any?, prop: PropertyMetadata): Int = 1 + operator fun getValue(thisRef: Any?, prop: PropertyMetadata): Int = 1 - fun setValue(thisRef: Any?, prop: PropertyMetadata, value: Int) = Unit + operator fun setValue(thisRef: Any?, prop: PropertyMetadata, value: Int) = Unit } diff --git a/compiler/testData/diagnostics/tests/modifiers/const/applicability.txt b/compiler/testData/diagnostics/tests/modifiers/const/applicability.txt index 7bfe6236a5e..8bf7872eff3 100644 --- a/compiler/testData/diagnostics/tests/modifiers/const/applicability.txt +++ b/compiler/testData/diagnostics/tests/modifiers/const/applicability.txt @@ -58,9 +58,9 @@ public object D : C { public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ value: kotlin.Int): kotlin.Unit + public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ value: kotlin.Int): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/delegatedProperties.txt b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/delegatedProperties.txt index 99a0f92048b..0642bd71d9b 100644 --- a/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/delegatedProperties.txt +++ b/compiler/testData/diagnostics/tests/platformTypes/nullabilityWarnings/delegatedProperties.txt @@ -12,9 +12,9 @@ public open class J { public interface DP { public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public abstract fun getValue(/*0*/ a: kotlin.Any!, /*1*/ b: kotlin.Any!): kotlin.String! + public abstract operator fun getValue(/*0*/ a: kotlin.Any!, /*1*/ b: kotlin.Any!): kotlin.String! public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public abstract fun setValue(/*0*/ a: kotlin.Any!, /*1*/ b: kotlin.Any!, /*2*/ c: kotlin.Any!): kotlin.String! + public abstract operator fun setValue(/*0*/ a: kotlin.Any!, /*1*/ b: kotlin.Any!, /*2*/ c: kotlin.Any!): kotlin.String! public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/smartCasts/publicVals/delegate.kt b/compiler/testData/diagnostics/tests/smartCasts/publicVals/delegate.kt index 37d4717d985..2c584fe9a9a 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/publicVals/delegate.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/publicVals/delegate.kt @@ -1,5 +1,5 @@ class Delegate { - fun getValue(thisRef: Any?, prop: PropertyMetadata): String? { + operator fun getValue(thisRef: Any?, prop: PropertyMetadata): String? { return null } } diff --git a/compiler/testData/diagnostics/tests/smartCasts/publicVals/delegate.txt b/compiler/testData/diagnostics/tests/smartCasts/publicVals/delegate.txt index a945a502e91..5de5fd68e23 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/publicVals/delegate.txt +++ b/compiler/testData/diagnostics/tests/smartCasts/publicVals/delegate.txt @@ -3,7 +3,7 @@ package public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String? + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String? public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/variance/ValProperty.kt b/compiler/testData/diagnostics/tests/variance/ValProperty.kt index 47b709decc2..a37feea87d6 100644 --- a/compiler/testData/diagnostics/tests/variance/ValProperty.kt +++ b/compiler/testData/diagnostics/tests/variance/ValProperty.kt @@ -3,8 +3,8 @@ interface Out interface Inv class Delegate { - fun getValue(t: Any, p: PropertyMetadata): T = null!! - fun setValue(t: Any, p: PropertyMetadata, value: T) {} + operator fun getValue(t: Any, p: PropertyMetadata): T = null!! + operator fun setValue(t: Any, p: PropertyMetadata, value: T) {} } fun getT(): T = null!! diff --git a/compiler/testData/diagnostics/tests/variance/ValProperty.txt b/compiler/testData/diagnostics/tests/variance/ValProperty.txt index 45acacc315b..d09b0f35031 100644 --- a/compiler/testData/diagnostics/tests/variance/ValProperty.txt +++ b/compiler/testData/diagnostics/tests/variance/ValProperty.txt @@ -5,9 +5,9 @@ public fun getT(): T public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any, /*1*/ p: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ t: kotlin.Any, /*1*/ p: kotlin.PropertyMetadata): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ t: kotlin.Any, /*1*/ p: kotlin.PropertyMetadata, /*2*/ value: T): kotlin.Unit + public final operator fun setValue(/*0*/ t: kotlin.Any, /*1*/ p: kotlin.PropertyMetadata, /*2*/ value: T): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/variance/VarProperty.kt b/compiler/testData/diagnostics/tests/variance/VarProperty.kt index 07e28f3bf6c..4465e2c66eb 100644 --- a/compiler/testData/diagnostics/tests/variance/VarProperty.kt +++ b/compiler/testData/diagnostics/tests/variance/VarProperty.kt @@ -3,8 +3,8 @@ interface Out interface Inv class Delegate { - fun getValue(t: Any, p: PropertyMetadata): T = null!! - fun setValue(t: Any, p: PropertyMetadata, varue: T) {} + operator fun getValue(t: Any, p: PropertyMetadata): T = null!! + operator fun setValue(t: Any, p: PropertyMetadata, varue: T) {} } fun getT(): T = null!! diff --git a/compiler/testData/diagnostics/tests/variance/VarProperty.txt b/compiler/testData/diagnostics/tests/variance/VarProperty.txt index bdba5839367..62bb1ba4d1e 100644 --- a/compiler/testData/diagnostics/tests/variance/VarProperty.txt +++ b/compiler/testData/diagnostics/tests/variance/VarProperty.txt @@ -5,9 +5,9 @@ public fun getT(): T public final class Delegate { public constructor Delegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun getValue(/*0*/ t: kotlin.Any, /*1*/ p: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ t: kotlin.Any, /*1*/ p: kotlin.PropertyMetadata): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun setValue(/*0*/ t: kotlin.Any, /*1*/ p: kotlin.PropertyMetadata, /*2*/ varue: T): kotlin.Unit + public final operator fun setValue(/*0*/ t: kotlin.Any, /*1*/ p: kotlin.PropertyMetadata, /*2*/ varue: T): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/testsWithStdLib/duplicateJvmSignature/delegatedProperty.kt b/compiler/testData/diagnostics/testsWithStdLib/duplicateJvmSignature/delegatedProperty.kt index 2af8869417b..e8d30ddef8e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/duplicateJvmSignature/delegatedProperty.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/duplicateJvmSignature/delegatedProperty.kt @@ -3,5 +3,5 @@ import kotlin.properties.Delegates class C { val `x$delegate`: ReadWriteProperty? = null - val x: String? by Delegates.notNull() + val x: String? by Delegates.notNull() } \ No newline at end of file diff --git a/idea/testData/checker/infos/CapturedConstructorParameter.kt b/idea/testData/checker/infos/CapturedConstructorParameter.kt index 0b7d3a65051..48adc111ba5 100644 --- a/idea/testData/checker/infos/CapturedConstructorParameter.kt +++ b/idea/testData/checker/infos/CapturedConstructorParameter.kt @@ -5,7 +5,7 @@ class T1(t: Int): T class Delegate(d: Int) { - fun getValue(k: Any, m: PropertyMetadata) {} + operator fun getValue(k: Any, m: PropertyMetadata) {} } class A(y: Int, t: Int, d: Int): T by T1(t) {