FIR: Add simple test on SAM conversion for callable receivers

^KT-32725 In Progress
This commit is contained in:
Denis Zharkov
2019-10-22 12:51:19 +03:00
parent 7feb1aecfe
commit af72cea8b3
3 changed files with 39 additions and 0 deletions
@@ -0,0 +1,14 @@
interface MySam {
fun run(x: String): Int
}
class A {
fun bar(x: String): Int {}
}
fun foo(x: MySam) {}
fun main() {
val a = A()
foo(a::bar)
}
@@ -0,0 +1,20 @@
FILE: sam.kt
public abstract interface MySam : R|kotlin/Any| {
public abstract fun run(x: R|kotlin/String|): R|kotlin/Int|
}
public final class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
public final fun bar(x: R|kotlin/String|): R|kotlin/Int| {
}
}
public final fun foo(x: R|MySam|): R|kotlin/Unit| {
}
public final fun main(): R|kotlin/Unit| {
lval a: R|A| = R|/A.A|()
R|/foo|(R|<local>/a|::R|/A.bar|)
}
@@ -100,6 +100,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
runTest("compiler/fir/resolve/testData/diagnostics/callableReferences/properties.kt");
}
@TestMetadata("sam.kt")
public void testSam() throws Exception {
runTest("compiler/fir/resolve/testData/diagnostics/callableReferences/sam.kt");
}
@TestMetadata("simpleClassReceiver.kt")
public void testSimpleClassReceiver() throws Exception {
runTest("compiler/fir/resolve/testData/diagnostics/callableReferences/simpleClassReceiver.kt");