FIR: Add test
This commit is contained in:
committed by
teamcity
parent
2338281889
commit
a4df0aaa7d
+12
@@ -4949,6 +4949,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationArgumentMapping.kt")
|
||||
public void testAnnotationArgumentMapping() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/annotationArgumentMapping.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("anonymousInDelegate.kt")
|
||||
public void testAnonymousInDelegate() throws Exception {
|
||||
@@ -4997,6 +5003,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/propertyWithFunctionalType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sequentialLazy.kt")
|
||||
public void testSequentialLazy() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/sequentialLazy.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simpleDelegateProvider.kt")
|
||||
public void testSimpleDelegateProvider() throws Exception {
|
||||
|
||||
Vendored
+66
@@ -0,0 +1,66 @@
|
||||
FILE: annotationArgumentMapping.kt
|
||||
public final class FirAnnotationArgumentMappingBuilder : R|kotlin/Any| {
|
||||
public constructor(): R|FirAnnotationArgumentMappingBuilder| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val mapping: R|kotlin/collections/MutableMap<kotlin/String, kotlin/String>| = R|kotlin/collections/mutableMapOf|<R|kotlin/String|, R|kotlin/String|>()
|
||||
public get(): R|kotlin/collections/MutableMap<kotlin/String, kotlin/String>|
|
||||
|
||||
public final fun build(): R|FirAnnotationArgumentMapping| {
|
||||
^build R|/FirAnnotationArgumentMapping.FirAnnotationArgumentMapping|(this@R|/FirAnnotationArgumentMappingBuilder|.R|/FirAnnotationArgumentMappingBuilder.mapping|)
|
||||
}
|
||||
|
||||
}
|
||||
public final fun buildAnnotationArgumentMapping(init: R|FirAnnotationArgumentMappingBuilder.() -> kotlin/Unit|): R|FirAnnotationArgumentMapping|
|
||||
[R|Contract description]
|
||||
<
|
||||
CallsInPlace(init, EXACTLY_ONCE)
|
||||
>
|
||||
{
|
||||
[StubStatement]
|
||||
^buildAnnotationArgumentMapping R|/FirAnnotationArgumentMappingBuilder.FirAnnotationArgumentMappingBuilder|().R|kotlin/apply|<R|FirAnnotationArgumentMappingBuilder|>(R|<local>/init|).R|/FirAnnotationArgumentMappingBuilder.build|()
|
||||
}
|
||||
public final class FirAnnotationArgumentMapping : R|kotlin/Any| {
|
||||
public constructor(mapping: R|kotlin/collections/Map<kotlin/String, kotlin/String>|): R|FirAnnotationArgumentMapping| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final class ValueParameter : R|kotlin/Any| {
|
||||
public constructor(name: R|kotlin/String|): R|ValueParameter| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val name: R|kotlin/String| = R|<local>/name|
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
}
|
||||
public final class Argument : R|kotlin/Any| {
|
||||
public constructor(name: R|kotlin/String|): R|Argument| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val name: R|kotlin/String| = R|<local>/name|
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
}
|
||||
public final fun createArgumentMapping(valueParameters: R|kotlin/collections/List<ValueParameter>?|, arguments: R|kotlin/collections/List<Argument>|): R|FirAnnotationArgumentMapping| {
|
||||
^createArgumentMapping R|/buildAnnotationArgumentMapping|(<L> = build@fun R|FirAnnotationArgumentMappingBuilder|.<anonymous>(): R|kotlin/Unit| <inline=NoInline, kind=EXACTLY_ONCE> {
|
||||
lval parameterByName: R|kotlin/collections/Map<kotlin/String, ValueParameter>?|by R|kotlin/lazy|<R|kotlin/collections/Map<kotlin/String, ValueParameter>?|>(<L> = lazy@fun <anonymous>(): R|kotlin/collections/Map<kotlin/String, ValueParameter>?| <inline=NoInline> {
|
||||
lval valueParameters: R|kotlin/collections/List<ValueParameter>| = R|<local>/valueParameters| ?: ^@lazy Null(null)
|
||||
^ R|<local>/valueParameters|.R|kotlin/collections/associateBy|<R|ValueParameter|, R|kotlin/String|>(<L> = associateBy@fun <anonymous>(it: R|ValueParameter|): R|kotlin/String| <inline=Inline, kind=UNKNOWN> {
|
||||
^ R|<local>/it|.R|/ValueParameter.name|
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
R|<local>/arguments|.R|kotlin/collections/mapNotNull|<R|Argument|, R|kotlin/Pair<kotlin/String, kotlin/String>|>(<L> = mapNotNull@fun <anonymous>(it: R|Argument|): R|kotlin/Pair<kotlin/String, kotlin/String>?| <inline=Inline, kind=UNKNOWN> {
|
||||
lval name: R|kotlin/String| = R|<local>/it|.R|/Argument.name|
|
||||
lval value: R|kotlin/String| = R|<local>/parameterByName|?.{ $subj$.R|SubstitutionOverride<kotlin/collections/Map.get: R|ValueParameter?|>|(R|<local>/name|) }?.{ $subj$.R|/ValueParameter.name| } ?: ^@mapNotNull Null(null)
|
||||
^ R|<local>/name|.R|kotlin/to|<R|kotlin/String|, R|kotlin/String|>(R|<local>/value|)
|
||||
}
|
||||
).R|kotlin/collections/toMap|<R|kotlin/String|, R|kotlin/String|, R|kotlin/collections/MutableMap<kotlin/String, kotlin/String>|>(this@R|special/anonymous|.R|/FirAnnotationArgumentMappingBuilder.mapping|)
|
||||
}
|
||||
)
|
||||
}
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
import kotlin.contracts.*
|
||||
|
||||
class FirAnnotationArgumentMappingBuilder {
|
||||
val mapping: MutableMap<String, String> = mutableMapOf()
|
||||
|
||||
fun build(): FirAnnotationArgumentMapping {
|
||||
return FirAnnotationArgumentMapping(mapping)
|
||||
}
|
||||
}
|
||||
|
||||
fun buildAnnotationArgumentMapping(init: FirAnnotationArgumentMappingBuilder.() -> Unit): FirAnnotationArgumentMapping {
|
||||
contract {
|
||||
callsInPlace(init, InvocationKind.EXACTLY_ONCE)
|
||||
}
|
||||
return FirAnnotationArgumentMappingBuilder().apply(init).build()
|
||||
}
|
||||
|
||||
class FirAnnotationArgumentMapping(mapping: Map<String, String>)
|
||||
|
||||
class ValueParameter(val name: String)
|
||||
class Argument(val name: String)
|
||||
|
||||
fun createArgumentMapping(
|
||||
valueParameters: List<ValueParameter>?,
|
||||
arguments: List<Argument>
|
||||
): FirAnnotationArgumentMapping {
|
||||
return buildAnnotationArgumentMapping build@{
|
||||
val parameterByName: Map<String, ValueParameter>? by lazy {
|
||||
val valueParameters = valueParameters ?: return@lazy null
|
||||
valueParameters.associateBy { it.name }
|
||||
}
|
||||
|
||||
arguments.mapNotNull {
|
||||
val name = it.name
|
||||
val value = parameterByName?.get(name)?.name ?: return@mapNotNull null
|
||||
name to value
|
||||
}.toMap(mapping)
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
FILE: sequentialLazy.kt
|
||||
public final class Some : R|kotlin/Any| {
|
||||
public constructor(classNames: R|() -> kotlin/collections/Collection<kotlin/String>|): R|Some| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
internal final val first: R|kotlin/collections/Set<kotlin/String>|by R|kotlin/lazy|<R|kotlin/collections/Set<kotlin/String>|>(<L> = lazy@fun <anonymous>(): R|kotlin/collections/Set<kotlin/String>| <inline=NoInline> {
|
||||
^ R|<local>/classNames|.R|SubstitutionOverride<kotlin/Function0.invoke: R|kotlin/collections/Collection<kotlin/String>|>|().R|kotlin/collections/toSet|<R|kotlin/String|>()
|
||||
}
|
||||
)
|
||||
internal get(): R|kotlin/collections/Set<kotlin/String>| {
|
||||
^ this@R|/Some|.D|/Some.first|.R|kotlin/getValue|<R|kotlin/collections/Set<kotlin/String>|>(this@R|/Some|, ::R|/Some.first|)
|
||||
}
|
||||
|
||||
private final val second: R|kotlin/collections/Set<kotlin/String>?|by R|kotlin/lazy|<R|kotlin/collections/Set<kotlin/String>?|>(<L> = lazy@fun <anonymous>(): R|kotlin/collections/Set<kotlin/String>?| <inline=NoInline> {
|
||||
lval nonDeclaredNames: R|kotlin/collections/Set<kotlin/String>| = this@R|/Some|.R|/Some.getNonDeclaredClassifierNames|() ?: ^@lazy Null(null)
|
||||
lval allNames: R|kotlin/collections/Set<kotlin/String>| = this@R|/Some|.R|/Some.first|.R|kotlin/collections/plus|<R|kotlin/String|>(R|<local>/nonDeclaredNames|)
|
||||
^ R|<local>/allNames|
|
||||
}
|
||||
)
|
||||
private get(): R|kotlin/collections/Set<kotlin/String>?| {
|
||||
^ this@R|/Some|.D|/Some.second|.R|kotlin/getValue|<R|kotlin/collections/Set<kotlin/String>?|>(this@R|/Some|, ::R|/Some.second|)
|
||||
}
|
||||
|
||||
public final fun getNonDeclaredClassifierNames(): R|kotlin/collections/Set<kotlin/String>?| {
|
||||
^getNonDeclaredClassifierNames Null(null)
|
||||
}
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
class Some(classNames: () -> Collection<String>) {
|
||||
internal val first by lazy {
|
||||
classNames().toSet()
|
||||
}
|
||||
|
||||
private val second by lazy {
|
||||
val nonDeclaredNames = getNonDeclaredClassifierNames() ?: return@lazy null
|
||||
val allNames = first + nonDeclaredNames
|
||||
allNames
|
||||
}
|
||||
|
||||
fun getNonDeclaredClassifierNames(): Set<String>? = null
|
||||
}
|
||||
+12
@@ -4949,6 +4949,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationArgumentMapping.kt")
|
||||
public void testAnnotationArgumentMapping() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/annotationArgumentMapping.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("anonymousInDelegate.kt")
|
||||
public void testAnonymousInDelegate() throws Exception {
|
||||
@@ -4997,6 +5003,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/propertyWithFunctionalType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sequentialLazy.kt")
|
||||
public void testSequentialLazy() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/sequentialLazy.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simpleDelegateProvider.kt")
|
||||
public void testSimpleDelegateProvider() throws Exception {
|
||||
|
||||
+12
@@ -4949,6 +4949,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationArgumentMapping.kt")
|
||||
public void testAnnotationArgumentMapping() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/annotationArgumentMapping.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("anonymousInDelegate.kt")
|
||||
public void testAnonymousInDelegate() throws Exception {
|
||||
@@ -4997,6 +5003,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/propertyWithFunctionalType.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("sequentialLazy.kt")
|
||||
public void testSequentialLazy() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/sequentialLazy.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("simpleDelegateProvider.kt")
|
||||
public void testSimpleDelegateProvider() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user