diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.java index 2673bdb5664..ad473a0a1dd 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DelegatedPropertyResolver.java @@ -127,15 +127,8 @@ public class DelegatedPropertyResolver { } @NotNull - private JetExpression createExpressionForPropertyMetadata( - @NotNull JetPsiFactory psiFactory, - @NotNull PropertyDescriptor propertyDescriptor - ) { - return psiFactory.createExpression(builtIns.getPropertyMetadataImpl().getName().asString() + - "(\"" + - propertyDescriptor.getName().asString() + - "\") as " + - builtIns.getPropertyMetadata().getName().asString()); + private static JetExpression createExpressionForProperty(@NotNull JetPsiFactory psiFactory) { + return psiFactory.createExpression("null as kotlin.reflect.KProperty<*>"); } public void resolveDelegatedPropertyPDMethod( @@ -151,7 +144,7 @@ public class DelegatedPropertyResolver { DataFlowInfo.EMPTY, TypeUtils.NO_EXPECTED_TYPE); JetPsiFactory psiFactory = JetPsiFactory(delegateExpression); - List arguments = Collections.singletonList(createExpressionForPropertyMetadata(psiFactory, propertyDescriptor)); + List arguments = Collections.singletonList(createExpressionForProperty(psiFactory)); ExpressionReceiver receiver = new ExpressionReceiver(delegateExpression, delegateType); Pair> resolutionResult = @@ -257,7 +250,7 @@ public class DelegatedPropertyResolver { List arguments = Lists.newArrayList(); JetPsiFactory psiFactory = JetPsiFactory(delegateExpression); arguments.add(psiFactory.createExpression(hasThis ? "this" : "null")); - arguments.add(createExpressionForPropertyMetadata(psiFactory, propertyDescriptor)); + arguments.add(createExpressionForProperty(psiFactory)); if (!isGet) { JetReferenceExpression fakeArgument = (JetReferenceExpression) createFakeExpressionOfType(delegateExpression.getProject(), trace, diff --git a/compiler/testData/builtin-classes.txt b/compiler/testData/builtin-classes.txt index e7d8f09bfef..f239393f8e7 100644 --- a/compiler/testData/builtin-classes.txt +++ b/compiler/testData/builtin-classes.txt @@ -1080,19 +1080,11 @@ public interface Progression : kotlin.Iterable { public abstract override /*1*/ /*fake_override*/ fun iterator(): kotlin.Iterator } -public interface PropertyMetadata { +@kotlin.Deprecated(message = "Please use KProperty instead.", replaceWith = kotlin.ReplaceWith(expression = "KProperty<*>", imports = {"kotlin.reflect.KProperty"})) public interface PropertyMetadata { public abstract val name: kotlin.String public abstract fun (): kotlin.String } -@kotlin.data() public final class PropertyMetadataImpl : kotlin.PropertyMetadata { - /*primary*/ public constructor PropertyMetadataImpl(/*0*/ name: kotlin.String) - public open override /*1*/ val name: kotlin.String - public open override /*1*/ fun (): kotlin.String - public final operator /*synthesized*/ fun component1(): kotlin.String - public final /*synthesized*/ fun copy(/*0*/ name: kotlin.String = ...): kotlin.PropertyMetadataImpl -} - public interface Range> { public abstract val end: T public abstract fun (): T diff --git a/compiler/testData/diagnostics/tests/DeprecatedGetSetPropertyDelegateConvention.kt b/compiler/testData/diagnostics/tests/DeprecatedGetSetPropertyDelegateConvention.kt index ba702214fd7..450bba24e38 100644 --- a/compiler/testData/diagnostics/tests/DeprecatedGetSetPropertyDelegateConvention.kt +++ b/compiler/testData/diagnostics/tests/DeprecatedGetSetPropertyDelegateConvention.kt @@ -1,33 +1,35 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + class CustomDelegate { - operator fun get(thisRef: Any?, prop: PropertyMetadata): String = prop.name - operator fun set(thisRef: Any?, prop: PropertyMetadata, value: String) {} + operator fun get(thisRef: Any?, prop: KProperty<*>): String = prop.name + operator fun set(thisRef: Any?, prop: KProperty<*>, value: String) {} } class OkDelegate { - operator fun getValue(thisRef: Any?, prop: PropertyMetadata): String = prop.name - operator fun setValue(thisRef: Any?, prop: PropertyMetadata, value: String) {} + operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = prop.name + operator fun setValue(thisRef: Any?, prop: KProperty<*>, value: String) {} } class CustomDelegate2 { - operator fun get(thisRef: Any?, prop: PropertyMetadata): String = prop.name - operator fun set(thisRef: Any?, prop: PropertyMetadata, value: String) {} + operator fun get(thisRef: Any?, prop: KProperty<*>): String = prop.name + operator fun set(thisRef: Any?, prop: KProperty<*>, value: String) {} - operator fun getValue(thisRef: Any?, prop: PropertyMetadata): Int = 5 - operator fun setValue(thisRef: Any?, prop: PropertyMetadata, value: Int) {} + operator fun getValue(thisRef: Any?, prop: KProperty<*>): Int = 5 + operator fun setValue(thisRef: Any?, prop: KProperty<*>, value: Int) {} } class CustomDelegate3 { - operator fun get(thisRef: Any?, prop: PropertyMetadata): String = prop.name - operator fun set(thisRef: Any?, prop: PropertyMetadata, value: String) {} + operator fun get(thisRef: Any?, prop: KProperty<*>): String = prop.name + operator fun set(thisRef: Any?, prop: KProperty<*>, value: String) {} } -operator fun OkDelegate.get(thisRef: Any?, prop: PropertyMetadata): Int = 4 -operator 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) {} -operator fun CustomDelegate3.getValue(thisRef: Any?, prop: PropertyMetadata): Int = 4 -operator 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 { @@ -48,4 +50,4 @@ class Example { fun requireString(s: String) {} fun requireInt(n: Int) {} -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/DeprecatedGetSetPropertyDelegateConvention.txt b/compiler/testData/diagnostics/tests/DeprecatedGetSetPropertyDelegateConvention.txt index 9f7c92dcb7b..f63e4eeef54 100644 --- a/compiler/testData/diagnostics/tests/DeprecatedGetSetPropertyDelegateConvention.txt +++ b/compiler/testData/diagnostics/tests/DeprecatedGetSetPropertyDelegateConvention.txt @@ -8,29 +8,29 @@ public operator fun CustomDelegate3.setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ p public final class CustomDelegate { public constructor CustomDelegate() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final operator fun get(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String + public final operator fun get(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.reflect.KProperty<*>): kotlin.String public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*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 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 final operator fun get(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.reflect.KProperty<*>): kotlin.String + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.reflect.KProperty<*>): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - 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 final operator fun set(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.reflect.KProperty<*>, /*2*/ value: kotlin.String): kotlin.Unit + public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.reflect.KProperty<*>, /*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 operator fun get(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String + public final operator fun get(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.reflect.KProperty<*>): kotlin.String public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*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 operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.reflect.KProperty<*>): kotlin.String public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*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 fd6ea57f61c..83d33ebe9d3 100644 --- a/compiler/testData/diagnostics/tests/LateInit.kt +++ b/compiler/testData/diagnostics/tests/LateInit.kt @@ -1,5 +1,7 @@ +import kotlin.reflect.KProperty + class CustomDelegate { - operator fun getValue(thisRef: Any?, prop: PropertyMetadata): String = prop.name + operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = prop.name } public abstract class A(lateinit var p2: String) { @@ -62,4 +64,4 @@ public class B { init { a.length } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/LateInit.txt b/compiler/testData/diagnostics/tests/LateInit.txt index e2dd8e1e56a..8cad99618a4 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 operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.reflect.KProperty<*>): 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/OperatorChecks.kt b/compiler/testData/diagnostics/tests/OperatorChecks.kt index 93c5e903b88..302dc888ef6 100644 --- a/compiler/testData/diagnostics/tests/OperatorChecks.kt +++ b/compiler/testData/diagnostics/tests/OperatorChecks.kt @@ -1,3 +1,5 @@ +import kotlin.reflect.KProperty + interface Example { operator fun plus(o: Example): Example operator fun div(o: Example): Example @@ -59,8 +61,8 @@ interface Example { } class OkDelegates { - operator fun getValue(thisRef: Any?, prop: PropertyMetadata): String = "" - operator fun setValue(thisRef: Any?, prop: PropertyMetadata, s: String): String = "" + operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = "" + operator fun setValue(thisRef: Any?, prop: KProperty<*>, s: String): String = "" operator fun setValue(thisRef: Any?, prop: Any, n: Int) {} operator fun setValue(thisRef: Any?, prop: Any?, s: String) {} } @@ -69,11 +71,11 @@ class DelegatesWithErrors { operator fun getValue(thisRef: Any?, prop: String): String = "" operator fun setValue(thisRef: Any?, prop: String, value: String) {} - operator fun setValue(thisRef: Any?, prop: PropertyMetadata, vararg n: Int) {} - operator fun setValue(thisRef: Any?, prop: PropertyMetadata, f: Float = 0.0f) {} + operator fun setValue(thisRef: Any?, prop: KProperty<*>, vararg n: Int) {} + operator fun setValue(thisRef: Any?, prop: KProperty<*>, f: Float = 0.0f) {} - operator fun getValue(prop: PropertyMetadata): String = "" - operator fun setValue(prop: PropertyMetadata, value: String) {} + operator fun getValue(prop: KProperty<*>): String = "" + operator fun setValue(prop: KProperty<*>, value: String) {} } interface Example2 { @@ -208,4 +210,4 @@ infix fun Example.i1(n: Int) {} infix fun i1(n: Int) {} infix fun i1(n: Int, n2: Int) {} -infix fun i1(vararg n: Int) {} \ No newline at end of file +infix fun i1(vararg n: Int) {} diff --git a/compiler/testData/diagnostics/tests/OperatorChecks.txt b/compiler/testData/diagnostics/tests/OperatorChecks.txt index 47c2ba80ace..eef03063dda 100644 --- a/compiler/testData/diagnostics/tests/OperatorChecks.txt +++ b/compiler/testData/diagnostics/tests/OperatorChecks.txt @@ -85,12 +85,12 @@ public final class DelegatesWithErrors { public constructor DelegatesWithErrors() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.String): kotlin.String - public final operator fun getValue(/*0*/ prop: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ prop: kotlin.reflect.KProperty<*>): kotlin.String public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ f: kotlin.Float = ...): kotlin.Unit - public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ vararg n: kotlin.Int /*kotlin.IntArray*/): kotlin.Unit public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.String, /*2*/ value: kotlin.String): kotlin.Unit - public final operator fun setValue(/*0*/ prop: kotlin.PropertyMetadata, /*1*/ value: kotlin.String): kotlin.Unit + public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.reflect.KProperty<*>, /*2*/ f: kotlin.Float = ...): kotlin.Unit + public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.reflect.KProperty<*>, /*2*/ vararg n: kotlin.Int /*kotlin.IntArray*/): kotlin.Unit + public final operator fun setValue(/*0*/ prop: kotlin.reflect.KProperty<*>, /*1*/ value: kotlin.String): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } @@ -162,10 +162,10 @@ public interface Example3 { public final class OkDelegates { public constructor OkDelegates() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.reflect.KProperty<*>): kotlin.String public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.Any, /*2*/ n: kotlin.Int): kotlin.Unit public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.Any?, /*2*/ s: kotlin.String): kotlin.Unit - public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ s: kotlin.String): kotlin.String + public final operator fun setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.reflect.KProperty<*>, /*2*/ s: kotlin.String): kotlin.String public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/UnusedParameters.kt b/compiler/testData/diagnostics/tests/UnusedParameters.kt index b031f2b2fdd..5b9727d53a6 100644 --- a/compiler/testData/diagnostics/tests/UnusedParameters.kt +++ b/compiler/testData/diagnostics/tests/UnusedParameters.kt @@ -1,3 +1,5 @@ +import kotlin.reflect.KProperty + class C(a: Int, b: Int, c: Int, d: Int, e: Int = d, val f: String) { init { a + a @@ -14,11 +16,11 @@ fun f(a: Int, b: Int, c: Int = b) { a + a } -fun Any.getValue(thisRef: Any?, prop: PropertyMetadata): String = ":)" -fun Any.setValue(thisRef: Any?, prop: PropertyMetadata, value: String) { +fun Any.getValue(thisRef: Any?, prop: KProperty<*>): String = ":)" +fun Any.setValue(thisRef: Any?, prop: KProperty<*>, value: String) { } -fun Any.propertyDelegated(prop: PropertyMetadata) { +fun Any.propertyDelegated(prop: KProperty<*>) { } fun get(p: Any) { diff --git a/compiler/testData/diagnostics/tests/UnusedParameters.txt b/compiler/testData/diagnostics/tests/UnusedParameters.txt index 6df8d42e7f4..d5df7703753 100644 --- a/compiler/testData/diagnostics/tests/UnusedParameters.txt +++ b/compiler/testData/diagnostics/tests/UnusedParameters.txt @@ -4,9 +4,9 @@ public fun f(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int, /*2*/ c: kotlin.Int = ... public fun foo(/*0*/ s: kotlin.String): kotlin.Unit public fun get(/*0*/ p: kotlin.Any): kotlin.Unit public fun set(/*0*/ p: kotlin.Any): kotlin.Unit -public fun kotlin.Any.getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String -public fun kotlin.Any.propertyDelegated(/*0*/ prop: kotlin.PropertyMetadata): kotlin.Unit -public fun kotlin.Any.setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata, /*2*/ value: kotlin.String): kotlin.Unit +public fun kotlin.Any.getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.reflect.KProperty<*>): kotlin.String +public fun kotlin.Any.propertyDelegated(/*0*/ prop: kotlin.reflect.KProperty<*>): kotlin.Unit +public fun kotlin.Any.setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.reflect.KProperty<*>, /*2*/ value: kotlin.String): kotlin.Unit public final class C { public constructor C(/*0*/ a: kotlin.Int, /*1*/ b: kotlin.Int, /*2*/ c: kotlin.Int, /*3*/ d: kotlin.Int, /*4*/ e: kotlin.Int = ..., /*5*/ f: kotlin.String) diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/FieldAnnotations.kt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/FieldAnnotations.kt index 8261ba7d41b..b7603798135 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/FieldAnnotations.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/FieldAnnotations.kt @@ -1,7 +1,9 @@ +import kotlin.reflect.KProperty + annotation class Ann class CustomDelegate { - operator fun getValue(thisRef: Any?, prop: PropertyMetadata): String = prop.name + operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = prop.name } @field:Ann @@ -31,4 +33,4 @@ class SomeClass { } -class WithPrimaryConstructor(@field:Ann val a: String) \ No newline at end of file +class WithPrimaryConstructor(@field:Ann val a: String) diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/FieldAnnotations.txt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/FieldAnnotations.txt index 11b3e681c2e..deade42cfcd 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 operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.reflect.KProperty<*>): 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 07c300c3191..d1147446d0b 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/GetterAnnotations.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/GetterAnnotations.kt @@ -1,7 +1,9 @@ +import kotlin.reflect.KProperty + annotation class Ann class CustomDelegate { - operator fun getValue(thisRef: Any?, prop: PropertyMetadata): String = prop.name + operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = prop.name } @get:Ann @@ -34,4 +36,4 @@ class SomeClass { val localVariable = 5 } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/GetterAnnotations.txt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/GetterAnnotations.txt index e6080a542cc..0802bdf9d2f 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 operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.reflect.KProperty<*>): 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 0ac9ec93b63..03f7d2a6fc7 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/PropertyAnnotations.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/PropertyAnnotations.kt @@ -1,8 +1,10 @@ +import kotlin.reflect.KProperty + annotation class Ann annotation class Second class CustomDelegate { - operator fun getValue(thisRef: Any?, prop: PropertyMetadata): String = prop.name + operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = prop.name } @property:Ann @@ -34,4 +36,4 @@ class SomeClass { val localVariable = 5 } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/PropertyAnnotations.txt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/PropertyAnnotations.txt index 1a7e95f54f3..802e3f3e660 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 operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.reflect.KProperty<*>): 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 c5bf20d728e..b790975c89c 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SetterAnnotations.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SetterAnnotations.kt @@ -1,8 +1,10 @@ +import kotlin.reflect.KProperty + annotation class Ann class CustomDelegate { - operator fun getValue(thisRef: Any?, prop: PropertyMetadata): String = prop.name - operator fun setValue(thisRef: Any?, prop: PropertyMetadata, value: String) {} + operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = prop.name + operator fun setValue(thisRef: Any?, prop: KProperty<*>, value: String) {} } @set:Ann @@ -33,4 +35,4 @@ class SomeClass { val localVariable = 5 } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SetterAnnotations.txt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SetterAnnotations.txt index 5e9da10d46c..b6419f615cf 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 operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.reflect.KProperty<*>): kotlin.String public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*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 361071d22be..85940c22b81 100644 --- a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SparamAnnotations.kt +++ b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SparamAnnotations.kt @@ -1,8 +1,10 @@ +import kotlin.reflect.KProperty + annotation class Ann class CustomDelegate { - operator fun getValue(thisRef: Any?, prop: PropertyMetadata): String = prop.name - operator fun setValue(thisRef: Any?, prop: PropertyMetadata, value: String) {} + operator fun getValue(thisRef: Any?, prop: KProperty<*>): String = prop.name + operator fun setValue(thisRef: Any?, prop: KProperty<*>, value: String) {} } @setparam:Ann @@ -34,4 +36,4 @@ class SomeClass { val localVariable = 5 } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SparamAnnotations.txt b/compiler/testData/diagnostics/tests/annotations/withUseSiteTarget/SparamAnnotations.txt index 97c967403fd..bbba899ce5d 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 operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.reflect.KProperty<*>): kotlin.String public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*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 4ad30ac19ff..35508bf8b3e 100644 --- a/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassDelegatedProperties.kt +++ b/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassDelegatedProperties.kt @@ -1,5 +1,7 @@ +import kotlin.reflect.KProperty + class Del { - operator fun getValue(_this: Any?, p: PropertyMetadata): Int = 0 + operator fun getValue(_this: Any?, p: KProperty<*>): Int = 0 } fun df(del: Del): Del = del @@ -13,4 +15,3 @@ fun test(del: Any?) { val delegatedVal1: Int by df(del) } } - diff --git a/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassDelegatedProperties.txt b/compiler/testData/diagnostics/tests/dataFlow/local/LocalClassDelegatedProperties.txt index 039e04b0714..379dafd265e 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 operator fun getValue(/*0*/ _this: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ _this: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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 3381fdbaa4e..293bb83f024 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/absentErrorAboutInitializer.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/absentErrorAboutInitializer.kt @@ -1,9 +1,11 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + val a: Int by Delegate() class Delegate { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): 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 0b2e8cd88fc..f1ca1ccc34c 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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 e9a96724c88..4276b095160 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/absentErrorAboutType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/absentErrorAboutType.kt @@ -1,9 +1,11 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + val a by Delegate() class Delegate { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): 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 0b2e8cd88fc..f1ca1ccc34c 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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 86ef0cee92b..a2b8d1d4ad2 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/abstractDelegatedProperty.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/abstractDelegatedProperty.kt @@ -1,11 +1,13 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + abstract class A { abstract val a: Int by Delegate() } class Delegate { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): 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 eaf18b94192..7305b7a11a6 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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 95e2b0f7899..03efeff5892 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/backingField.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/backingField.kt @@ -1,5 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + class B { val a: Int by Delegate() @@ -7,8 +9,7 @@ class B { } class Delegate { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): Int { return 1 } } - diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/backingField.txt b/compiler/testData/diagnostics/tests/delegatedProperty/backingField.txt index 086c0819fd7..346116f9a20 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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 4c19d59e378..7b2135dd43f 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/defaultGetter.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/defaultGetter.kt @@ -1,10 +1,12 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + val a: Int by Delegate() get class Delegate { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): 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 0b2e8cd88fc..f1ca1ccc34c 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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 4ae1b933187..b64b84beb28 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/defaultSetter.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/defaultSetter.kt @@ -1,12 +1,14 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + var a: Int by Delegate() private set class Delegate { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): Int { return 1 } - operator fun setValue(t: Any?, p: PropertyMetadata, i: Int) {} -} \ No newline at end of file + operator fun setValue(t: Any?, p: KProperty<*>, i: Int) {} +} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/defaultSetter.txt b/compiler/testData/diagnostics/tests/delegatedProperty/defaultSetter.txt index 7e14010bfa5..92c7abf0c1b 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*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 55cdb35536b..1a63e3362c3 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTrait.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTrait.kt @@ -1,5 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + interface A { val prop: Int } @@ -13,7 +15,7 @@ fun foo() { } class Delegate { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): Int { return 1 } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTrait.txt b/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTrait.txt index 0d719c00c68..7ce2daa2dff 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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 895740f613b..3c0d685e506 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTraitTypeMismatch.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTraitTypeMismatch.kt @@ -1,5 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + interface A { val prop: Int } @@ -13,7 +15,7 @@ fun foo() { } class Delegate { - operator fun getValue(t: Any?, p: PropertyMetadata): String { + operator fun getValue(t: Any?, p: KProperty<*>): String { return "" } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTraitTypeMismatch.txt b/compiler/testData/diagnostics/tests/delegatedProperty/delegatedPropertyOverridedInTraitTypeMismatch.txt index 4c6874e1f11..c21e8b7b781 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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/disallowImplInTypeParameter.kt b/compiler/testData/diagnostics/tests/delegatedProperty/disallowImplInTypeParameter.kt index 499628b927c..9b320bd7f82 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/disallowImplInTypeParameter.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/disallowImplInTypeParameter.kt @@ -1,5 +1,7 @@ +import kotlin.reflect.KProperty0 + val a: Int by A() class A { - fun getValue(t: Any?, p: PropertyMetadataImpl): Int = 1 + fun getValue(t: Any?, p: KProperty0<*>): Int = 1 } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/disallowImplInTypeParameter.txt b/compiler/testData/diagnostics/tests/delegatedProperty/disallowImplInTypeParameter.txt index 5fdde7c3a03..e9215575535 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/disallowImplInTypeParameter.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/disallowImplInTypeParameter.txt @@ -5,7 +5,7 @@ public val 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.PropertyMetadataImpl): kotlin.Int + public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty0<*>): 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/genericGetter.kt b/compiler/testData/diagnostics/tests/delegatedProperty/genericGetter.kt index 011a055adce..8c841bef535 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/genericGetter.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/genericGetter.kt @@ -1,10 +1,11 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + val a: Int by A(1) class A(i: T) { - operator fun getValue(t: Any?, p: PropertyMetadata): T { + operator fun getValue(t: Any?, p: KProperty<*>): T { throw Exception() } } - diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/genericGetter.txt b/compiler/testData/diagnostics/tests/delegatedProperty/genericGetter.txt index 828738e4aa8..80bd8735945 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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 6f48a5c3b7d..c567c076187 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/getterWithSubtype.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/getterWithSubtype.kt @@ -1,14 +1,15 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + open class Base class Derived: Base() val a: Base by A() class A { - operator fun getValue(t: Any?, p: PropertyMetadata): Derived { + operator fun getValue(t: Any?, p: KProperty<*>): Derived { return Derived() } } - diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/getterWithSubtype.txt b/compiler/testData/diagnostics/tests/delegatedProperty/getterWithSubtype.txt index eff74c22ed0..69b16c68076 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): Derived + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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 8f47df808e8..3d6b249c431 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inTrait.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inTrait.kt @@ -1,11 +1,13 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + interface T { val a: Int by Delegate() } class Delegate { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): Int { return 1 } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inTrait.txt b/compiler/testData/diagnostics/tests/delegatedProperty/inTrait.txt index 138cff04a7a..e72307e658e 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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/incompleteTypeInference.kt b/compiler/testData/diagnostics/tests/delegatedProperty/incompleteTypeInference.kt index 435705c309b..685501ec725 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/incompleteTypeInference.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/incompleteTypeInference.kt @@ -1,5 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + class A class D { @@ -9,7 +11,7 @@ class D { val cTopLevel: Int by IncorrectThis() class IncorrectThis { - fun get(t: Any?, p: PropertyMetadata): Int { + fun get(t: Any?, p: KProperty<*>): Int { return 1 } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/incompleteTypeInference.txt b/compiler/testData/diagnostics/tests/delegatedProperty/incompleteTypeInference.txt index 67774f9458e..b9c603afa9d 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/incompleteTypeInference.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/incompleteTypeInference.txt @@ -20,7 +20,7 @@ public final class D { public final class IncorrectThis { public constructor IncorrectThis() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - public final fun get(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final fun get(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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 836fc4d0d2c..3b857bb9334 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.kt @@ -1,5 +1,7 @@ package baz +import kotlin.reflect.KProperty + class A(outer: Outer) { var i: String by + getMyConcreteProperty() var d: String by getMyConcreteProperty() - 1 @@ -21,12 +23,12 @@ fun getMyConcreteProperty() = MyProperty() class MyProperty { - operator fun getValue(thisRef: R, desc: PropertyMetadata): T { + operator fun getValue(thisRef: R, desc: KProperty<*>): T { println("get $thisRef ${desc.name}") return null as T } - operator fun setValue(thisRef: R, desc: PropertyMetadata, value: T) { + operator fun setValue(thisRef: R, desc: KProperty<*>, value: T) { println("set $thisRef ${desc.name} $value") } } @@ -47,4 +49,4 @@ interface Outer { } // ----------------- -fun println(a: Any?) = a \ No newline at end of file +fun println(a: Any?) = a diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.txt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/differentDelegatedExpressions.txt index 0b0684ff826..0b027fead42 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 operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.reflect.KProperty<*>): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*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 53cf2592c21..ad70419a6b2 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionGet.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionGet.kt @@ -1,11 +1,13 @@ package foo +import kotlin.reflect.KProperty + class A1 { val a: String by MyProperty1() } class MyProperty1 {} -operator fun MyProperty1.getValue(thisRef: Any?, desc: PropertyMetadata): String { +operator fun MyProperty1.getValue(thisRef: Any?, desc: KProperty<*>): String { throw Exception("$thisRef $desc") } @@ -16,7 +18,7 @@ class A2 { } class MyProperty2 {} -operator fun MyProperty2.getValue(thisRef: Any?, desc: PropertyMetadata): T { +operator fun MyProperty2.getValue(thisRef: Any?, desc: KProperty<*>): T { throw Exception("$thisRef $desc") } @@ -27,7 +29,7 @@ class A3 { class MyProperty3 {} - operator fun MyProperty3.getValue(thisRef: Any?, desc: PropertyMetadata): T { + operator fun MyProperty3.getValue(thisRef: Any?, desc: KProperty<*>): 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 8256aee6e18..581359a9fa3 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 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 operator fun foo.MyProperty1.getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ desc: kotlin.reflect.KProperty<*>): kotlin.String + public operator fun foo.MyProperty2.getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ desc: kotlin.reflect.KProperty<*>): 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 operator 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.reflect.KProperty<*>): 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 9804fd102d2..ea5516e6ec5 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/extensionProperty.kt @@ -1,5 +1,7 @@ package foo +import kotlin.reflect.KProperty + open class A { val B.w: Int by MyProperty() } @@ -13,7 +15,7 @@ class B { } class MyProperty { - operator fun getValue(thisRef: R, desc: PropertyMetadata): T { + operator fun getValue(thisRef: R, desc: KProperty<*>): 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 4763b1c95b0..18c980dfa75 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 operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.reflect.KProperty<*>): 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 2f708079683..2ab316c5184 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethodInGenericClass.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethodInGenericClass.kt @@ -1,24 +1,26 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + class A() { - operator fun getValue(t: Any?, p: PropertyMetadata): T = null!! - operator fun setValue(t: Any?, p: PropertyMetadata, x: T) = Unit + operator fun getValue(t: Any?, p: KProperty<*>): T = null!! + operator fun setValue(t: Any?, p: KProperty<*>, x: T) = Unit } var a1: Int by A() var a2: Int by A() class B() { - operator fun getValue(t: Any?, p: PropertyMetadata): T = null!! - operator fun setValue(t: Any?, p: PropertyMetadata, x: R) = Unit + operator fun getValue(t: Any?, p: KProperty<*>): T = null!! + operator fun setValue(t: Any?, p: KProperty<*>, x: R) = Unit } var b1: Int by B() var b2: Int by B() class C() { - operator fun getValue(t: Any?, p: PropertyMetadata): R = null!! - operator fun setValue(t: Any?, p: PropertyMetadata, x: T) = Unit + operator fun getValue(t: Any?, p: KProperty<*>): R = null!! + operator fun setValue(t: Any?, p: KProperty<*>, 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 62be92b6c4b..63dd6f3f9ae 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): R + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): R public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*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 d7e995ef705..bf68999d53a 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethods.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethods.kt @@ -1,4 +1,6 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + var a: Int by A() var a1 by A() @@ -8,16 +10,16 @@ val cObj = C() var c: String by cObj class A { - operator fun getValue(t: Any?, p: PropertyMetadata): T = null!! - operator fun setValue(t: Any?, p: PropertyMetadata, x: T) = Unit + operator fun getValue(t: Any?, p: KProperty<*>): T = null!! + operator fun setValue(t: Any?, p: KProperty<*>, x: T) = Unit } class B -operator fun B.getValue(t: Any?, p: PropertyMetadata): T = null!! -operator fun B.setValue(t: Any?, p: PropertyMetadata, x: T) = Unit +operator fun B.getValue(t: Any?, p: KProperty<*>): T = null!! +operator fun B.setValue(t: Any?, p: KProperty<*>, x: T) = Unit class C -operator inline fun C.getValue(t: Any?, p: PropertyMetadata): T = null!! -operator inline fun C.setValue(t: Any?, p: PropertyMetadata, x: T) = Unit +operator inline fun C.getValue(t: Any?, p: KProperty<*>): T = null!! +operator inline fun C.setValue(t: Any?, p: KProperty<*>, x: T) = Unit diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethods.txt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/genericMethods.txt index 439717c88f0..c6d5cc2abf6 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 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 operator fun B.getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): T +@kotlin.inline() public operator fun C.getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): T +public operator fun B.setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>, /*2*/ x: T): kotlin.Unit +@kotlin.inline() public operator fun C.setValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>, /*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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*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 b189689b695..f8290772eae 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/labeledDelegatedExpression.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/labeledDelegatedExpression.kt @@ -1,9 +1,11 @@ +import kotlin.reflect.KProperty + class A3 { val a: String by l@ MyProperty() class MyProperty {} - operator fun MyProperty.getValue(thisRef: Any?, desc: PropertyMetadata): T { + operator fun MyProperty.getValue(thisRef: Any?, desc: KProperty<*>): 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 1f16009ca0f..111fac06894 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 operator 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.reflect.KProperty<*>): 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 a06cb1d2355..dfbab18066d 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.kt @@ -1,5 +1,7 @@ package foo +import kotlin.reflect.KProperty + class A { var a5: String by MyProperty1() var b5: String by getMyProperty1() @@ -9,7 +11,7 @@ fun getMyProperty1() = MyProperty1() class MyProperty1 { - operator fun getValue(thisRef: R, desc: PropertyMetadata): T { + operator fun getValue(thisRef: R, desc: KProperty<*>): T { throw Exception() } @@ -29,7 +31,7 @@ fun getMyProperty2() = MyProperty2() class MyProperty2 { - operator fun getValue(thisRef: R, desc: PropertyMetadata): T { + operator fun getValue(thisRef: R, desc: KProperty<*>): T { throw Exception() } @@ -39,4 +41,4 @@ class MyProperty2 { } // ----------------- -fun println(a: Any?) = a \ No newline at end of file +fun println(a: Any?) = a diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.txt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.txt index 98fee54da3a..57974bf4da9 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/noErrorsForImplicitConstraints.txt @@ -26,7 +26,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 operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.reflect.KProperty<*>): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int 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 @@ -35,7 +35,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 operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.reflect.KProperty<*>): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int 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 14f8daf1f6d..665afee2ad5 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/noExpectedTypeForSupertypeConstraint.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/noExpectedTypeForSupertypeConstraint.kt @@ -1,14 +1,16 @@ +import kotlin.reflect.KProperty + class A { var a by MyProperty() } class MyProperty { - operator fun getValue(thisRef: R, desc: PropertyMetadata): T { + operator fun getValue(thisRef: R, desc: KProperty<*>): T { throw Exception("$thisRef $desc") } - operator fun setValue(thisRef: R, desc: PropertyMetadata, t: T) { + operator fun setValue(thisRef: R, desc: KProperty<*>, 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 02f321f3921..fe4e1259365 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 operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.reflect.KProperty<*>): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*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 6f14e21f6ee..684cd8878f4 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/useCompleterWithoutExpectedType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/useCompleterWithoutExpectedType.kt @@ -1,5 +1,7 @@ // !CHECK_TYPE +import kotlin.reflect.KProperty + class A { val a by MyProperty() @@ -9,5 +11,5 @@ class A { } class MyProperty { - operator fun getValue(thisRef: R, desc: PropertyMetadata): Int = throw Exception("$thisRef $desc") -} \ No newline at end of file + operator fun getValue(thisRef: R, desc: KProperty<*>): Int = throw Exception("$thisRef $desc") +} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/useCompleterWithoutExpectedType.txt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/useCompleterWithoutExpectedType.txt index 8eba76a5ddd..ebe5391684b 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 operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.reflect.KProperty<*>): 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 d9f2be2bc60..2b4955d7f04 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedType.kt @@ -1,5 +1,7 @@ package foo +import kotlin.reflect.KProperty + class A1 { var a1: String by MyProperty1() var b1: String by getMyProperty1() @@ -12,12 +14,12 @@ fun getMyProperty1() = MyProperty1() class MyProperty1 { - operator fun getValue(thisRef: R, desc: PropertyMetadata): T { + operator fun getValue(thisRef: R, desc: KProperty<*>): T { println("get $thisRef ${desc.name}") throw Exception() } - operator fun setValue(thisRef: R, desc: PropertyMetadata, value: T) { + operator fun setValue(thisRef: R, desc: KProperty<*>, value: T) { println("set $thisRef ${desc.name} $value") } } @@ -36,12 +38,12 @@ fun getMyProperty2() = MyProperty2() class MyProperty2 { - operator fun getValue(thisRef: Any?, desc: PropertyMetadata): T { + operator fun getValue(thisRef: Any?, desc: KProperty<*>): T { println("get $thisRef ${desc.name}") throw Exception() } - operator fun setValue(thisRef: Any?, desc: PropertyMetadata, value: T) { + operator fun setValue(thisRef: Any?, desc: KProperty<*>, value: T) { println("set $thisRef ${desc.name} $value") } } @@ -60,15 +62,15 @@ fun getMyProperty3() = MyProperty3() class MyProperty3 { - operator fun getValue(thisRef: T, desc: PropertyMetadata): String { + operator fun getValue(thisRef: T, desc: KProperty<*>): String { println("get $thisRef ${desc.name}") return "" } - operator fun setValue(thisRef: Any?, desc: PropertyMetadata, value: T) { + operator fun setValue(thisRef: Any?, desc: KProperty<*>, value: T) { println("set $thisRef ${desc.name} $value") } } //-------------------------- -fun println(a: Any?) = a \ No newline at end of file +fun println(a: Any?) = a diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedType.txt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedType.txt index 706c81f77a6..7facd63d39a 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 operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.reflect.KProperty<*>): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*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 operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ desc: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ desc: kotlin.reflect.KProperty<*>): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*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 operator fun getValue(/*0*/ thisRef: T, /*1*/ desc: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ thisRef: T, /*1*/ desc: kotlin.reflect.KProperty<*>): kotlin.String public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*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 a062b94a19e..2a4e6fdd94a 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedTypeForVal.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedTypeForVal.kt @@ -1,5 +1,7 @@ package foo +import kotlin.reflect.KProperty + class A1 { val a1: String by MyProperty1() val b1: String by getMyProperty1() @@ -12,7 +14,7 @@ fun getMyProperty1() = MyProperty1() class MyProperty1 { - operator fun getValue(thisRef: R, desc: PropertyMetadata): T { + operator fun getValue(thisRef: R, desc: KProperty<*>): T { println("get $thisRef ${desc.name}") throw Exception() } @@ -32,7 +34,7 @@ fun getMyProperty2() = MyProperty2() class MyProperty2 { - operator fun getValue(thisRef: Any?, desc: PropertyMetadata): T { + operator fun getValue(thisRef: Any?, desc: KProperty<*>): T { println("get $thisRef ${desc.name}") throw Exception() } @@ -52,11 +54,11 @@ fun getMyProperty3() = MyProperty3() class MyProperty3 { - operator fun getValue(thisRef: T, desc: PropertyMetadata): String { + operator fun getValue(thisRef: T, desc: KProperty<*>): String { println("get $thisRef ${desc.name}") return "" } } //-------------------------- -fun println(a: Any?) = a \ No newline at end of file +fun println(a: Any?) = a diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedTypeForVal.txt b/compiler/testData/diagnostics/tests/delegatedProperty/inference/useExpectedTypeForVal.txt index c4dd1365481..eb2a6b79edb 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 operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ thisRef: R, /*1*/ desc: kotlin.reflect.KProperty<*>): 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 operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ desc: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ desc: kotlin.reflect.KProperty<*>): 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 operator fun getValue(/*0*/ thisRef: T, /*1*/ desc: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ thisRef: T, /*1*/ desc: kotlin.reflect.KProperty<*>): 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/localVariable.kt b/compiler/testData/diagnostics/tests/delegatedProperty/localVariable.kt index 6d3b666be44..a0564e060f1 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/localVariable.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/localVariable.kt @@ -1,5 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE +import kotlin.reflect.KProperty + class Local { fun foo() { val a: Int by Delegate() @@ -7,7 +9,7 @@ class Local { } class Delegate { - fun getValue(t: Any?, p: PropertyMetadata): Int { + fun getValue(t: Any?, p: KProperty<*>): Int { return 1 } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/localVariable.txt b/compiler/testData/diagnostics/tests/delegatedProperty/localVariable.txt index 0f41079c789..c0d4b6ba5c8 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/localVariable.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/localVariable.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 fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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/missedGetter.kt b/compiler/testData/diagnostics/tests/delegatedProperty/missedGetter.kt index 8636cf66c57..69a771ca39b 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/missedGetter.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/missedGetter.kt @@ -1,3 +1,3 @@ -val a: Int by A() +val a: Int by \); A)!>A() class A diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/missedSetter.kt b/compiler/testData/diagnostics/tests/delegatedProperty/missedSetter.kt index 2b31a05f9c9..092e7b4139d 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/missedSetter.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/missedSetter.kt @@ -1,9 +1,11 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -var a: Int by A() +import kotlin.reflect.KProperty + +var a: Int by , kotlin.Int\); A)!>A() class A { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): Int { return 1 } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/missedSetter.txt b/compiler/testData/diagnostics/tests/delegatedProperty/missedSetter.txt index da85a7b23f9..94e9d60fefd 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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 d59b037cfea..9237aff75d0 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDefferedType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDefferedType.kt @@ -1,9 +1,11 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + class B { val c by Delegate(ag) } class Delegate(val init: T) { - operator fun getValue(t: Any?, p: PropertyMetadata): Int = null!! + operator fun getValue(t: Any?, p: KProperty<*>): Int = null!! } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDefferedType.txt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDefferedType.txt index 9c697bec4d6..02fcb832d25 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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 c0323584573..0cb21f987a4 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.kt @@ -1,13 +1,15 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + val a: Int by Delegate() class Delegate { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): Int { return 1 } - fun propertyDelegated(p: PropertyMetadata, i: Int = 1) {} + fun propertyDelegated(p: KProperty<*>, i: Int = 1) {} - fun propertyDelegated(p: PropertyMetadata, s: String = "") {} -} \ No newline at end of file + fun propertyDelegated(p: KProperty<*>, s: String = "") {} +} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.txt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.txt index d7f768f1e57..e4d8ebe8173 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedAmbiguity.txt @@ -5,9 +5,9 @@ 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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 + public final fun propertyDelegated(/*0*/ p: kotlin.reflect.KProperty<*>, /*1*/ i: kotlin.Int = ...): kotlin.Unit + public final fun propertyDelegated(/*0*/ p: kotlin.reflect.KProperty<*>, /*1*/ s: kotlin.String = ...): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.kt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.kt index 8144bdb5c5a..9d20e8dcfaa 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.kt @@ -1,11 +1,13 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + val a: Int by Delegate() class Delegate { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): Int { return 1 } - fun propertyDelegated(p: PropertyMetadata) {} + fun propertyDelegated(p: KProperty<*>) {} } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.txt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.txt index aa61f767026..2014416a750 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedIncomplete.txt @@ -5,8 +5,8 @@ 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final fun propertyDelegated(/*0*/ p: kotlin.PropertyMetadata): kotlin.Unit + public final fun propertyDelegated(/*0*/ p: kotlin.reflect.KProperty<*>): 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 efc74562df1..5824720b6aa 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedMissing.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedMissing.kt @@ -1,9 +1,11 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + val a: Int by Delegate() class Delegate { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): Int { return 1 } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedMissing.txt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedMissing.txt index 0b2e8cd88fc..f1ca1ccc34c 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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 0b2343e5938..e8da0e289c2 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedPrivate.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedPrivate.kt @@ -1,11 +1,13 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + val a: Int by Delegate() class Delegate { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): Int { return 1 } - private fun propertyDelegated(p: PropertyMetadata) {} + private fun propertyDelegated(p: KProperty<*>) {} } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedPrivate.txt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedPrivate.txt index af9619013eb..e701fb1559f 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedPrivate.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedPrivate.txt @@ -5,8 +5,8 @@ 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - private final fun propertyDelegated(/*0*/ p: kotlin.PropertyMetadata): kotlin.Unit + private final fun propertyDelegated(/*0*/ p: kotlin.reflect.KProperty<*>): 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 f41d5402785..13e57affeac 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.kt @@ -1,9 +1,11 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + val a: Int by Delegate() class Delegate { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): Int { return 1 } @@ -13,5 +15,5 @@ class Delegate { fun propertyDelegated(a: String) {} - fun propertyDelegated(p: PropertyMetadata, a: Int) {} + fun propertyDelegated(p: KProperty<*>, a: Int) {} } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.txt b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.txt index f048a9cf49f..c884349f2c0 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/propertyDelegatedWrongArguments.txt @@ -5,11 +5,11 @@ 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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 - public final fun propertyDelegated(/*0*/ p: kotlin.PropertyMetadata, /*1*/ a: kotlin.Int): kotlin.Unit public final fun propertyDelegated(/*0*/ a: kotlin.String): kotlin.Unit + public final fun propertyDelegated(/*0*/ p: kotlin.reflect.KProperty<*>, /*1*/ a: kotlin.Int): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.kt b/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.kt index b27625e8269..211693d2bf9 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/recursiveType.kt @@ -1,5 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + val a by a val b by Delegate(b) @@ -8,7 +10,7 @@ val c by d val d by c class Delegate(i: Int) { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): 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 17c698578e2..a1da67a0de6 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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 fa66bcf9c75..2882c88d6ca 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/redundantGetter.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/redundantGetter.kt @@ -1,10 +1,12 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + val a: Int by Delegate() get() = 1 class Delegate { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): 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 0b2e8cd88fc..f1ca1ccc34c 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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 206c6071de1..a9926a8a113 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/redundantSetter.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/redundantSetter.kt @@ -1,13 +1,15 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + var a: Int by Delegate() get() = 1 set(i) {} class Delegate { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): Int { return 1 } - operator fun setValue(t: Any?, p: PropertyMetadata, i: Int) {} + operator fun setValue(t: Any?, p: KProperty<*>, i: Int) {} } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/redundantSetter.txt b/compiler/testData/diagnostics/tests/delegatedProperty/redundantSetter.txt index 7e14010bfa5..92c7abf0c1b 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*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 38a2bf6f654..e5ac5d81f00 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/setterThisTypeMismatch.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/setterThisTypeMismatch.kt @@ -1,5 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + class D { var c: Int by Delegate() } @@ -9,8 +11,8 @@ var cTopLevel: Int by Delegate() class A class Delegate { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): Int { return 1 } - operator fun setValue(t: A, p: PropertyMetadata, i: Int) {} + operator fun setValue(t: A, p: KProperty<*>, i: Int) {} } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/setterThisTypeMismatch.txt b/compiler/testData/diagnostics/tests/delegatedProperty/setterThisTypeMismatch.txt index 16806ef17af..c44764bc165 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*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 e532580d7f9..694a5ca0436 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/setterWithSupertype.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/setterWithSupertype.kt @@ -1,15 +1,16 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + open class Base class Derived: Base() var a: Derived by A() class A { - operator fun getValue(t: Any?, p: PropertyMetadata): Derived { + operator fun getValue(t: Any?, p: KProperty<*>): Derived { return Derived() } - operator fun setValue(t: Any?, p: PropertyMetadata, i: Base) {} + operator fun setValue(t: Any?, p: KProperty<*>, i: Base) {} } - diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/setterWithSupertype.txt b/compiler/testData/diagnostics/tests/delegatedProperty/setterWithSupertype.txt index 845a96986f8..5bacbf517da 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): Derived + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): Derived public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*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 b15aeba105e..5fe8c957ff8 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/thisInDelegate.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/thisInDelegate.kt @@ -1,5 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + val Int.a by Delegate(this) class A { @@ -7,7 +9,7 @@ class A { } class Delegate(i: Int) { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): 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 99b974b86d8..37c5aa362f1 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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 a1f7f74fbd2..04ef269bb5e 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/thisOfAnyType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/thisOfAnyType.kt @@ -1,5 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + class A { var a: Int by Delegate() } @@ -7,8 +9,8 @@ class A { var aTopLevel: Int by Delegate() class Delegate { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): Int { return 1 } - operator fun setValue(t: Any?, p: PropertyMetadata, a: Int) {} -} \ No newline at end of file + operator fun setValue(t: Any?, p: KProperty<*>, a: Int) {} +} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/thisOfAnyType.txt b/compiler/testData/diagnostics/tests/delegatedProperty/thisOfAnyType.txt index ea713274474..4c16c053fa1 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*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 2c1d38a1f10..0ef43a4fc44 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/thisOfNothingNullableType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/thisOfNothingNullableType.kt @@ -1,3 +1,7 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +import kotlin.reflect.KProperty + class A { var a: Int by Delegate() } @@ -5,11 +9,9 @@ class A { var aTopLevel: Int by Delegate() class Delegate { - operator fun getValue(t: Nothing?, p: PropertyMetadata): Int { - p.equals(null) // to avoid UNUSED_PARAMETER warning + operator fun getValue(t: Nothing?, p: KProperty<*>): Int { return 1 } - operator fun setValue(t: Nothing?, p: PropertyMetadata, a: Int) { - p.equals(a) // to avoid UNUSED_PARAMETER warning + operator fun setValue(t: Nothing?, p: KProperty<*>, a: Int) { } -} \ 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 5f20d0cbb9b..c5849ecf6f5 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 operator fun getValue(/*0*/ t: kotlin.Nothing?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Nothing?, /*1*/ p: kotlin.reflect.KProperty<*>): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*2*/ a: kotlin.Int): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/thisOfNothingType.kt b/compiler/testData/diagnostics/tests/delegatedProperty/thisOfNothingType.kt index f3c24e96c18..1088ea9b8fd 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/thisOfNothingType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/thisOfNothingType.kt @@ -1,3 +1,7 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +import kotlin.reflect.KProperty + class A { var a: Int by Delegate() } @@ -5,11 +9,9 @@ class A { var aTopLevel: Int by Delegate() class Delegate { - fun getValue(t: Nothing, p: PropertyMetadata): Int { - p.equals(null) // to avoid UNUSED_PARAMETER warning + fun getValue(t: Nothing, p: KProperty<*>): Int { return 1 } - fun setValue(t: Nothing, p: PropertyMetadata, a: Int) { - p.equals(a) // to avoid UNUSED_PARAMETER warning + fun setValue(t: Nothing, p: KProperty<*>, a: Int) { } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/thisOfNothingType.txt b/compiler/testData/diagnostics/tests/delegatedProperty/thisOfNothingType.txt index a17618c28fa..76c9b8362b5 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/thisOfNothingType.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/thisOfNothingType.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 fun getValue(/*0*/ t: kotlin.Nothing, /*1*/ p: kotlin.reflect.KProperty<*>): 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 fun setValue(/*0*/ t: kotlin.Nothing, /*1*/ p: kotlin.reflect.KProperty<*>, /*2*/ a: kotlin.Int): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/twoGetMethods.kt b/compiler/testData/diagnostics/tests/delegatedProperty/twoGetMethods.kt index 899d7648258..f90603c7da2 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/twoGetMethods.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/twoGetMethods.kt @@ -1,15 +1,17 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +import kotlin.reflect.KProperty + class A { val c: Int by Delegate() } class Delegate { - fun getValue(t: Int, p: PropertyMetadata): Int { - t.equals(p) // to avoid UNUSED_PARAMETER warning + fun getValue(t: Int, p: KProperty<*>): Int { return 1 } - fun getValue(t: String, p: PropertyMetadata): Int { - t.equals(p) // to avoid UNUSED_PARAMETER warning + fun getValue(t: String, p: KProperty<*>): Int { return 1 } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/twoGetMethods.txt b/compiler/testData/diagnostics/tests/delegatedProperty/twoGetMethods.txt index f461969b47f..990076d3392 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/twoGetMethods.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/twoGetMethods.txt @@ -11,8 +11,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.Int, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int - public final fun getValue(/*0*/ t: kotlin.String, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final fun getValue(/*0*/ t: kotlin.Int, /*1*/ p: kotlin.reflect.KProperty<*>): kotlin.Int + public final fun getValue(/*0*/ t: kotlin.String, /*1*/ p: kotlin.reflect.KProperty<*>): 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/typeMismatchForGetReturnType.kt b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetReturnType.kt index 83e911f1441..faf7937226b 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetReturnType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetReturnType.kt @@ -1,9 +1,11 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + val c: Int by Delegate() class Delegate { - operator fun getValue(t: Any?, p: PropertyMetadata): String { + operator fun getValue(t: Any?, p: KProperty<*>): String { return "" } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetReturnType.txt b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetReturnType.txt index 1d9bc641260..30637784e9d 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.String + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): 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 a62cfe3c78a..f36212b8a54 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetWithGeneric.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForGetWithGeneric.kt @@ -1,4 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER + +import kotlin.reflect.KProperty + class A class B { @@ -14,7 +17,7 @@ class C { val cTopLevel: Int by Delegate() class Delegate { - operator fun getValue(t: T, p: PropertyMetadata): Int { + operator fun getValue(t: T, p: KProperty<*>): 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 281ccfaeb65..603f2a00247 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 operator fun getValue(/*0*/ t: T, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: T, /*1*/ p: kotlin.reflect.KProperty<*>): 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 8b2da124d6b..c91bcf038b8 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForSetParameter.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForSetParameter.kt @@ -1,5 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + class A { var a: Int by Delegate() } @@ -7,8 +9,8 @@ class A { var aTopLevel: Int by Delegate() class Delegate { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): Int { return 1 } - operator fun setValue(t: Any?, p: PropertyMetadata, i: String) {} + operator fun setValue(t: Any?, p: KProperty<*>, i: String) {} } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForSetParameter.txt b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForSetParameter.txt index 66edecf0af6..224e0be8a16 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*2*/ i: kotlin.String): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForThisGetParameter.kt b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForThisGetParameter.kt index e76e2c7ea6f..107485fdbc9 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForThisGetParameter.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForThisGetParameter.kt @@ -1,3 +1,7 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +import kotlin.reflect.KProperty + class B { val b: Int by Delegate() } @@ -7,9 +11,7 @@ val bTopLevel: Int by Delegate() class A class Delegate { - fun getValue(t: A, p: PropertyMetadata): Int { - t.equals(p) // to avoid UNUSED_PARAMETER warning + fun getValue(t: A, p: KProperty<*>): Int { return 1 } } - diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForThisGetParameter.txt b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForThisGetParameter.txt index a5a27cd600e..4294d804f1d 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForThisGetParameter.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/typeMismatchForThisGetParameter.txt @@ -20,7 +20,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: A, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final fun getValue(/*0*/ t: A, /*1*/ p: kotlin.reflect.KProperty<*>): 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/wrongCountOfParametersInGet.kt b/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInGet.kt index 3453a995913..8d4875fbee5 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInGet.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInGet.kt @@ -1,5 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + class A { val a: Int by Delegate() } @@ -7,7 +9,7 @@ class A { val aTopLevel: Int by Delegate() class Delegate { - fun getValue(t: Any?, p: PropertyMetadata, a: Int): Int { + fun getValue(t: Any?, p: KProperty<*>, a: Int): Int { return a } } diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInGet.txt b/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInGet.txt index f58c48f4a42..0c4fc16f700 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInGet.txt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInGet.txt @@ -13,7 +13,7 @@ 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, /*2*/ a: kotlin.Int): kotlin.Int + public final fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>, /*2*/ a: kotlin.Int): 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/wrongCountOfParametersInSet.kt b/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInSet.kt index 5dce405e074..9190e4c95d8 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInSet.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInSet.kt @@ -1,5 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + class A { var a: Int by Delegate() } @@ -7,9 +9,9 @@ class A { var aTopLevel: Int by Delegate() class Delegate { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): Int { return 1 } - operator fun setValue(t: Any?, p: PropertyMetadata, a: Int, c: Int) {} -} \ No newline at end of file + operator fun setValue(t: Any?, p: KProperty<*>, a: Int, c: Int) {} +} diff --git a/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInSet.txt b/compiler/testData/diagnostics/tests/delegatedProperty/wrongCountOfParametersInSet.txt index b154ac4e879..8a979e6c564 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*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 ade67841bd2..656d940c014 100644 --- a/compiler/testData/diagnostics/tests/delegatedProperty/wrongSetterReturnType.kt +++ b/compiler/testData/diagnostics/tests/delegatedProperty/wrongSetterReturnType.kt @@ -1,13 +1,15 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + var b: Int by Delegate() class Delegate { - operator fun getValue(t: Any?, p: PropertyMetadata): Int { + operator fun getValue(t: Any?, p: KProperty<*>): Int { return 1 } - operator fun setValue(t: Any?, p: PropertyMetadata, i: Int): Int { + operator fun setValue(t: Any?, p: KProperty<*>, 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 3a7a1b48845..5d3a5258a5b 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 operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ t: kotlin.Any?, /*1*/ p: kotlin.reflect.KProperty<*>): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*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 b908ce6d7fd..4878183f0e7 100644 --- a/compiler/testData/diagnostics/tests/deprecated/functionUsage.kt +++ b/compiler/testData/diagnostics/tests/deprecated/functionUsage.kt @@ -1,8 +1,10 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION +import kotlin.reflect.KProperty + class UsefulClass(val param: Int = 2) { - operator fun getValue(instance: Any, property: PropertyMetadata) : Int = 1 - operator fun setValue(instance: Any, property: PropertyMetadata, value: Int) {} + operator fun getValue(instance: Any, property: KProperty<*>) : Int = 1 + operator fun setValue(instance: Any, property: KProperty<*>, 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 8f339bdd1f7..eb7421ac0f4 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 operator fun getValue(/*0*/ instance: kotlin.Any, /*1*/ property: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ instance: kotlin.Any, /*1*/ property: kotlin.reflect.KProperty<*>): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int @kotlin.Deprecated(message = "message") public final fun member(): kotlin.Unit - public final operator 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.reflect.KProperty<*>, /*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 e557c38800c..223922cdfc9 100644 --- a/compiler/testData/diagnostics/tests/deprecated/propertyUsage.kt +++ b/compiler/testData/diagnostics/tests/deprecated/propertyUsage.kt @@ -1,11 +1,13 @@ // !DIAGNOSTICS: -UNUSED_EXPRESSION +import kotlin.reflect.KProperty + class Delegate() { @Deprecated("text") - operator fun getValue(instance: Any, property: PropertyMetadata) : Int = 1 + operator fun getValue(instance: Any, property: KProperty<*>) : Int = 1 @Deprecated("text") - operator fun setValue(instance: Any, property: PropertyMetadata, value: Int) {} + operator fun setValue(instance: Any, property: KProperty<*>, value: Int) {} } class PropertyHolder { diff --git a/compiler/testData/diagnostics/tests/deprecated/propertyUsage.txt b/compiler/testData/diagnostics/tests/deprecated/propertyUsage.txt index ff641a063d4..17681fe3030 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 operator 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.reflect.KProperty<*>): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - @kotlin.Deprecated(message = "text") public final operator 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.reflect.KProperty<*>, /*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 ccb79288407..8017128dfdd 100644 --- a/compiler/testData/diagnostics/tests/duplicateJvmSignature/specialNames/propertyMetadataCache.kt +++ b/compiler/testData/diagnostics/tests/duplicateJvmSignature/specialNames/propertyMetadataCache.kt @@ -1,4 +1,4 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER +// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION operator fun Any.getValue(x: Any?, y: Any): Any = null!! diff --git a/compiler/testData/diagnostics/tests/inference/substitutions/delegationAndInference.kt b/compiler/testData/diagnostics/tests/inference/substitutions/delegationAndInference.kt index 67d32c6df95..bac19086767 100644 --- a/compiler/testData/diagnostics/tests/inference/substitutions/delegationAndInference.kt +++ b/compiler/testData/diagnostics/tests/inference/substitutions/delegationAndInference.kt @@ -1,12 +1,14 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER +import kotlin.reflect.KProperty + class A(val map: MutableMap) { var a: String by map.withDefault1 { "foo" } } -operator fun MutableMap.getValue(thisRef: Any?, property: PropertyMetadata): G = throw Exception() +operator fun MutableMap.getValue(thisRef: Any?, property: KProperty<*>): G = throw Exception() -operator fun MutableMap.setValue(thisRef: Any?, property: PropertyMetadata, value: S) {} +operator fun MutableMap.setValue(thisRef: Any?, property: KProperty<*>, value: S) {} -fun MutableMap.withDefault1(default: (key: K) -> V): MutableMap = this \ No newline at end of file +fun MutableMap.withDefault1(default: (key: K) -> V): MutableMap = this diff --git a/compiler/testData/diagnostics/tests/inference/substitutions/delegationAndInference.txt b/compiler/testData/diagnostics/tests/inference/substitutions/delegationAndInference.txt index a8e4def0cf7..63ffa529734 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 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 operator fun kotlin.MutableMap.getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ property: kotlin.reflect.KProperty<*>): G +public operator fun kotlin.MutableMap.setValue(/*0*/ thisRef: kotlin.Any?, /*1*/ property: kotlin.reflect.KProperty<*>, /*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 06a2aa9c025..0999b2c3548 100644 --- a/compiler/testData/diagnostics/tests/modifiers/const/applicability.kt +++ b/compiler/testData/diagnostics/tests/modifiers/const/applicability.kt @@ -1,5 +1,7 @@ // !DIAGNOSTICS:-UNUSED_VARIABLE +import kotlin.reflect.KProperty + const val topLevel: Int = 0 const val topLevelInferred = 1 const var topLeveLVar: Int = 2 @@ -69,7 +71,7 @@ const val nonConstInitializer = foo() // ------------------ class Delegate { - operator fun getValue(thisRef: Any?, prop: PropertyMetadata): Int = 1 + operator fun getValue(thisRef: Any?, prop: KProperty<*>): Int = 1 - operator fun setValue(thisRef: Any?, prop: PropertyMetadata, value: Int) = Unit + operator fun setValue(thisRef: Any?, prop: KProperty<*>, value: Int) = Unit } diff --git a/compiler/testData/diagnostics/tests/modifiers/const/applicability.txt b/compiler/testData/diagnostics/tests/modifiers/const/applicability.txt index a9206b6fbfb..19de5437033 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 operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.Int + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.reflect.KProperty<*>): kotlin.Int public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*2*/ value: kotlin.Int): kotlin.Unit 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 2c584fe9a9a..ec98bc2d6ea 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/publicVals/delegate.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/publicVals/delegate.kt @@ -1,5 +1,7 @@ +import kotlin.reflect.KProperty + class Delegate { - operator fun getValue(thisRef: Any?, prop: PropertyMetadata): String? { + operator fun getValue(thisRef: Any?, prop: KProperty<*>): String? { return null } } @@ -19,4 +21,3 @@ class Example { return if (r != null) r else "" } } - diff --git a/compiler/testData/diagnostics/tests/smartCasts/publicVals/delegate.txt b/compiler/testData/diagnostics/tests/smartCasts/publicVals/delegate.txt index 5de5fd68e23..d8a42b403d4 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 operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.PropertyMetadata): kotlin.String? + public final operator fun getValue(/*0*/ thisRef: kotlin.Any?, /*1*/ prop: kotlin.reflect.KProperty<*>): 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 44bc4f6c705..65f96955372 100644 --- a/compiler/testData/diagnostics/tests/variance/ValProperty.kt +++ b/compiler/testData/diagnostics/tests/variance/ValProperty.kt @@ -1,10 +1,12 @@ +import kotlin.reflect.KProperty + interface In interface Out interface Inv class Delegate { - operator fun getValue(t: Any, p: PropertyMetadata): T = null!! - operator fun setValue(t: Any, p: PropertyMetadata, value: T) {} + operator fun getValue(t: Any, p: KProperty<*>): T = null!! + operator fun setValue(t: Any, p: KProperty<*>, value: T) {} } fun getT(): T = null!! @@ -45,4 +47,4 @@ abstract class Test { val X.typeParameter8: Int where X : P get() = 0 val X.typeParameter9: Int where X : In<)!>I> get() = 0 val X.typeParameter0: Int where X : In get() = 0 -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/variance/ValProperty.txt b/compiler/testData/diagnostics/tests/variance/ValProperty.txt index 334cfb6e482..012742257b1 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 operator fun getValue(/*0*/ t: kotlin.Any, /*1*/ p: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ t: kotlin.Any, /*1*/ p: kotlin.reflect.KProperty<*>): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*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 daec37d510a..dd4e714d1e1 100644 --- a/compiler/testData/diagnostics/tests/variance/VarProperty.kt +++ b/compiler/testData/diagnostics/tests/variance/VarProperty.kt @@ -1,10 +1,12 @@ +import kotlin.reflect.KProperty + interface In interface Out interface Inv class Delegate { - operator fun getValue(t: Any, p: PropertyMetadata): T = null!! - operator fun setValue(t: Any, p: PropertyMetadata, varue: T) {} + operator fun getValue(t: Any, p: KProperty<*>): T = null!! + operator fun setValue(t: Any, p: KProperty<*>, varue: T) {} } fun getT(): T = null!! @@ -45,4 +47,4 @@ abstract class Test { var X.typeParameter8: Int where X : P get() = 0; set(i) {} var X.typeParameter9: Int where X : In<)!>I> get() = 0; set(i) {} var X.typeParameter0: Int where X : In get() = 0; set(i) {} -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/tests/variance/VarProperty.txt b/compiler/testData/diagnostics/tests/variance/VarProperty.txt index 67dcfb7e67c..52ff60c66ee 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 operator fun getValue(/*0*/ t: kotlin.Any, /*1*/ p: kotlin.PropertyMetadata): T + public final operator fun getValue(/*0*/ t: kotlin.Any, /*1*/ p: kotlin.reflect.KProperty<*>): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public final operator 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.reflect.KProperty<*>, /*2*/ varue: T): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/core/builtins/src/kotlin/PropertyMetadata.kt b/core/builtins/src/kotlin/PropertyMetadata.kt index 83d654bec26..42375cf1d2d 100644 --- a/core/builtins/src/kotlin/PropertyMetadata.kt +++ b/core/builtins/src/kotlin/PropertyMetadata.kt @@ -19,16 +19,10 @@ package kotlin /** * Represents a property in a Kotlin class. */ +@Deprecated("Please use KProperty instead.", ReplaceWith("KProperty<*>", "kotlin.reflect.KProperty")) public interface PropertyMetadata { /** * The name of the property. */ public val name: String } - -/** - * @suppress - */ -public data class PropertyMetadataImpl(override val name: String): PropertyMetadata { - override fun toString() = "PropertyMetadata(name=$name)" -} diff --git a/core/descriptors/src/org/jetbrains/kotlin/builtins/KotlinBuiltIns.java b/core/descriptors/src/org/jetbrains/kotlin/builtins/KotlinBuiltIns.java index e25a84eb205..563e1360a0c 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/builtins/KotlinBuiltIns.java +++ b/core/descriptors/src/org/jetbrains/kotlin/builtins/KotlinBuiltIns.java @@ -41,7 +41,7 @@ import java.io.InputStream; import java.util.*; import static kotlin.CollectionsKt.*; -import static kotlin.SetsKt.*; +import static kotlin.SetsKt.setOf; import static org.jetbrains.kotlin.builtins.PrimitiveType.*; import static org.jetbrains.kotlin.resolve.DescriptorUtils.getFqName; @@ -702,11 +702,6 @@ public abstract class KotlinBuiltIns { return getBuiltInClassByName("PropertyMetadata"); } - @NotNull - public ClassDescriptor getPropertyMetadataImpl() { - return getBuiltInClassByName("PropertyMetadataImpl"); - } - @NotNull public AnnotationDescriptor createExtensionAnnotation() { return new AnnotationDescriptorImpl(getBuiltInClassByName(FQ_NAMES.extension.shortName()).getDefaultType(), diff --git a/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererOptionsImpl.kt b/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererOptionsImpl.kt index ee8c954ce12..3c124bbde56 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererOptionsImpl.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererOptionsImpl.kt @@ -22,6 +22,9 @@ import java.lang.reflect.Modifier import kotlin.properties.Delegates import kotlin.properties.ObservableProperty import kotlin.properties.ReadWriteProperty +import kotlin.reflect.KParameter +import kotlin.reflect.KProperty +import kotlin.reflect.KType internal class DescriptorRendererOptionsImpl : DescriptorRendererOptions { public var isLocked: Boolean = false @@ -35,12 +38,27 @@ internal class DescriptorRendererOptionsImpl : DescriptorRendererOptions { public fun copy(): DescriptorRendererOptionsImpl { val copy = DescriptorRendererOptionsImpl() - //TODO: use Kotlin reflection when it's ready - for (field in this.javaClass.getDeclaredFields()) { - if (field.getModifiers().and(Modifier.STATIC) != 0) continue - field.setAccessible(true) + //TODO: use Kotlin reflection + for (field in this.javaClass.declaredFields) { + if (field.modifiers.and(Modifier.STATIC) != 0) continue + field.isAccessible = true val property = field.get(this) as? ObservableProperty<*> ?: continue - val value = property.getValue(this, PropertyMetadataImpl("")/* not used*/) + val value = property.getValue(this, object : KProperty, PropertyMetadata { + override val parameters: List + get() = error("Should not be called") + override val returnType: KType + get() = error("Should not be called") + override val getter: KProperty.Getter + get() = error("Should not be called") + override val annotations: List + get() = error("Should not be called") + + override fun call(vararg args: Any?): Any? = error("Should not be called") + + override fun callBy(args: Map): Any? = error("Should not be called") + + override val name = "" /* not used */ + }) field.set(copy, copy.property(value as Any)) } diff --git a/core/descriptors/src/org/jetbrains/kotlin/util/OperatorChecker.kt b/core/descriptors/src/org/jetbrains/kotlin/util/OperatorChecker.kt index bae9220f105..95402d05329 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/util/OperatorChecker.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/util/OperatorChecker.kt @@ -21,10 +21,13 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor -import org.jetbrains.kotlin.name.FqNameUnsafe +import org.jetbrains.kotlin.name.ClassId +import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns import org.jetbrains.kotlin.resolve.descriptorUtil.hasDefaultValue import org.jetbrains.kotlin.resolve.descriptorUtil.isExtension +import org.jetbrains.kotlin.resolve.descriptorUtil.module +import org.jetbrains.kotlin.serialization.deserialization.findClassAcrossModuleDependencies import org.jetbrains.kotlin.types.typeUtil.* import org.jetbrains.kotlin.util.OperatorNameConventions.GET import org.jetbrains.kotlin.util.OperatorNameConventions.SET @@ -35,7 +38,6 @@ import org.jetbrains.kotlin.util.OperatorNameConventions.NEXT import org.jetbrains.kotlin.util.OperatorNameConventions.HAS_NEXT import org.jetbrains.kotlin.util.OperatorNameConventions.EQUALS import org.jetbrains.kotlin.util.OperatorNameConventions.COMPARE_TO -import org.jetbrains.kotlin.util.OperatorNameConventions.UNARY_OPERATION_NAMES import org.jetbrains.kotlin.util.OperatorNameConventions.BINARY_OPERATION_NAMES import org.jetbrains.kotlin.util.OperatorNameConventions.ASSIGNMENT_OPERATIONS import org.jetbrains.kotlin.util.OperatorNameConventions.COMPONENT_REGEX @@ -64,8 +66,8 @@ object OperatorChecks { valueParameters.size >= 2 && lastIsOk } - GET_VALUE == name -> noDefaultsAndVarargs && valueParameters.size >= 2 && valueParameters[1].isPropertyMetadata - SET_VALUE == name -> noDefaultsAndVarargs && valueParameters.size >= 3 && valueParameters[1].isPropertyMetadata + GET_VALUE == name -> noDefaultsAndVarargs && valueParameters.size >= 2 && valueParameters[1].isKProperty + SET_VALUE == name -> noDefaultsAndVarargs && valueParameters.size >= 3 && valueParameters[1].isKProperty INVOKE == name -> isMemberOrExtension CONTAINS == name -> singleValueParameter && noDefaultsAndVarargs && returnsBoolean @@ -100,8 +102,11 @@ object OperatorChecks { } } - private val ValueParameterDescriptor.isPropertyMetadata: Boolean - get() = builtIns.propertyMetadata.defaultType.isSubtypeOf(type.makeNotNullable()) + private val ValueParameterDescriptor.isKProperty: Boolean + get() { + val kProperty = module.findClassAcrossModuleDependencies(ClassId.topLevel(FqName("kotlin.reflect.KProperty"))) + return kProperty!!.defaultType.isSubtypeOf(type.makeNotNullable()) + } private val FunctionDescriptor.isMember: Boolean get() = containingDeclaration is ClassDescriptor diff --git a/core/runtime.jvm/src/kotlin/PropertyMetadataImpl.kt b/core/runtime.jvm/src/kotlin/PropertyMetadataImpl.kt new file mode 100644 index 00000000000..e5e35f183fe --- /dev/null +++ b/core/runtime.jvm/src/kotlin/PropertyMetadataImpl.kt @@ -0,0 +1,20 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package kotlin + +@Deprecated("Please use KProperty instead.") +data class PropertyMetadataImpl(override val name: String) : PropertyMetadata diff --git a/idea/idea-completion/testData/basic/java/PropertyMetadata.kt b/idea/idea-completion/testData/basic/java/PropertyMetadata.kt index 552adec6947..d26413d435a 100644 --- a/idea/idea-completion/testData/basic/java/PropertyMetadata.kt +++ b/idea/idea-completion/testData/basic/java/PropertyMetadata.kt @@ -7,4 +7,3 @@ fun firstFun() { // INVOCATION_COUNT: 1 // EXIST: { lookupString:"PropertyMetadata", itemText:"PropertyMetadata", tailText:" (kotlin)" } -// EXIST: { lookupString:"PropertyMetadataImpl", itemText:"PropertyMetadataImpl", tailText:" (kotlin)" } \ No newline at end of file diff --git a/idea/testData/javaFacade/ea46019.kt b/idea/testData/javaFacade/ea46019.kt index 635691a7a5a..1348cf1b83c 100644 --- a/idea/testData/javaFacade/ea46019.kt +++ b/idea/testData/javaFacade/ea46019.kt @@ -1,7 +1,9 @@ +import kotlin.reflect.KProperty + class SomeProp() { - fun getValue(t: Any, metadata: PropertyMetadataImpl) = 42 + fun getValue(t: Any, metadata: KProperty<*>) = 42 } class Some() { val renderer by SomeProp() -} \ No newline at end of file +} diff --git a/js/js.translator/src/org/jetbrains/kotlin/js/translate/declaration/PropertyTranslator.kt b/js/js.translator/src/org/jetbrains/kotlin/js/translate/declaration/PropertyTranslator.kt index 36d55ffa741..161df7bd0d8 100644 --- a/js/js.translator/src/org/jetbrains/kotlin/js/translate/declaration/PropertyTranslator.kt +++ b/js/js.translator/src/org/jetbrains/kotlin/js/translate/declaration/PropertyTranslator.kt @@ -19,17 +19,23 @@ package org.jetbrains.kotlin.js.translate.declaration.propertyTranslator import com.google.dart.compiler.backend.js.ast.* import com.intellij.util.SmartList import org.jetbrains.kotlin.descriptors.* -import org.jetbrains.kotlin.psi.JetProperty -import org.jetbrains.kotlin.psi.JetPropertyAccessor -import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.js.translate.callTranslator.CallTranslator +import org.jetbrains.kotlin.js.translate.context.Namer +import org.jetbrains.kotlin.js.translate.context.Namer.getDelegateNameRef +import org.jetbrains.kotlin.js.translate.context.Namer.getReceiverParameterName import org.jetbrains.kotlin.js.translate.context.TranslationContext import org.jetbrains.kotlin.js.translate.general.AbstractTranslator import org.jetbrains.kotlin.js.translate.general.Translation import org.jetbrains.kotlin.js.translate.utils.JsDescriptorUtils -import org.jetbrains.kotlin.js.translate.context.Namer.* -import org.jetbrains.kotlin.js.translate.utils.jsAstUtils.* -import org.jetbrains.kotlin.js.translate.utils.TranslationUtils.* +import org.jetbrains.kotlin.js.translate.utils.TranslationUtils.assignmentToBackingField +import org.jetbrains.kotlin.js.translate.utils.TranslationUtils.backingFieldReference +import org.jetbrains.kotlin.js.translate.utils.TranslationUtils.translateFunctionAsEcma5PropertyDescriptor +import org.jetbrains.kotlin.js.translate.utils.jsAstUtils.addParameter +import org.jetbrains.kotlin.js.translate.utils.jsAstUtils.addStatement +import org.jetbrains.kotlin.psi.JetProperty +import org.jetbrains.kotlin.psi.JetPropertyAccessor +import org.jetbrains.kotlin.resolve.BindingContext +import org.jetbrains.kotlin.resolve.calls.model.ExpressionValueArgument import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall import org.jetbrains.kotlin.resolve.descriptorUtil.isExtension @@ -135,7 +141,9 @@ private class PropertyTranslator( val function = JsFunction(scope, JsBlock(), accessorDescription(getterDescriptor)) val delegateRef = getDelegateNameRef(propertyName) - val delegatedJsCall = CallTranslator.translate(context(), delegatedCall, delegateRef) + val delegatedJsCall = CallTranslator.translate( + contextWithPropertyMetadataCreationIntrinsified(context(), delegatedCall, getterDescriptor), delegatedCall, delegateRef + ) if (getterDescriptor.isExtension) { val receiver = function.addParameter(getReceiverParameterName()).getName() @@ -148,6 +156,18 @@ private class PropertyTranslator( return function } + private fun contextWithPropertyMetadataCreationIntrinsified( + context: TranslationContext, delegatedCall: ResolvedCall, accessor: PropertyAccessorDescriptor + ): TranslationContext { + val propertyNameLiteral = context.program().getStringLiteral(accessor.correspondingProperty.name.asString()) + // 0th argument is instance, 1st is KProperty, 2nd (for setter) is value + val fakeArgumentExpression = + (delegatedCall.valueArgumentsByIndex!![1] as ExpressionValueArgument).valueArgument!!.getArgumentExpression() + return context.innerContextWithAliasesForExpressions(mapOf( + fakeArgumentExpression to JsNew(JsNameRef("PropertyMetadata", Namer.KOTLIN_NAME), listOf(propertyNameLiteral)) + )) + } + private fun generateDefaultSetter(): JsPropertyInitializer { val setterDescriptor = descriptor.getSetter() ?: throw IllegalStateException("Setter descriptor should not be null") return generateDefaultAccessor(setterDescriptor, generateDefaultSetterFunction(setterDescriptor)) @@ -164,14 +184,18 @@ private class PropertyTranslator( val delegatedCall = context().bindingContext().get(BindingContext.DELEGATED_PROPERTY_RESOLVED_CALL, setterDescriptor) if (delegatedCall != null) { - val delegatedJsCall = CallTranslator.translate(withAliased, delegatedCall, getDelegateNameRef(correspondingPropertyName)) + val delegatedJsCall = CallTranslator.translate( + contextWithPropertyMetadataCreationIntrinsified(withAliased, delegatedCall, setterDescriptor), + delegatedCall, getDelegateNameRef(correspondingPropertyName) + ) function.addStatement(delegatedJsCall.makeStmt()) if (setterDescriptor.isExtension) { val receiver = function.addParameter(getReceiverParameterName(), 0).getName() (delegatedJsCall as JsInvocation).getArguments().set(0, receiver.makeRef()) } - } else { + } + else { assert(!descriptor.isExtension) { "Unexpected extension property $descriptor}" } val assignment = assignmentToBackingField(withAliased, descriptor, valueParameter.makeRef()) function.addStatement(assignment.makeStmt()) diff --git a/js/js.translator/src/org/jetbrains/kotlin/js/translate/intrinsic/functions/factories/TopLevelFIF.java b/js/js.translator/src/org/jetbrains/kotlin/js/translate/intrinsic/functions/factories/TopLevelFIF.java index 86637b3e73f..b3e1716c878 100644 --- a/js/js.translator/src/org/jetbrains/kotlin/js/translate/intrinsic/functions/factories/TopLevelFIF.java +++ b/js/js.translator/src/org/jetbrains/kotlin/js/translate/intrinsic/functions/factories/TopLevelFIF.java @@ -130,17 +130,6 @@ public final class TopLevelFIF extends CompositeFIF { } }; - private static final FunctionIntrinsic PROPERTY_METADATA_IMPL = new FunctionIntrinsic() { - @NotNull - @Override - public JsExpression apply( - @Nullable JsExpression receiver, @NotNull List arguments, @NotNull TranslationContext context - ) { - JsNameRef functionRef = new JsNameRef("PropertyMetadata", Namer.KOTLIN_NAME); - return new JsNew(functionRef, arguments); - } - }; - @NotNull public static final KotlinFunctionIntrinsic TO_STRING = new KotlinFunctionIntrinsic("toString"); @@ -156,7 +145,6 @@ public final class TopLevelFIF extends CompositeFIF { add(pattern(NamePredicate.PRIMITIVE_NUMBERS, "equals"), KOTLIN_EQUALS); add(pattern("String|Boolean|Char|Number.equals"), KOTLIN_EQUALS); add(pattern("kotlin", "arrayOfNulls"), new KotlinFunctionIntrinsic("nullArray")); - add(pattern("kotlin", "PropertyMetadataImpl", ""), PROPERTY_METADATA_IMPL); add(pattern("kotlin", "iterator").isExtensionOf("kotlin.Iterator"), RETURN_RECEIVER_INTRINSIC); add(pattern("kotlin", "Map", "get").checkOverridden(), NATIVE_MAP_GET);