[FIR-TEST] Add test with hiding local functions
This commit is contained in:
@@ -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|()
|
||||
}
|
||||
+5
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user