[FIR-TEST] Add test with hiding local functions

This commit is contained in:
Dmitriy Novozhilov
2019-11-26 15:33:22 +03:00
parent 5d14c76f70
commit 96d3a06129
3 changed files with 58 additions and 0 deletions
@@ -0,0 +1,23 @@
interface A {
val x: Int
}
fun test_1() {
fun Int.transform(): Int = 1
fun A.transform(): Int {
return x.<!INAPPLICABLE_CANDIDATE!>transform<!>()
}
val y = 1
y.<!INAPPLICABLE_CANDIDATE!>transform<!>()
}
fun test_2() {
fun Int.transform(): Int = 1
fun A.transformX(): Int {
return x.transform()
}
val y = 1
y.transform()
}
@@ -0,0 +1,30 @@
FILE: localFunctionsHiding.kt
public abstract interface A : R|kotlin/Any| {
public abstract val x: R|kotlin/Int|
public get(): R|kotlin/Int|
}
public final fun test_1(): R|kotlin/Unit| {
local final fun R|kotlin/Int|.transform(): R|kotlin/Int| {
^transform Int(1)
}
local final fun R|A|.transform(): R|kotlin/Int| {
^transform this@R|/A|.R|/A.x|.<Inapplicable(WRONG_RECEIVER): [<local>/transform]>#()
}
lval y: R|kotlin/Int| = Int(1)
R|<local>/y|.<Inapplicable(WRONG_RECEIVER): [<local>/transform]>#()
}
public final fun test_2(): R|kotlin/Unit| {
local final fun R|kotlin/Int|.transform(): R|kotlin/Int| {
^transform Int(1)
}
local final fun R|A|.transformX(): R|kotlin/Int| {
^transformX this@R|/A|.R|/A.x|.R|<local>/transform|()
}
lval y: R|kotlin/Int| = Int(1)
R|<local>/y|.R|<local>/transform|()
}
@@ -878,6 +878,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
runTest("compiler/fir/resolve/testData/resolve/problems/javaAccessorConversion.kt");
}
@TestMetadata("localFunctionsHiding.kt")
public void testLocalFunctionsHiding() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/localFunctionsHiding.kt");
}
@TestMetadata("nestedClassContructor.kt")
public void testNestedClassContructor() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/nestedClassContructor.kt");