From 4ed7504d8796f4b0f259998679e713a66983466c Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 16 Oct 2023 13:33:35 +0200 Subject: [PATCH] FIR deserializer: apply attributes on type parameter-based types #KT-62578 Fixed --- .../StubBasedFirTypeDeserializer.kt | 2 +- .../delegates/delegateTypeMismatch.fir.txt | 2 +- .../j+k/SyntheticAfterFiltering.fir.txt | 2 +- .../withInInitializer.fir.txt | 6 +-- .../deserialization/FirTypeDeserializer.kt | 2 +- ...LightTreeBlackBoxCodegenTestGenerated.java | 6 +++ ...hIrFakeOverrideGeneratorTestGenerated.java | 6 +++ .../FirPsiBlackBoxCodegenTestGenerated.java | 6 +++ compiler/testData/codegen/box/fir/noInfer.kt | 39 +++++++++++++++++++ .../dynamicTypes/setOperatorOnDynamic.fir.txt | 2 +- .../fromKEEP/monoidSum.fir.ir.txt | 12 +++--- .../fromKEEP/monoidSum.fir.kt.txt | 2 +- .../declarations/delegatedProperties.fir.txt | 14 +++---- .../types/SupertypesAndBounds.fir.k1.jvm.txt | 2 +- .../types/SupertypesAndBounds.fir.k2.jvm.txt | 2 +- .../types/SupertypesAndBounds.fir.k2.klib.txt | 2 +- .../IrBlackBoxCodegenTestGenerated.java | 6 +++ ...kBoxCodegenWithIrInlinerTestGenerated.java | 6 +++ .../LightAnalysisModeTestGenerated.java | 5 +++ .../firMembers/metaSerializable.fir.txt | 18 ++++----- 20 files changed, 108 insertions(+), 34 deletions(-) create mode 100644 compiler/testData/codegen/box/fir/noInfer.kt diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/stubBased/deserialization/StubBasedFirTypeDeserializer.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/stubBased/deserialization/StubBasedFirTypeDeserializer.kt index 6c7f246611e..37704117cb5 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/stubBased/deserialization/StubBasedFirTypeDeserializer.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/stubBased/deserialization/StubBasedFirTypeDeserializer.kt @@ -204,7 +204,7 @@ internal class StubBasedFirTypeDeserializer( val constructor = typeSymbol(typeReference) ?: return null val isNullable = typeReference.typeElement is KtNullableType if (constructor is ConeTypeParameterLookupTag) { - return ConeTypeParameterTypeImpl(constructor, isNullable = isNullable).let { + return ConeTypeParameterTypeImpl(constructor, isNullable = isNullable, attributes).let { if (typeReference.typeElement?.unwrapNullability() is KtIntersectionType) { ConeDefinitelyNotNullType.create(it, moduleData.session.typeContext, avoidComprehensiveCheck = true) ?: it } else it diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/delegateTypeMismatch.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/delegateTypeMismatch.fir.txt index 4f1cc3eed9f..4a53417f9c1 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/delegateTypeMismatch.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/delegateTypeMismatch.fir.txt @@ -19,7 +19,7 @@ FILE: delegateTypeMismatch.kt public get(): R|kotlin/Boolean| private final fun property(initialValue: R|T|): R|kotlin/properties/ReadWriteProperty| { - ^property Q|kotlin/properties/Delegates|.R|kotlin/properties/Delegates.vetoable|(R|/initialValue|, = vetoable@fun (: R|@R|kotlin/ParameterName|(name = String(property)) kotlin/reflect/KProperty<*>|, : R|T|, : R|T|): R|kotlin/Boolean| { + ^property Q|kotlin/properties/Delegates|.R|kotlin/properties/Delegates.vetoable|(R|/initialValue|, = vetoable@fun (: R|@R|kotlin/ParameterName|(name = String(property)) kotlin/reflect/KProperty<*>|, : R|@R|kotlin/ParameterName|(name = String(oldValue)) T|, : R|@R|kotlin/ParameterName|(name = String(newValue)) T|): R|kotlin/Boolean| { ^ when () { this@R|/A|.R|/A.isLocked| -> { throw R|java/lang/IllegalStateException.IllegalStateException|(String(Cannot modify readonly DescriptorRendererOptions)) diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/SyntheticAfterFiltering.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/SyntheticAfterFiltering.fir.txt index 7863851c251..c010c4bdbfe 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/SyntheticAfterFiltering.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/SyntheticAfterFiltering.fir.txt @@ -1,6 +1,6 @@ FILE: test.kt public final fun foo(tag: R|XmlTag|, name: R|kotlin/String|): R|kotlin/collections/List| { - lval result: R|kotlin/collections/List| = R|/tag|.R|/PsiElement.children|.R|kotlin/collections/filterIsInstance|().R|kotlin/collections/filter|( = filter@fun (it: R|XmlTag|): R|kotlin/Boolean| { + lval result: R|kotlin/collections/List<@NoInfer XmlTag>| = R|/tag|.R|/PsiElement.children|.R|kotlin/collections/filterIsInstance|().R|kotlin/collections/filter|( = filter@fun (it: R|@NoInfer XmlTag|): R|kotlin/Boolean| { ^ ==(R|/it|.R|/XmlTag.localName|, R|/name|) } ) diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/withInInitializer.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/withInInitializer.fir.txt index 4eb785a554e..e60cb9712a6 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/withInInitializer.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/withInInitializer.fir.txt @@ -19,13 +19,13 @@ FILE: withInInitializer.kt public final val data: R|First| = R|/First.First|(Int(42)) public get(): R|First| - public final val test: R|kotlin/collections/List| = R|kotlin/with||>(this@R|/Second|.R|/Second.data|, = with@fun R|First|.(): R|kotlin/collections/List| { - ^ this@R|/Second|.R|/Second.list|.R|kotlin/collections/filterIsInstance|().R|kotlin/collections/filter|( = filter@fun (it: R|kotlin/Int|): R|kotlin/Boolean| { + public final val test: R|kotlin/collections/List<@NoInfer kotlin/Int>| = R|kotlin/with||>(this@R|/Second|.R|/Second.data|, = with@fun R|First|.(): R|kotlin/collections/List<@NoInfer kotlin/Int>| { + ^ this@R|/Second|.R|/Second.list|.R|kotlin/collections/filterIsInstance|().R|kotlin/collections/filter|( = filter@fun (it: R|@NoInfer kotlin/Int|): R|kotlin/Boolean| { ^ ==(R|/it|, this@R|special/anonymous|.R|/First.member|) } ) } ) - public get(): R|kotlin/collections/List| + public get(): R|kotlin/collections/List<@NoInfer kotlin/Int>| } diff --git a/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/FirTypeDeserializer.kt b/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/FirTypeDeserializer.kt index 856271b3a41..776e318db23 100644 --- a/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/FirTypeDeserializer.kt +++ b/compiler/fir/fir-deserialization/src/org/jetbrains/kotlin/fir/deserialization/FirTypeDeserializer.kt @@ -164,7 +164,7 @@ class FirTypeDeserializer( private fun simpleType(proto: ProtoBuf.Type, attributes: ConeAttributes): ConeSimpleKotlinType? { val constructor = typeSymbol(proto) ?: return null if (constructor is ConeTypeParameterLookupTag) { - return ConeTypeParameterTypeImpl(constructor, isNullable = proto.nullable).let { + return ConeTypeParameterTypeImpl(constructor, isNullable = proto.nullable, attributes).let { if (Flags.DEFINITELY_NOT_NULL_TYPE.get(proto.flags)) ConeDefinitelyNotNullType.create(it, moduleData.session.typeContext, avoidComprehensiveCheck = true) ?: it else diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java index 786fb34e92b..f310e65f239 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java @@ -19161,6 +19161,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr runTest("compiler/testData/codegen/box/fir/nestedClassTypeParameterDeserialization.kt"); } + @Test + @TestMetadata("noInfer.kt") + public void testNoInfer() throws Exception { + runTest("compiler/testData/codegen/box/fir/noInfer.kt"); + } + @Test @TestMetadata("noSymbolForIntRangeIterator.kt") public void testNoSymbolForIntRangeIterator() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java index 425f6b7bf25..37d01cd18b7 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java @@ -19161,6 +19161,12 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated runTest("compiler/testData/codegen/box/fir/nestedClassTypeParameterDeserialization.kt"); } + @Test + @TestMetadata("noInfer.kt") + public void testNoInfer() throws Exception { + runTest("compiler/testData/codegen/box/fir/noInfer.kt"); + } + @Test @TestMetadata("noSymbolForIntRangeIterator.kt") public void testNoSymbolForIntRangeIterator() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java index 89793fae24c..71ffe95a435 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java @@ -19161,6 +19161,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo runTest("compiler/testData/codegen/box/fir/nestedClassTypeParameterDeserialization.kt"); } + @Test + @TestMetadata("noInfer.kt") + public void testNoInfer() throws Exception { + runTest("compiler/testData/codegen/box/fir/noInfer.kt"); + } + @Test @TestMetadata("noSymbolForIntRangeIterator.kt") public void testNoSymbolForIntRangeIterator() throws Exception { diff --git a/compiler/testData/codegen/box/fir/noInfer.kt b/compiler/testData/codegen/box/fir/noInfer.kt new file mode 100644 index 00000000000..3728e45fb6b --- /dev/null +++ b/compiler/testData/codegen/box/fir/noInfer.kt @@ -0,0 +1,39 @@ +// WITH_STDLIB +// TARGET_BACKEND: JVM_IR +// ISSUE: KT-62578 + +// MODULE: lib +// FILE: lib.kt +interface Base +class Derived : Base + +data class Box(val className: String) + +val emptyBox: Box + get() = Box("Nothing") + +@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") +inline fun foo(x: @kotlin.internal.NoInfer T): Box? { + val klass = T::class + return Box(klass.simpleName ?: "") +} + +fun test_1(): Box { + return foo(Derived()) ?: emptyBox +} + +// MODULE: main(lib) +// FILE: main.kt + +fun test_2(): Box { + return foo(Derived()) ?: emptyBox +} + +fun box(): String { + val expectedName = "Base" + val box1 = test_1() + if (box1.className != expectedName) return "Fail 1: $box1" + val box2 = test_2() + if (box2.className != expectedName) return "Fail 2: $box2" + return "OK" +} diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/setOperatorOnDynamic.fir.txt b/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/setOperatorOnDynamic.fir.txt index 45d8886b4fa..d9b3472be23 100644 --- a/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/setOperatorOnDynamic.fir.txt +++ b/compiler/testData/diagnostics/testsWithJsStdLib/dynamicTypes/setOperatorOnDynamic.fir.txt @@ -1,6 +1,6 @@ FILE: setOperatorOnDynamic.fir.kt public final fun foo(): R|kotlin/Unit| { - lval x1: R|kotlin/Any| = R|kotlin/arrayOf|().R|kotlin/collections/fold|(String(), = fold@fun (res: R|kotlin/String|, key: R|kotlin/String|): R|kotlin/String| { + lval x1: R|kotlin/Any| = R|kotlin/arrayOf|().R|kotlin/collections/fold|(String(), = fold@fun (res: R|@R|kotlin/ParameterName|(name = String(acc)) kotlin/String|, key: R|kotlin/String|): R|kotlin/String| { R|/res|.R|kotlin/String.length| ^ R|/res| } diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/monoidSum.fir.ir.txt b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/monoidSum.fir.ir.txt index 73e31c86ab6..b7836dbb215 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/monoidSum.fir.ir.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/monoidSum.fir.ir.txt @@ -142,21 +142,21 @@ FILE fqName: fileName:/monoidSum.kt VALUE_PARAMETER name:$context_receiver_0 index:0 type:.Monoid.sum> BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun sum ($context_receiver_0: .Monoid.sum>): T of .sum declared in ' - CALL 'public final fun fold (initial: R of kotlin.collections.fold, operation: kotlin.Function2): R of kotlin.collections.fold declared in kotlin.collections' type=T of .sum origin=null + CALL 'public final fun fold (initial: R of kotlin.collections.fold, operation: kotlin.Function2<@[ParameterName(name = 'acc')] R of kotlin.collections.fold, T of kotlin.collections.fold, R of kotlin.collections.fold>): R of kotlin.collections.fold declared in kotlin.collections' type=T of .sum origin=null : T of .sum : T of .sum $receiver: GET_VAR ': kotlin.collections.List.sum> declared in .sum' type=kotlin.collections.List.sum> origin=null initial: CALL 'public abstract fun (): T of .Monoid declared in .Monoid' type=T of .sum origin=GET_PROPERTY $this: GET_VAR '$context_receiver_0: .Monoid.sum> declared in .sum' type=.Monoid.sum> origin=null - operation: FUN_EXPR type=kotlin.Function2.sum, T of .sum, T of .sum> origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (acc:T of .sum, e:T of .sum) returnType:T of .sum - VALUE_PARAMETER name:acc index:0 type:T of .sum + operation: FUN_EXPR type=kotlin.Function2<@[ParameterName(name = 'acc')] T of .sum, T of .sum, T of .sum> origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (acc:@[ParameterName(name = 'acc')] T of .sum, e:T of .sum) returnType:T of .sum + VALUE_PARAMETER name:acc index:0 type:@[ParameterName(name = 'acc')] T of .sum VALUE_PARAMETER name:e index:1 type:T of .sum BLOCK_BODY - RETURN type=kotlin.Nothing from='local final fun (acc: T of .sum, e: T of .sum): T of .sum declared in .sum' + RETURN type=kotlin.Nothing from='local final fun (acc: @[ParameterName(name = 'acc')] T of .sum, e: T of .sum): T of .sum declared in .sum' CALL 'public abstract fun combine (other: T of .Monoid): T of .Monoid declared in .Monoid' type=T of .sum origin=null $this: GET_VAR '$context_receiver_0: .Monoid.sum> declared in .sum' type=.Monoid.sum> origin=null - $receiver: GET_VAR 'acc: T of .sum declared in .sum.' type=T of .sum origin=null + $receiver: GET_VAR 'acc: @[ParameterName(name = 'acc')] T of .sum declared in .sum.' type=@[ParameterName(name = 'acc')] T of .sum origin=null other: GET_VAR 'e: T of .sum declared in .sum.' type=T of .sum origin=null FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String BLOCK_BODY diff --git a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/monoidSum.fir.kt.txt b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/monoidSum.fir.kt.txt index 57680375178..aef0a308b2e 100644 --- a/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/monoidSum.fir.kt.txt +++ b/compiler/testData/ir/irText/declarations/contextReceivers/fromKEEP/monoidSum.fir.kt.txt @@ -44,7 +44,7 @@ object StringMonoid : Monoid { } fun List.sum($context_receiver_0: Monoid): T { - return .fold(initial = $context_receiver_0.(), operation = local fun (acc: T, e: T): T { + return .fold(initial = $context_receiver_0.(), operation = local fun (acc: @ParameterName(name = "acc") T, e: T): T { return ($context_receiver_0, acc).combine(other = e) } ) diff --git a/compiler/testData/ir/sourceRanges/declarations/delegatedProperties.fir.txt b/compiler/testData/ir/sourceRanges/declarations/delegatedProperties.fir.txt index baeefaec819..e8c0eb59073 100644 --- a/compiler/testData/ir/sourceRanges/declarations/delegatedProperties.fir.txt +++ b/compiler/testData/ir/sourceRanges/declarations/delegatedProperties.fir.txt @@ -25,21 +25,21 @@ @10:4..12:5 PROPERTY name:observableProp visibility:public modality:FINAL [delegated,var] @10:4..12:5 FIELD PROPERTY_DELEGATE name:observableProp$delegate type:kotlin.properties.ReadWriteProperty visibility:private [final] @10:44..12:5 EXPRESSION_BODY - @10:44..12:5 CALL 'public final fun observable (initialValue: T of kotlin.properties.Delegates.observable, onChange: kotlin.Function3<@[ParameterName(name = 'property')] kotlin.reflect.KProperty<*>, T of kotlin.properties.Delegates.observable, T of kotlin.properties.Delegates.observable, kotlin.Unit>): kotlin.properties.ReadWriteProperty [inline] declared in kotlin.properties.Delegates' type=kotlin.properties.ReadWriteProperty origin=null + @10:44..12:5 CALL 'public final fun observable (initialValue: T of kotlin.properties.Delegates.observable, onChange: kotlin.Function3<@[ParameterName(name = 'property')] kotlin.reflect.KProperty<*>, @[ParameterName(name = 'oldValue')] T of kotlin.properties.Delegates.observable, @[ParameterName(name = 'newValue')] T of kotlin.properties.Delegates.observable, kotlin.Unit>): kotlin.properties.ReadWriteProperty [inline] declared in kotlin.properties.Delegates' type=kotlin.properties.ReadWriteProperty origin=null @10:34..43 GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Delegates modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.properties.Delegates @10:55..63 CONST String type=kotlin.String value="" - @10:65..12:5 FUN_EXPR type=kotlin.Function3<@[ParameterName(name = 'property')] kotlin.reflect.KProperty<*>, kotlin.String, kotlin.String, kotlin.Unit> origin=LAMBDA - @10:65..12:5 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (prop:@[ParameterName(name = 'property')] kotlin.reflect.KProperty<*>, old:kotlin.String, new:kotlin.String) returnType:kotlin.Unit + @10:65..12:5 FUN_EXPR type=kotlin.Function3<@[ParameterName(name = 'property')] kotlin.reflect.KProperty<*>, @[ParameterName(name = 'oldValue')] kotlin.String, @[ParameterName(name = 'newValue')] kotlin.String, kotlin.Unit> origin=LAMBDA + @10:65..12:5 FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (prop:@[ParameterName(name = 'property')] kotlin.reflect.KProperty<*>, old:@[ParameterName(name = 'oldValue')] kotlin.String, new:@[ParameterName(name = 'newValue')] kotlin.String) returnType:kotlin.Unit @10:67..71 VALUE_PARAMETER name:prop index:0 type:@[ParameterName(name = 'property')] kotlin.reflect.KProperty<*> - @10:73..76 VALUE_PARAMETER name:old index:1 type:kotlin.String - @10:78..81 VALUE_PARAMETER name:new index:2 type:kotlin.String + @10:73..76 VALUE_PARAMETER name:old index:1 type:@[ParameterName(name = 'oldValue')] kotlin.String + @10:78..81 VALUE_PARAMETER name:new index:2 type:@[ParameterName(name = 'newValue')] kotlin.String @11:8..37 BLOCK_BODY @11:8..37 CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit [inline] declared in kotlin.io' type=kotlin.Unit origin=null @11:16..36 STRING_CONCATENATION type=kotlin.String @11:17..21 CONST String type=kotlin.String value="Was " - @11:22..25 GET_VAR 'old: kotlin.String declared in .MyClass.observableProp$delegate.' type=kotlin.String origin=null + @11:22..25 GET_VAR 'old: @[ParameterName(name = 'oldValue')] kotlin.String declared in .MyClass.observableProp$delegate.' type=@[ParameterName(name = 'oldValue')] kotlin.String origin=null @11:25..31 CONST String type=kotlin.String value=", now " - @11:32..35 GET_VAR 'new: kotlin.String declared in .MyClass.observableProp$delegate.' type=kotlin.String origin=null + @11:32..35 GET_VAR 'new: @[ParameterName(name = 'newValue')] kotlin.String declared in .MyClass.observableProp$delegate.' type=@[ParameterName(name = 'newValue')] kotlin.String origin=null @10:4..12:5 FUN DELEGATED_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.MyClass) returnType:kotlin.String @10:4..12:5 VALUE_PARAMETER name: type:.MyClass @10:34..12:5 BLOCK_BODY diff --git a/compiler/testData/loadJava/compiledKotlin/annotations/types/SupertypesAndBounds.fir.k1.jvm.txt b/compiler/testData/loadJava/compiledKotlin/annotations/types/SupertypesAndBounds.fir.k1.jvm.txt index 01cf6587a63..9cdb01d79d5 100644 --- a/compiler/testData/loadJava/compiledKotlin/annotations/types/SupertypesAndBounds.fir.k1.jvm.txt +++ b/compiler/testData/loadJava/compiledKotlin/annotations/types/SupertypesAndBounds.fir.k1.jvm.txt @@ -4,6 +4,6 @@ } public abstract interface Foo : R|@R|test/A|() java/io/Serializable| { - public abstract fun bar(): R|kotlin/Unit| + public abstract fun bar(): R|kotlin/Unit| } diff --git a/compiler/testData/loadJava/compiledKotlin/annotations/types/SupertypesAndBounds.fir.k2.jvm.txt b/compiler/testData/loadJava/compiledKotlin/annotations/types/SupertypesAndBounds.fir.k2.jvm.txt index 01cf6587a63..9cdb01d79d5 100644 --- a/compiler/testData/loadJava/compiledKotlin/annotations/types/SupertypesAndBounds.fir.k2.jvm.txt +++ b/compiler/testData/loadJava/compiledKotlin/annotations/types/SupertypesAndBounds.fir.k2.jvm.txt @@ -4,6 +4,6 @@ } public abstract interface Foo : R|@R|test/A|() java/io/Serializable| { - public abstract fun bar(): R|kotlin/Unit| + public abstract fun bar(): R|kotlin/Unit| } diff --git a/compiler/testData/loadJava/compiledKotlin/annotations/types/SupertypesAndBounds.fir.k2.klib.txt b/compiler/testData/loadJava/compiledKotlin/annotations/types/SupertypesAndBounds.fir.k2.klib.txt index 4fa64f4e5f5..6289d16dc4d 100644 --- a/compiler/testData/loadJava/compiledKotlin/annotations/types/SupertypesAndBounds.fir.k2.klib.txt +++ b/compiler/testData/loadJava/compiledKotlin/annotations/types/SupertypesAndBounds.fir.k2.klib.txt @@ -4,6 +4,6 @@ } public abstract interface Foo : R|@R|test/A|() kotlin/io/Serializable| { - public abstract fun bar(): R|kotlin/Unit| + public abstract fun bar(): R|kotlin/Unit| } diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index 2fa7dbbc049..3c8a2309823 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -19161,6 +19161,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/fir/nestedClassTypeParameterDeserialization.kt"); } + @Test + @TestMetadata("noInfer.kt") + public void testNoInfer() throws Exception { + runTest("compiler/testData/codegen/box/fir/noInfer.kt"); + } + @Test @TestMetadata("noSymbolForIntRangeIterator.kt") public void testNoSymbolForIntRangeIterator() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java index 6093b88341b..51f0357fcca 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java @@ -19161,6 +19161,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack runTest("compiler/testData/codegen/box/fir/nestedClassTypeParameterDeserialization.kt"); } + @Test + @TestMetadata("noInfer.kt") + public void testNoInfer() throws Exception { + runTest("compiler/testData/codegen/box/fir/noInfer.kt"); + } + @Test @TestMetadata("noSymbolForIntRangeIterator.kt") public void testNoSymbolForIntRangeIterator() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 5d967b9273b..329222b0980 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -15956,6 +15956,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/fir/nestedClassTypeParameterDeserialization.kt"); } + @TestMetadata("noInfer.kt") + public void testNoInfer() throws Exception { + runTest("compiler/testData/codegen/box/fir/noInfer.kt"); + } + @TestMetadata("noSymbolForIntRangeIterator.kt") public void testNoSymbolForIntRangeIterator() throws Exception { runTest("compiler/testData/codegen/box/fir/noSymbolForIntRangeIterator.kt"); diff --git a/plugins/kotlinx-serialization/testData/firMembers/metaSerializable.fir.txt b/plugins/kotlinx-serialization/testData/firMembers/metaSerializable.fir.txt index 94e80c230ec..9f861303ad4 100644 --- a/plugins/kotlinx-serialization/testData/firMembers/metaSerializable.fir.txt +++ b/plugins/kotlinx-serialization/testData/firMembers/metaSerializable.fir.txt @@ -434,12 +434,12 @@ FILE: metaSerializable.kt lval reconstructed: R|Project2| = Q|kotlinx/serialization/json/Json|.R|kotlinx/serialization/json/Json.decodeFromString|(Q|Project2|.R|/Project2.Companion.serializer|(), R|/string|) R|kotlin/test/assertEquals|(String(name), R|/reconstructed|.R|/Project2.name|) R|kotlin/test/assertEquals|(String(lang), R|/reconstructed|.R|/Project2.language|) - lval info: R|MySerializableWithInfo| = Q|Project2|.R|/Project2.Companion.serializer|().R|SubstitutionOverride|.R|kotlinx/serialization/descriptors/SerialDescriptor.annotations|.R|kotlin/collections/filterIsInstance|().R|kotlin/collections/first|() + lval info: R|@NoInfer MySerializableWithInfo| = Q|Project2|.R|/Project2.Companion.serializer|().R|SubstitutionOverride|.R|kotlinx/serialization/descriptors/SerialDescriptor.annotations|.R|kotlin/collections/filterIsInstance|().R|kotlin/collections/first|() R|kotlin/test/assertEquals|(Int(123), R|/info|.R|/MySerializableWithInfo.value|) R|kotlin/test/assertEquals||>((Q|kotlin/String|), R|/info|.R|/MySerializableWithInfo.kclass|) } public final fun testMetaSerializableOnProperty(): R|kotlin/Unit| { - lval info: R|MySerializableWithInfo| = Q|Wrapper|.R|/Wrapper.Companion.serializer|().R|SubstitutionOverride|.R|kotlinx/serialization/descriptors/SerialDescriptor.getElementAnnotations|(Int(0)).R|kotlin/collections/filterIsInstance|().R|kotlin/collections/first|() + lval info: R|@NoInfer MySerializableWithInfo| = Q|Wrapper|.R|/Wrapper.Companion.serializer|().R|SubstitutionOverride|.R|kotlinx/serialization/descriptors/SerialDescriptor.getElementAnnotations|(Int(0)).R|kotlin/collections/filterIsInstance|().R|kotlin/collections/first|() R|kotlin/test/assertEquals|(Int(234), R|/info|.R|/MySerializableWithInfo.value|) R|kotlin/test/assertEquals||>((Q|kotlin/Int|), R|/info|.R|/MySerializableWithInfo.kclass|) } @@ -449,7 +449,7 @@ FILE: metaSerializable.kt lval reconstructed: R|Project3| = Q|kotlinx/serialization/json/Json|.R|kotlinx/serialization/json/Json.decodeFromString|(Q|Project3|.R|/Project3.Companion.serializer|(), R|/string|) R|kotlin/test/assertEquals|(String(name), R|/reconstructed|.R|/Project3.name|) R|kotlin/test/assertEquals|(String(lang), R|/reconstructed|.R|/Project3.language|) - lval info: R|MySerializableWithInfo| = Q|Project3|.R|/Project3.Companion.serializer|().R|SubstitutionOverride|.R|kotlinx/serialization/descriptors/SerialDescriptor.annotations|.R|kotlin/collections/filterIsInstance|().R|kotlin/collections/first|() + lval info: R|@NoInfer MySerializableWithInfo| = Q|Project3|.R|/Project3.Companion.serializer|().R|SubstitutionOverride|.R|kotlinx/serialization/descriptors/SerialDescriptor.annotations|.R|kotlin/collections/filterIsInstance|().R|kotlin/collections/first|() R|kotlin/test/assertEquals|(Int(123), R|/info|.R|/MySerializableWithInfo.value|) R|kotlin/test/assertEquals||>((Q|kotlin/String|), R|/info|.R|/MySerializableWithInfo.kclass|) } @@ -465,8 +465,8 @@ FILE: metaSerializable.kt lval serializerB: R|kotlinx/serialization/KSerializer| = Q|TestSealed.B|.R|/TestSealed.B.Companion.serializer|() R|kotlin/test/assertNotNull||>(R|/serializerA|) R|kotlin/test/assertNotNull||>(R|/serializerB|) - lval infoA: R|MySerializableWithInfo| = R|/serializerA|.R|SubstitutionOverride|.R|kotlinx/serialization/descriptors/SerialDescriptor.annotations|.R|kotlin/collections/filterIsInstance|().R|kotlin/collections/first|() - lval infoB: R|MySerializableWithInfo| = R|/serializerB|.R|SubstitutionOverride|.R|kotlinx/serialization/descriptors/SerialDescriptor.annotations|.R|kotlin/collections/filterIsInstance|().R|kotlin/collections/first|() + lval infoA: R|@NoInfer MySerializableWithInfo| = R|/serializerA|.R|SubstitutionOverride|.R|kotlinx/serialization/descriptors/SerialDescriptor.annotations|.R|kotlin/collections/filterIsInstance|().R|kotlin/collections/first|() + lval infoB: R|@NoInfer MySerializableWithInfo| = R|/serializerB|.R|SubstitutionOverride|.R|kotlinx/serialization/descriptors/SerialDescriptor.annotations|.R|kotlin/collections/filterIsInstance|().R|kotlin/collections/first|() R|kotlin/test/assertEquals|(Int(123), R|/infoA|.R|/MySerializableWithInfo.value|) R|kotlin/test/assertEquals||>((Q|kotlin/String|), R|/infoA|.R|/MySerializableWithInfo.kclass|) R|kotlin/test/assertEquals|(Int(123), R|/infoB|.R|/MySerializableWithInfo.value|) @@ -477,8 +477,8 @@ FILE: metaSerializable.kt lval serializerB: R|kotlinx/serialization/KSerializer| = Q|TestAbstract.B|.R|/TestAbstract.B.Companion.serializer|() R|kotlin/test/assertNotNull||>(R|/serializerA|) R|kotlin/test/assertNotNull||>(R|/serializerB|) - lval infoA: R|MySerializableWithInfo| = R|/serializerA|.R|SubstitutionOverride|.R|kotlinx/serialization/descriptors/SerialDescriptor.annotations|.R|kotlin/collections/filterIsInstance|().R|kotlin/collections/first|() - lval infoB: R|MySerializableWithInfo| = R|/serializerB|.R|SubstitutionOverride|.R|kotlinx/serialization/descriptors/SerialDescriptor.annotations|.R|kotlin/collections/filterIsInstance|().R|kotlin/collections/first|() + lval infoA: R|@NoInfer MySerializableWithInfo| = R|/serializerA|.R|SubstitutionOverride|.R|kotlinx/serialization/descriptors/SerialDescriptor.annotations|.R|kotlin/collections/filterIsInstance|().R|kotlin/collections/first|() + lval infoB: R|@NoInfer MySerializableWithInfo| = R|/serializerB|.R|SubstitutionOverride|.R|kotlinx/serialization/descriptors/SerialDescriptor.annotations|.R|kotlin/collections/filterIsInstance|().R|kotlin/collections/first|() R|kotlin/test/assertEquals|(Int(123), R|/infoA|.R|/MySerializableWithInfo.value|) R|kotlin/test/assertEquals||>((Q|kotlin/String|), R|/infoA|.R|/MySerializableWithInfo.kclass|) R|kotlin/test/assertEquals|(Int(123), R|/infoB|.R|/MySerializableWithInfo.value|) @@ -487,14 +487,14 @@ FILE: metaSerializable.kt public final fun testEnum(): R|kotlin/Unit| { lval serializer: R|kotlinx/serialization/KSerializer| = Q|TestEnum|.R|/TestEnum.Companion.serializer|() R|kotlin/test/assertNotNull||>(R|/serializer|) - lval info: R|MySerializableWithInfo| = R|/serializer|.R|SubstitutionOverride|.R|kotlinx/serialization/descriptors/SerialDescriptor.annotations|.R|kotlin/collections/filterIsInstance|().R|kotlin/collections/first|() + lval info: R|@NoInfer MySerializableWithInfo| = R|/serializer|.R|SubstitutionOverride|.R|kotlinx/serialization/descriptors/SerialDescriptor.annotations|.R|kotlin/collections/filterIsInstance|().R|kotlin/collections/first|() R|kotlin/test/assertEquals|(Int(123), R|/info|.R|/MySerializableWithInfo.value|) R|kotlin/test/assertEquals||>((Q|kotlin/String|), R|/info|.R|/MySerializableWithInfo.kclass|) } public final fun testObject(): R|kotlin/Unit| { lval serializer: R|kotlinx/serialization/KSerializer| = Q|TestObject|.R|/TestObject.serializer|() R|kotlin/test/assertNotNull||>(R|/serializer|) - lval info: R|MySerializableWithInfo| = R|/serializer|.R|SubstitutionOverride|.R|kotlinx/serialization/descriptors/SerialDescriptor.annotations|.R|kotlin/collections/filterIsInstance|().R|kotlin/collections/first|() + lval info: R|@NoInfer MySerializableWithInfo| = R|/serializer|.R|SubstitutionOverride|.R|kotlinx/serialization/descriptors/SerialDescriptor.annotations|.R|kotlin/collections/filterIsInstance|().R|kotlin/collections/first|() R|kotlin/test/assertEquals|(Int(123), R|/info|.R|/MySerializableWithInfo.value|) R|kotlin/test/assertEquals||>((Q|kotlin/String|), R|/info|.R|/MySerializableWithInfo.kclass|) }