From 913ea9b56de20da50d4b6e5dd71494abf4113e1c Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Thu, 13 Aug 2020 11:55:12 +0300 Subject: [PATCH] [FIR-TEST] Get rid of deprecated methods usage in AbstractFirLoadCompiledKotlin Now complied declaration names are collected via ModuleDescriptor, so tests pass more correctly. Before this change tests didn't render compiled typealiases and properties. Also some testdata was changed because of new order of declaration --- .../packageMembers/DelegatedProperty.txt | 4 ++ .../packageMembers/EnumArgument.txt | 4 ++ .../packageMembers/EnumArrayArgument.txt | 4 ++ .../annotations/packageMembers/Getter.txt | 4 ++ .../packageMembers/PropertyField.txt | 5 +++ .../annotations/packageMembers/Setter.txt | 5 +++ .../packageMembers/StringArrayArgument.txt | 4 ++ .../parameters/TopLevelPropertySetter.txt | 5 +++ .../ExtensionsWithSameNamePackage.txt | 10 +++++ .../TopLevel.txt | 4 ++ .../annotations/types/SourceRetention.txt | 3 ++ ...NamedObjectWithAnotherTopLevelProperty.txt | 4 ++ .../fun/DeclaredMemberOverridesDelegated.txt | 1 + ...odsDifferentReturnTypesAndVisibilities.txt | 1 + .../fun/InheritValAndVar.txt | 1 + .../fun/InheritValsDifferentTypes.txt | 1 + .../memberOrder/CallablesNameClash.txt | 1 + .../memberOrder/TopLevelCallables.txt | 10 +++++ .../prop/CollectionSize.txt | 2 + .../loadCompiledKotlin/prop/Const.txt | 4 ++ .../loadCompiledKotlin/prop/Constants.txt | 44 +++++++++++++++++++ .../loadCompiledKotlin/prop/ExtValClass.txt | 2 + .../loadCompiledKotlin/prop/ExtValInt.txt | 2 + .../prop/ExtValIntCharSequence.txt | 2 + .../prop/ExtValIntCharSequenceQ.txt | 2 + .../loadCompiledKotlin/prop/ExtVarClass.txt | 3 ++ .../loadCompiledKotlin/prop/ExtVarInt.txt | 3 ++ .../prop/ExtVarMapPQInt.txt | 3 ++ .../loadCompiledKotlin/prop/ExtVarl.txt | 6 +++ .../NonConstValWithConstantValueAttribute.txt | 4 ++ .../loadCompiledKotlin/prop/NsVal.txt | 2 + .../loadCompiledKotlin/prop/NsVar.txt | 3 ++ .../prop/OverrideTraitVal.txt | 1 + .../prop/defaultAccessors/ExtValLong.txt | 11 +++++ .../prop/defaultAccessors/ExtVarLong.txt | 27 ++++++++++++ .../loadCompiledKotlin/type/Platform.txt | 1 + .../typealias/Annotations.txt | 5 +++ .../loadCompiledKotlin/typealias/Basic.txt | 23 ++++++++++ .../loadCompiledKotlin/typealias/Generic.txt | 6 +++ .../typealias/TypeAliasToExtension.txt | 3 ++ .../visibility/InternalTopLevelMembers.txt | 4 ++ .../visibility/PrivateTopLevelVal.txt | 2 + .../TopLevelVarWithPrivateSetter.txt | 3 ++ .../fir/AbstractFirLoadCompiledKotlin.kt | 26 ++++++----- 44 files changed, 254 insertions(+), 11 deletions(-) diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/DelegatedProperty.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/DelegatedProperty.txt index ca31480e717..7d89531a597 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/DelegatedProperty.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/DelegatedProperty.txt @@ -1,4 +1,8 @@ +@PROPERTY:R|test/Anno|() public final val x: R|kotlin/Int| + public get(): R|kotlin/Int| + public final annotation class Anno : R|kotlin/Annotation| { public constructor(): R|test/Anno| } + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/EnumArgument.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/EnumArgument.txt index b7394bffcba..943514a3249 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/EnumArgument.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/EnumArgument.txt @@ -1,3 +1,6 @@ +@FIELD:R|test/Anno|(t = R|java/lang/annotation/ElementType.FIELD|()) public final val bar: R|kotlin/Int| + public get(): R|kotlin/Int| + @R|test/Anno|(t = R|java/lang/annotation/ElementType.METHOD|()) public final fun foo(): R|kotlin/Unit| public final annotation class Anno : R|kotlin/Annotation| { @@ -7,3 +10,4 @@ public final annotation class Anno : R|kotlin/Annotation| { public constructor(t: R|java/lang/annotation/ElementType|): R|test/Anno| } + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/EnumArrayArgument.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/EnumArrayArgument.txt index 68b75abade8..ab703dff497 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/EnumArrayArgument.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/EnumArrayArgument.txt @@ -1,3 +1,6 @@ +@FIELD:R|test/Anno|(t = (R|java/lang/annotation/ElementType.PACKAGE|())) public final val bar: R|kotlin/Int| + public get(): R|kotlin/Int| + @R|test/Anno|(t = ()) public final fun baz(): R|kotlin/Unit| @R|test/Anno|(t = (R|java/lang/annotation/ElementType.METHOD|(), R|java/lang/annotation/ElementType.FIELD|())) public final fun foo(): R|kotlin/Unit| @@ -9,3 +12,4 @@ public final annotation class Anno : R|kotlin/Annotation| { public constructor(vararg t: R|kotlin/Array|): R|test/Anno| } + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/Getter.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/Getter.txt index ca31480e717..885179cc5f2 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/Getter.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/Getter.txt @@ -1,4 +1,8 @@ +public final val property: R|kotlin/Int| + @R|test/Anno|() public get(): R|kotlin/Int| + public final annotation class Anno : R|kotlin/Annotation| { public constructor(): R|test/Anno| } + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/PropertyField.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/PropertyField.txt index ca31480e717..8591de79b4d 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/PropertyField.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/PropertyField.txt @@ -1,4 +1,9 @@ +@FIELD:R|test/Anno|() public final var property: R|kotlin/Int| + public get(): R|kotlin/Int| + public set(value: R|kotlin/Int|): R|kotlin/Unit| + public final annotation class Anno : R|kotlin/Annotation| { public constructor(): R|test/Anno| } + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/Setter.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/Setter.txt index ca31480e717..18ceb23994b 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/Setter.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/Setter.txt @@ -1,4 +1,9 @@ +public final var property: R|kotlin/Int| + public get(): R|kotlin/Int| + @R|test/Anno|() public set(value: R|kotlin/Int|): R|kotlin/Unit| + public final annotation class Anno : R|kotlin/Annotation| { public constructor(): R|test/Anno| } + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/StringArrayArgument.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/StringArrayArgument.txt index edc3813aefe..345ef1a609b 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/StringArrayArgument.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/packageMembers/StringArrayArgument.txt @@ -1,3 +1,6 @@ +@FIELD:R|test/Anno|(t = (String(prosper))) public final val bar: R|kotlin/Int| + public get(): R|kotlin/Int| + @R|test/Anno|(t = ()) public final fun baz(): R|kotlin/Unit| @R|test/Anno|(t = (String(live), String(long))) public final fun foo(): R|kotlin/Unit| @@ -9,3 +12,4 @@ public final annotation class Anno : R|kotlin/Annotation| { public constructor(vararg t: R|kotlin/Array|): R|test/Anno| } + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/parameters/TopLevelPropertySetter.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/parameters/TopLevelPropertySetter.txt index 33d6afd6763..546969b1f9a 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/parameters/TopLevelPropertySetter.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/parameters/TopLevelPropertySetter.txt @@ -1,3 +1,7 @@ +public final var foo: R|kotlin/Int| + public get(): R|kotlin/Int| + public set(@R|test/A|() @R|test/B|() value: R|kotlin/Int|): R|kotlin/Unit| + public final annotation class A : R|kotlin/Annotation| { public constructor(): R|test/A| @@ -7,3 +11,4 @@ public final annotation class B : R|kotlin/Annotation| { public constructor(): R|test/B| } + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/propertiesWithoutBackingFields/ExtensionsWithSameNamePackage.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/propertiesWithoutBackingFields/ExtensionsWithSameNamePackage.txt index d60214e83de..fffaaa349ed 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/propertiesWithoutBackingFields/ExtensionsWithSameNamePackage.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/propertiesWithoutBackingFields/ExtensionsWithSameNamePackage.txt @@ -1,3 +1,12 @@ +@PROPERTY:R|test/DoubleAnno|() public final val R|kotlin/Double|.extension: R|kotlin/Int| + public get(): R|kotlin/Int| + +@PROPERTY:R|test/IntAnno|() public final val R|kotlin/Int|.extension: R|kotlin/Int| + public get(): R|kotlin/Int| + +@PROPERTY:R|test/StringAnno|() public final val R|kotlin/String|.extension: R|kotlin/String| + public get(): R|kotlin/String| + public final annotation class DoubleAnno : R|kotlin/Annotation| { public constructor(): R|test/DoubleAnno| @@ -12,3 +21,4 @@ public final annotation class StringAnno : R|kotlin/Annotation| { public constructor(): R|test/StringAnno| } + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/propertiesWithoutBackingFields/TopLevel.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/propertiesWithoutBackingFields/TopLevel.txt index ca31480e717..05ea7d677ff 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/propertiesWithoutBackingFields/TopLevel.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/propertiesWithoutBackingFields/TopLevel.txt @@ -1,4 +1,8 @@ +@PROPERTY:R|test/Anno|() public final val property: R|kotlin/Int| + public get(): R|kotlin/Int| + public final annotation class Anno : R|kotlin/Annotation| { public constructor(): R|test/Anno| } + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/types/SourceRetention.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/types/SourceRetention.txt index c7ab48f1cbf..4d89784fc7e 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/types/SourceRetention.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/annotations/types/SourceRetention.txt @@ -5,9 +5,12 @@ public final fun typeAnnotation(): R|kotlin/Unit| } +public final typealias TypeAliasAnnotation = R|kotlin/collections/List| + public final class TypeParameterAnnotation : R|kotlin/Any| { public final fun foo(x: R|T|): R|kotlin/Unit| public constructor(): R|test/TypeParameterAnnotation| } + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/class/NamedObjectWithAnotherTopLevelProperty.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/class/NamedObjectWithAnotherTopLevelProperty.txt index f1f5fb60682..dd380b75cd3 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/class/NamedObjectWithAnotherTopLevelProperty.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/class/NamedObjectWithAnotherTopLevelProperty.txt @@ -1,3 +1,6 @@ +public final val x: R|kotlin/Int| + public get(): R|kotlin/Int| + public final object Obj : R|kotlin/Any| { public final fun f(): R|kotlin/String| @@ -7,3 +10,4 @@ public final object Obj : R|kotlin/Any| { private constructor(): R|test/Obj| } + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/fun/DeclaredMemberOverridesDelegated.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/fun/DeclaredMemberOverridesDelegated.txt index 65b42b6083f..31942bdda4b 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/fun/DeclaredMemberOverridesDelegated.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/fun/DeclaredMemberOverridesDelegated.txt @@ -15,3 +15,4 @@ public abstract interface X : R|kotlin/Any| { public abstract interface Y : R|test/X| { } + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/fun/InheritMethodsDifferentReturnTypesAndVisibilities.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/fun/InheritMethodsDifferentReturnTypesAndVisibilities.txt index 88f6a373b92..a02c4f8099f 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/fun/InheritMethodsDifferentReturnTypesAndVisibilities.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/fun/InheritMethodsDifferentReturnTypesAndVisibilities.txt @@ -14,3 +14,4 @@ public abstract interface Super2 : R|kotlin/Any| { private final fun foo(): R|kotlin/String| } + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/fun/InheritValAndVar.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/fun/InheritValAndVar.txt index 7d60959274e..be17445d607 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/fun/InheritValAndVar.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/fun/InheritValAndVar.txt @@ -20,3 +20,4 @@ public abstract interface Super2 : R|kotlin/Any| { public get(): R|kotlin/String| } + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/fun/InheritValsDifferentTypes.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/fun/InheritValsDifferentTypes.txt index 19b5de5e3c6..614ece7a18a 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/fun/InheritValsDifferentTypes.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/fun/InheritValsDifferentTypes.txt @@ -18,3 +18,4 @@ public abstract interface Super2 : R|kotlin/Any| { public get(): R|kotlin/String| } + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/memberOrder/CallablesNameClash.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/memberOrder/CallablesNameClash.txt index cf9f96c5b95..3cd2bb4cae3 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/memberOrder/CallablesNameClash.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/memberOrder/CallablesNameClash.txt @@ -26,3 +26,4 @@ public final class A : R|kotlin/Any| { public constructor(): R|test/A| } + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/memberOrder/TopLevelCallables.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/memberOrder/TopLevelCallables.txt index 0a5f853685e..eadcb0f049c 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/memberOrder/TopLevelCallables.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/memberOrder/TopLevelCallables.txt @@ -1,5 +1,15 @@ +public final val f1: R|kotlin/Int| + public get(): R|kotlin/Int| + public final fun f2(): R|kotlin/Int| +public final val f3: R|kotlin/Int| + public get(): R|kotlin/Int| + public final fun f4(): R|kotlin/Int| public final fun f4(i: R|kotlin/Int|): R|kotlin/Int| + +public final val f5: R|kotlin/Int| + public get(): R|kotlin/Int| + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/CollectionSize.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/CollectionSize.txt index 8b137891791..b6ffea82ab5 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/CollectionSize.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/CollectionSize.txt @@ -1 +1,3 @@ +public final val R|kotlin/collections/Collection<*>|.anotherSize: R|kotlin/Int| + public get(): R|kotlin/Int| diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/Const.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/Const.txt index 9314e8c0753..ee8ba0599a8 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/Const.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/Const.txt @@ -1,3 +1,6 @@ +private final const val topLevel: R|kotlin/Int| = Int(1) + private get(): R|kotlin/Int| + public final object A : R|kotlin/Any| { internal final const val inObject: R|kotlin/Int| = Int(2) internal get(): R|kotlin/Int| @@ -18,3 +21,4 @@ public final class B : R|kotlin/Any| { } } + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/Constants.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/Constants.txt index 8b137891791..cac7b3ea9cf 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/Constants.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/Constants.txt @@ -1 +1,45 @@ +public final const val MAX_HIGH_SURROGATE: R|kotlin/Char| = Char(56319) + public get(): R|kotlin/Char| + +public final const val b: R|kotlin/Byte| = Byte(100) + public get(): R|kotlin/Byte| + +public final const val b1: R|kotlin/Byte| = Byte(1) + public get(): R|kotlin/Byte| + +public final const val bb: R|kotlin/Boolean| = Boolean(true) + public get(): R|kotlin/Boolean| + +public final const val c: R|kotlin/Char| = Char(960) + public get(): R|kotlin/Char| + +public final const val d: R|kotlin/Double| = Double(3.14) + public get(): R|kotlin/Double| + +public final const val f: R|kotlin/Float| = Float(3.14) + public get(): R|kotlin/Float| + +public final const val i: R|kotlin/Int| = Int(2000000) + public get(): R|kotlin/Int| + +public final const val i1: R|kotlin/Short| = Short(1) + public get(): R|kotlin/Short| + +public final const val l: R|kotlin/Long| = Long(2000000000000) + public get(): R|kotlin/Long| + +public final const val l1: R|kotlin/Long| = Long(1) + public get(): R|kotlin/Long| + +public final const val nl: R|kotlin/Char| = Char(10) + public get(): R|kotlin/Char| + +public final const val s: R|kotlin/Short| = Short(20000) + public get(): R|kotlin/Short| + +public final const val s1: R|kotlin/Short| = Short(1) + public get(): R|kotlin/Short| + +public final const val str: R|kotlin/String| + public get(): R|kotlin/String| diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtValClass.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtValClass.txt index 8b137891791..25cdc8a7dfb 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtValClass.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtValClass.txt @@ -1 +1,3 @@ +public final val

R|P|.anotherJavaClass: R|java/lang/Class

| + public get(): R|java/lang/Class

| diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtValInt.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtValInt.txt index 8b137891791..f42e33a40f3 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtValInt.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtValInt.txt @@ -1 +1,3 @@ +public final val R|kotlin/Int|.itIs: R|kotlin/Int| + public get(): R|kotlin/Int| diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtValIntCharSequence.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtValIntCharSequence.txt index 8b137891791..0ab97adf02e 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtValIntCharSequence.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtValIntCharSequence.txt @@ -1 +1,3 @@ +public final val R|kotlin/Int|.ggg: R|java/lang/CharSequence| + public get(): R|java/lang/CharSequence| diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtValIntCharSequenceQ.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtValIntCharSequenceQ.txt index 8b137891791..8c8ecfde183 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtValIntCharSequenceQ.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtValIntCharSequenceQ.txt @@ -1 +1,3 @@ +public final val R|kotlin/Int|.ggg: R|java/lang/CharSequence?| + public get(): R|java/lang/CharSequence?| diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtVarClass.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtVarClass.txt index 8b137891791..1b65d42609d 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtVarClass.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtVarClass.txt @@ -1 +1,4 @@ +public final var

R|P|.anotherJavaClass: R|java/lang/Class

| + public get(): R|java/lang/Class

| + public set(p: R|java/lang/Class

|): R|kotlin/Unit| diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtVarInt.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtVarInt.txt index 8b137891791..713a9e3eef8 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtVarInt.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtVarInt.txt @@ -1 +1,4 @@ +public final var R|kotlin/Int|.ggg: R|kotlin/Int| + public get(): R|kotlin/Int| + public set(p: R|kotlin/Int|): R|kotlin/Unit| diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtVarMapPQInt.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtVarMapPQInt.txt index 8b137891791..f14014d53b6 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtVarMapPQInt.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtVarMapPQInt.txt @@ -1 +1,4 @@ +public final var R|kotlin/collections/Map|.asas: R|kotlin/Int| + public get(): R|kotlin/Int| + public set(i: R|kotlin/Int|): R|kotlin/Unit| diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtVarl.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtVarl.txt index 8b137891791..62fa772bf06 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtVarl.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/ExtVarl.txt @@ -1 +1,7 @@ +public final var R|kotlin/Int|.junk: R|kotlin/Short| + public get(): R|kotlin/Short| + public set(p: R|kotlin/Short|): R|kotlin/Unit| + +public final val R|kotlin/String|.junk: R|kotlin/Int| + public get(): R|kotlin/Int| diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/NonConstValWithConstantValueAttribute.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/NonConstValWithConstantValueAttribute.txt index 86606fb77e9..94245acea93 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/NonConstValWithConstantValueAttribute.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/NonConstValWithConstantValueAttribute.txt @@ -1,3 +1,6 @@ +public final val nonConstVal1: R|kotlin/Int| + public get(): R|kotlin/Int| + public final class C : R|kotlin/Any| { public final val nonConstVal2: R|kotlin/Int| public get(): R|kotlin/Int| @@ -24,3 +27,4 @@ public abstract interface I : R|kotlin/Any| { } } + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/NsVal.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/NsVal.txt index 8b137891791..a6ccc9e8549 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/NsVal.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/NsVal.txt @@ -1 +1,3 @@ +public final val nsVal: R|kotlin/Int| + public get(): R|kotlin/Int| diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/NsVar.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/NsVar.txt index 8b137891791..89bab255647 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/NsVar.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/NsVar.txt @@ -1 +1,4 @@ +public final var nsVal: R|kotlin/Int| + public get(): R|kotlin/Int| + public set(value: R|kotlin/Int|): R|kotlin/Unit| diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/OverrideTraitVal.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/OverrideTraitVal.txt index d501638b179..8e41498f92c 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/OverrideTraitVal.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/OverrideTraitVal.txt @@ -11,3 +11,4 @@ public abstract interface Trait : R|kotlin/Any| { public get(): R|kotlin/String| } + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/defaultAccessors/ExtValLong.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/defaultAccessors/ExtValLong.txt index 8b137891791..078bb50e6dd 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/defaultAccessors/ExtValLong.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/defaultAccessors/ExtValLong.txt @@ -1 +1,12 @@ +public final val R|kotlin/Long|.date1: R|kotlin/Any| + public get(): R|kotlin/Any| + +internal final val R|kotlin/Long|.date12: R|kotlin/Any| + internal get(): R|kotlin/Any| + +private final val R|kotlin/Long|.date3: R|java/util/Date| + private get(): R|java/util/Date| + +public final val R|kotlin/Long|.date4: R|java/util/Date| + public get(): R|java/util/Date| diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/defaultAccessors/ExtVarLong.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/defaultAccessors/ExtVarLong.txt index 8b137891791..823b22fbcd6 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/defaultAccessors/ExtVarLong.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/prop/defaultAccessors/ExtVarLong.txt @@ -1 +1,28 @@ +public final var R|kotlin/Long|.date1: R|kotlin/Any| + public get(): R|kotlin/Any| + public set(value: R|kotlin/Any|): R|kotlin/Unit| + +public final var R|kotlin/Long|.date11: R|java/util/Date| + public get(): R|java/util/Date| + public set(value: R|java/util/Date|): R|kotlin/Unit| + +public final var R|kotlin/Long|.date3: R|kotlin/Any| + public get(): R|kotlin/Any| + private set(value: R|kotlin/Any|): R|kotlin/Unit| + +private final var R|kotlin/Long|.date4: R|java/util/Date| + private get(): R|java/util/Date| + private set(value: R|java/util/Date|): R|kotlin/Unit| + +public final var R|kotlin/Long|.date7: R|java/util/Date| + public get(): R|java/util/Date| + public set(value: R|java/util/Date|): R|kotlin/Unit| + +public final var R|kotlin/Long|.date8: R|java/util/Date| + public get(): R|java/util/Date| + internal set(value: R|java/util/Date|): R|kotlin/Unit| + +public final var R|kotlin/Long|.date9: R|java/util/Date| + public get(): R|java/util/Date| + private set(value: R|java/util/Date|): R|kotlin/Unit| diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/type/Platform.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/type/Platform.txt index 637794299e9..994abb4f8b0 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/type/Platform.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/type/Platform.txt @@ -3,3 +3,4 @@ public final fun array(a: R|kotlin/Array|): R|ft!>, kotlin/collections/List!>?>!| public final fun printStream(): R|ft!| + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/typealias/Annotations.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/typealias/Annotations.txt index ec918d302ce..b0b04378726 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/typealias/Annotations.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/typealias/Annotations.txt @@ -1,3 +1,7 @@ +public final typealias A1 = R|kotlin/String| + +public final typealias A2 = R|kotlin/String| + @R|kotlin/annotation/Target|(allowedTargets = (R|kotlin/annotation/AnnotationTarget.TYPEALIAS|())) public final annotation class Ann : R|kotlin/Annotation| { public final val value: R|kotlin/String| public get(): R|kotlin/String| @@ -5,3 +9,4 @@ public constructor(value: R|kotlin/String| = STUB): R|test/Ann| } + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/typealias/Basic.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/typealias/Basic.txt index 8b137891791..b50fd142778 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/typealias/Basic.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/typealias/Basic.txt @@ -1 +1,24 @@ +public final val x1: R|test/S| + public get(): R|test/S| + +public final val x2: R|test/SS| + public get(): R|test/SS| + +public final val x3: R|test/SSS| + public get(): R|test/SSS| + +public final val x4: R|test/S?| + public get(): R|test/S?| + +public final val x5: R|test/SS?| + public get(): R|test/SS?| + +public final val x6: R|test/SSS?| + public get(): R|test/SSS?| + +public final typealias S = R|kotlin/String| + +public final typealias SS = R|test/S| + +public final typealias SSS = R|test/SS| diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/typealias/Generic.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/typealias/Generic.txt index 2f4995efd85..d74979048f4 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/typealias/Generic.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/typealias/Generic.txt @@ -10,3 +10,9 @@ public final fun test5(x: R|test/LL>|): R|kotlin/Unit| public final fun test6(x: R|test/LLL>|): R|kotlin/Unit| +public final typealias L = R|kotlin/collections/List| + +public final typealias LL = R|test/L| + +public final typealias LLL = R|test/LL| + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/typealias/TypeAliasToExtension.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/typealias/TypeAliasToExtension.txt index 339f457d992..eead786cb91 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/typealias/TypeAliasToExtension.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/typealias/TypeAliasToExtension.txt @@ -4,3 +4,6 @@ public final class Foo : R|kotlin/Any| { public constructor(): R|test/Foo| } + +public final typealias MyHandler

= R|(test/Foo

) -> kotlin/Unit| + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/visibility/InternalTopLevelMembers.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/visibility/InternalTopLevelMembers.txt index 097f9c4e351..12da978f57a 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/visibility/InternalTopLevelMembers.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/visibility/InternalTopLevelMembers.txt @@ -1 +1,5 @@ internal final fun f(): R|kotlin/Int| + +internal final val x: R|kotlin/Int| + internal get(): R|kotlin/Int| + diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/visibility/PrivateTopLevelVal.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/visibility/PrivateTopLevelVal.txt index 8b137891791..2a0643ee8f6 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/visibility/PrivateTopLevelVal.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/visibility/PrivateTopLevelVal.txt @@ -1 +1,3 @@ +private final val topLevelVal: R|kotlin/Int| + private get(): R|kotlin/Int| diff --git a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/visibility/TopLevelVarWithPrivateSetter.txt b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/visibility/TopLevelVarWithPrivateSetter.txt index 8b137891791..7fd29611dae 100644 --- a/compiler/fir/analysis-tests/testData/loadCompiledKotlin/visibility/TopLevelVarWithPrivateSetter.txt +++ b/compiler/fir/analysis-tests/testData/loadCompiledKotlin/visibility/TopLevelVarWithPrivateSetter.txt @@ -1 +1,4 @@ +internal final var topLevelVar: R|kotlin/Int| + internal get(): R|kotlin/Int| + private set(: R|kotlin/Int|): R|kotlin/Unit| diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/AbstractFirLoadCompiledKotlin.kt b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/AbstractFirLoadCompiledKotlin.kt index 945efdc9a13..5a66af5ec5c 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/AbstractFirLoadCompiledKotlin.kt +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/AbstractFirLoadCompiledKotlin.kt @@ -8,11 +8,13 @@ package org.jetbrains.kotlin.fir import com.intellij.psi.search.GlobalSearchScope import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment +import org.jetbrains.kotlin.descriptors.ModuleDescriptor import org.jetbrains.kotlin.fir.resolve.firSymbolProvider -import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol import org.jetbrains.kotlin.jvm.compiler.LoadDescriptorUtil.compileKotlinToDirAndGetModule import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.test.ConfigurationKind import org.jetbrains.kotlin.test.KotlinTestUtils import org.jetbrains.kotlin.test.KotlinTestUtils.newConfiguration @@ -32,7 +34,11 @@ abstract class AbstractFirLoadCompiledKotlin : AbstractFirResolveWithSessionTest } fun doTest(path: String) { - compileKtFileToTmpDir(path) + val moduleDescriptor = compileKtFileToTmpDir(path) + + val packageFqName = FqName("test") + val allCompiledNames = DescriptorUtils.getAllDescriptors(moduleDescriptor.getPackage(packageFqName).memberScope) + .mapTo(sortedSetOf()) { it.name } val configuration = newConfiguration(ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK, listOf(tmpdir), emptyList()) val environment = KotlinCoreEnvironment.createForTests(testRootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES) @@ -40,22 +46,22 @@ abstract class AbstractFirLoadCompiledKotlin : AbstractFirResolveWithSessionTest prepareProjectExtensions(environment.project) val sessionWithDependency = createSession(environment, GlobalSearchScope.EMPTY_SCOPE) - checkPackageContent(sessionWithDependency, FqName("test"), path) + checkPackageContent(sessionWithDependency, packageFqName, allCompiledNames, path) } - private fun compileKtFileToTmpDir(path: String) { + private fun compileKtFileToTmpDir(path: String): ModuleDescriptor { val file = File(path) val configuration = newConfiguration(ConfigurationKind.JDK_ONLY, TestJdkKind.MOCK_JDK, emptyList(), emptyList()) val environment = KotlinCoreEnvironment.createForTests(testRootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES) - // We don't use ModuleDescriptor - compileKotlinToDirAndGetModule(listOf(file), tmpdir, environment) + return compileKotlinToDirAndGetModule(listOf(file), tmpdir, environment) } private fun checkPackageContent( session: FirSession, packageFqName: FqName, + declarationNames: Set, testDataPath: String ) { val provider = session.firSymbolProvider @@ -63,17 +69,15 @@ abstract class AbstractFirLoadCompiledKotlin : AbstractFirResolveWithSessionTest val builder = StringBuilder() val firRenderer = FirRenderer(builder) - for (name in provider.getAllCallableNamesInPackage(packageFqName)) { + for (name in declarationNames) { for (symbol in provider.getTopLevelCallableSymbols(packageFqName, name)) { symbol.fir.accept(firRenderer) builder.appendLine() } } - for (name in provider.getClassNamesInPackage(packageFqName)) { - val classLikeSymbol = - provider.getClassLikeSymbolByFqName(ClassId.topLevel(packageFqName.child(name))) as FirClassSymbol? - ?: continue + for (name in declarationNames) { + val classLikeSymbol = provider.getClassLikeSymbolByFqName(ClassId.topLevel(packageFqName.child(name))) ?: continue classLikeSymbol.fir.accept(firRenderer) builder.appendLine() }