Add test for generic setValue called via synthetic accessor
Synthetic accessor for 'setValue' was generated incorrectly, specific case of KT-20491 (Incorrect synthetic accessor generated for a generic base class function specialized with primitive type). Make sure there's no equivalent of KT-20387 for delegated properties.
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
|||||||
|
// FILE: Var.kt
|
||||||
|
package pvar
|
||||||
|
|
||||||
|
open class PVar<T>(private var value: T) {
|
||||||
|
protected operator fun getValue(thisRef: Any?, prop: Any?) = value
|
||||||
|
|
||||||
|
protected operator fun setValue(thisRef: Any?, prop: Any?, newValue: T) {
|
||||||
|
value = newValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: test.kt
|
||||||
|
import pvar.*
|
||||||
|
|
||||||
|
class C : PVar<Long>(42L) {
|
||||||
|
inner class Inner {
|
||||||
|
var x by this@C
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val inner = C().Inner()
|
||||||
|
inner.x = 1L
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+6
@@ -6923,6 +6923,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("genericSetValueViaSyntheticAccessor.kt")
|
||||||
|
public void testGenericSetValueViaSyntheticAccessor() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/genericSetValueViaSyntheticAccessor.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("getAsExtensionFun.kt")
|
@TestMetadata("getAsExtensionFun.kt")
|
||||||
public void testGetAsExtensionFun() throws Exception {
|
public void testGetAsExtensionFun() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/getAsExtensionFun.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/getAsExtensionFun.kt");
|
||||||
|
|||||||
@@ -6923,6 +6923,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("genericSetValueViaSyntheticAccessor.kt")
|
||||||
|
public void testGenericSetValueViaSyntheticAccessor() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/genericSetValueViaSyntheticAccessor.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("getAsExtensionFun.kt")
|
@TestMetadata("getAsExtensionFun.kt")
|
||||||
public void testGetAsExtensionFun() throws Exception {
|
public void testGetAsExtensionFun() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/getAsExtensionFun.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/getAsExtensionFun.kt");
|
||||||
|
|||||||
@@ -6923,6 +6923,12 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("genericSetValueViaSyntheticAccessor.kt")
|
||||||
|
public void testGenericSetValueViaSyntheticAccessor() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/genericSetValueViaSyntheticAccessor.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("getAsExtensionFun.kt")
|
@TestMetadata("getAsExtensionFun.kt")
|
||||||
public void testGetAsExtensionFun() throws Exception {
|
public void testGetAsExtensionFun() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/getAsExtensionFun.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/getAsExtensionFun.kt");
|
||||||
|
|||||||
@@ -7619,6 +7619,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("genericSetValueViaSyntheticAccessor.kt")
|
||||||
|
public void testGenericSetValueViaSyntheticAccessor() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/genericSetValueViaSyntheticAccessor.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("getAsExtensionFun.kt")
|
@TestMetadata("getAsExtensionFun.kt")
|
||||||
public void testGetAsExtensionFun() throws Exception {
|
public void testGetAsExtensionFun() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/getAsExtensionFun.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/getAsExtensionFun.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user