Add test for KT-40412

This commit is contained in:
Roman Artemev
2020-11-11 14:33:26 +03:00
parent 116606ecd2
commit 01f3c06ec9
8 changed files with 63 additions and 0 deletions
@@ -10028,6 +10028,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/delegatedProperty/extensionPropertyAndExtensionGetValue.kt");
}
@TestMetadata("functionRefDelefate.kt")
public void testFunctionRefDelefate() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/functionRefDelefate.kt");
}
@TestMetadata("genericDelegate.kt")
public void testGenericDelegate() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/genericDelegate.kt");
@@ -0,0 +1,28 @@
// KT-40412
// WITH_RUNTIME
// MODULE: lib
// FILE: lib.kt
import kotlin.properties.ReadOnlyProperty
import kotlin.reflect.KProperty
var result = "FAIL"
class CaptureContext<A>(val capture: (A) -> Unit) : ReadOnlyProperty<A, () -> Unit> {
override fun getValue(thisRef: A, property: KProperty<*>) = { -> capture(thisRef) }
}
operator fun <A> ((A) -> Unit).provideDelegate(thisRef: A, property: KProperty<*>) = CaptureContext(this)
fun right(arg: Right) { result = "OK" }
class Right { val prop: () -> Unit by ::right }
// MODULE: main(lib)
// FILE: main.kt
fun box(): String {
val r = Right()
r.prop()
return result
}
@@ -11428,6 +11428,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/delegatedProperty/extensionPropertyAndExtensionGetValue.kt");
}
@TestMetadata("functionRefDelefate.kt")
public void testFunctionRefDelefate() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/functionRefDelefate.kt");
}
@TestMetadata("genericDelegate.kt")
public void testGenericDelegate() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/genericDelegate.kt");
@@ -11433,6 +11433,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/delegatedProperty/extensionPropertyAndExtensionGetValue.kt");
}
@TestMetadata("functionRefDelefate.kt")
public void testFunctionRefDelefate() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/functionRefDelefate.kt");
}
@TestMetadata("genericDelegate.kt")
public void testGenericDelegate() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/genericDelegate.kt");
@@ -10028,6 +10028,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/delegatedProperty/extensionPropertyAndExtensionGetValue.kt");
}
@TestMetadata("functionRefDelefate.kt")
public void testFunctionRefDelefate() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/functionRefDelefate.kt");
}
@TestMetadata("genericDelegate.kt")
public void testGenericDelegate() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/genericDelegate.kt");
@@ -8543,6 +8543,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
runTest("compiler/testData/codegen/box/delegatedProperty/extensionPropertyAndExtensionGetValue.kt");
}
@TestMetadata("functionRefDelefate.kt")
public void testFunctionRefDelefate() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/functionRefDelefate.kt");
}
@TestMetadata("genericDelegate.kt")
public void testGenericDelegate() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/genericDelegate.kt");
@@ -8543,6 +8543,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/delegatedProperty/extensionPropertyAndExtensionGetValue.kt");
}
@TestMetadata("functionRefDelefate.kt")
public void testFunctionRefDelefate() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/functionRefDelefate.kt");
}
@TestMetadata("genericDelegate.kt")
public void testGenericDelegate() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/genericDelegate.kt");
@@ -8543,6 +8543,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/delegatedProperty/extensionPropertyAndExtensionGetValue.kt");
}
@TestMetadata("functionRefDelefate.kt")
public void testFunctionRefDelefate() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/functionRefDelefate.kt");
}
@TestMetadata("genericDelegate.kt")
public void testGenericDelegate() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/genericDelegate.kt");