[FIR TEST] Add problematic test describing KT-36881

This commit is contained in:
Mikhail Glukhikh
2020-02-20 17:37:09 +03:00
parent 018cfc7df6
commit ace5d0357c
4 changed files with 53 additions and 0 deletions
@@ -0,0 +1,10 @@
class Some
fun foo(): () -> Boolean {
val s = Some()
if (true) {
return { if (s is Some) true else false }
} else {
return { true }
}
}
@@ -0,0 +1,33 @@
FILE: typesInLocalFunctions.kt
public final class Some : R|kotlin/Any| {
public constructor(): R|Some| {
super<R|kotlin/Any|>()
}
}
public final fun foo(): R|() -> kotlin/Boolean| {
lval s: R|Some| = R|/Some.Some|()
when () {
Boolean(true) -> {
^foo fun <implicit>.<anonymous>(): <implicit> {
when () {
(s# is Some) -> {
Boolean(true)
}
else -> {
Boolean(false)
}
}
}
}
else -> {
^foo fun <implicit>.<anonymous>(): <implicit> {
Boolean(true)
}
}
}
}
@@ -1303,6 +1303,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
public void testJavaAccessorConversion() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/javaAccessorConversion.kt");
}
@TestMetadata("typesInLocalFunctions.kt")
public void testTypesInLocalFunctions() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/typesInLocalFunctions.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/references")
@@ -1303,6 +1303,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
public void testJavaAccessorConversion() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/javaAccessorConversion.kt");
}
@TestMetadata("typesInLocalFunctions.kt")
public void testTypesInLocalFunctions() throws Exception {
runTest("compiler/fir/resolve/testData/resolve/problems/typesInLocalFunctions.kt");
}
}
@TestMetadata("compiler/fir/resolve/testData/resolve/references")