[FIR TEST] Add test with incorrect invoke receiver

This commit is contained in:
Mikhail Glukhikh
2019-12-24 18:38:19 +03:00
parent a8a50fa657
commit 20fee028f9
4 changed files with 28 additions and 0 deletions
@@ -0,0 +1,8 @@
fun String.invoke() = this
val some = ""
fun sss() {
val some = 10
<!INAPPLICABLE_CANDIDATE!>some<!>() // Should be inapplicable
}
@@ -0,0 +1,10 @@
FILE: incorrectInvokeReceiver.kt
public final fun R|kotlin/String|.invoke(): R|kotlin/String| {
^invoke this@R|/invoke|
}
public final val some: R|kotlin/String| = String()
public get(): R|kotlin/String|
public final fun sss(): R|kotlin/Unit| {
lval some: R|kotlin/Int| = Int(10)
<Inapplicable(WRONG_RECEIVER): [/invoke]>#()
}
@@ -684,6 +684,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
runTest("compiler/fir/resolve/testData/resolve/expresssions/invoke/inBrackets.kt");
}
@TestMetadata("incorrectInvokeReceiver.kt")
public void testIncorrectInvokeReceiver() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/expresssions/invoke/incorrectInvokeReceiver.kt");
}
@TestMetadata("propertyFromParameter.kt")
public void testPropertyFromParameter() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/expresssions/invoke/propertyFromParameter.kt");
@@ -684,6 +684,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
runTest("compiler/fir/resolve/testData/resolve/expresssions/invoke/inBrackets.kt");
}
@TestMetadata("incorrectInvokeReceiver.kt")
public void testIncorrectInvokeReceiver() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/expresssions/invoke/incorrectInvokeReceiver.kt");
}
@TestMetadata("propertyFromParameter.kt")
public void testPropertyFromParameter() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/expresssions/invoke/propertyFromParameter.kt");