FIR: Add test for get class + let in delegation

This commit is contained in:
Mikhail Glukhikh
2021-11-18 10:05:31 +03:00
committed by teamcity
parent 1c8b6dccff
commit 2338281889
6 changed files with 50 additions and 0 deletions
@@ -4967,6 +4967,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/delegateWithAnonymousObject.kt");
}
@Test
@TestMetadata("getClassLet.kt")
public void testGetClassLet() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/getClassLet.kt");
}
@Test
@TestMetadata("kt41917.kt")
public void testKt41917() throws Exception {
@@ -0,0 +1,20 @@
FILE: getClassLet.kt
public final class SomeClass : R|kotlin/Any| {
public constructor(): R|SomeClass| {
super<R|kotlin/Any|>()
}
}
public final inline fun <reified K> foo(klass: R|kotlin/reflect/KClass<*>|): R|K| {
^foo Null(null)!!
}
public final val some: R|kotlin/collections/Map<kotlin/String, kotlin/String>|by R|kotlin/lazy|<R|kotlin/collections/Map<kotlin/String, kotlin/String>|>(<L> = lazy@fun <anonymous>(): R|kotlin/collections/Map<kotlin/String, kotlin/String>| <inline=NoInline> {
^ <getClass>(Q|SomeClass|).R|kotlin/let|<R|kotlin/reflect/KClass<SomeClass>|, R|kotlin/collections/Map<kotlin/String, kotlin/String>|>(<L> = let@fun <anonymous>(it: R|kotlin/reflect/KClass<SomeClass>|): R|kotlin/collections/Map<kotlin/String, kotlin/String>| <inline=Inline, kind=EXACTLY_ONCE> {
^ R|/foo|<R|kotlin/collections/Map<kotlin/String, kotlin/String>|>(R|<local>/it|)
}
)
}
)
public get(): R|kotlin/collections/Map<kotlin/String, kotlin/String>| {
^ D|/some|.R|kotlin/getValue|<R|kotlin/collections/Map<kotlin/String, kotlin/String>|>(Null(null), ::R|/some|)
}
@@ -0,0 +1,11 @@
import kotlin.reflect.KClass
class SomeClass
inline fun <reified K> foo(klass: KClass<*>): K = null!!
val some: Map<String, String> by lazy {
SomeClass::class.let {
foo(it)
}
}
@@ -4967,6 +4967,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/delegateWithAnonymousObject.kt");
}
@Test
@TestMetadata("getClassLet.kt")
public void testGetClassLet() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/getClassLet.kt");
}
@Test
@TestMetadata("kt41917.kt")
public void testKt41917() throws Exception {
@@ -4967,6 +4967,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/delegateWithAnonymousObject.kt");
}
@Test
@TestMetadata("getClassLet.kt")
public void testGetClassLet() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/getClassLet.kt");
}
@Test
@TestMetadata("kt41917.kt")
public void testKt41917() throws Exception {
@@ -1,4 +1,5 @@
// !LANGUAGE: +UnrestrictedBuilderInference
// IGNORE_BACKEND_FIR: JVM_IR
// FIR status: NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER on lazy call (Name3, T)
// WITH_STDLIB