[AA] Unwrap type aliases in annotation arguments
^KT-55782 Fixed
This commit is contained in:
committed by
Space Team
parent
34af013913
commit
16b72d3e54
+7
-1
@@ -11,7 +11,9 @@ import org.jetbrains.kotlin.analysis.api.components.KtConstantEvaluationMode
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.fir.FirSession
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.getContainingClassSymbol
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.toClassLikeSymbol
|
||||
import org.jetbrains.kotlin.fir.declarations.FirClass
|
||||
import org.jetbrains.kotlin.fir.declarations.fullyExpandedClass
|
||||
import org.jetbrains.kotlin.fir.declarations.utils.isLocal
|
||||
import org.jetbrains.kotlin.fir.expressions.*
|
||||
import org.jetbrains.kotlin.fir.psi
|
||||
@@ -22,6 +24,7 @@ import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeUnresolvedTypeQualifierE
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirConstructorSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirEnumEntrySymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
|
||||
import org.jetbrains.kotlin.fir.symbols.impl.FirTypeAliasSymbol
|
||||
import org.jetbrains.kotlin.fir.types.ConeErrorType
|
||||
import org.jetbrains.kotlin.fir.types.coneType
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
@@ -147,7 +150,10 @@ internal object FirAnnotationValueConverter {
|
||||
}
|
||||
|
||||
is FirGetClassCall -> {
|
||||
val symbol = (argument as? FirResolvedQualifier)?.symbol
|
||||
var symbol = (argument as? FirResolvedQualifier)?.symbol
|
||||
if (symbol is FirTypeAliasSymbol) {
|
||||
symbol = symbol.fullyExpandedClass(session) ?: symbol
|
||||
}
|
||||
when {
|
||||
symbol == null -> {
|
||||
val qualifierParts = mutableListOf<String?>()
|
||||
|
||||
-6
@@ -108,12 +108,6 @@ public class SymbolLightClassesByFqNameForLibraryTestGenerated extends AbstractS
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/DelegatedNested.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegatedProperty.kt")
|
||||
public void testDelegatedProperty() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/delegatedProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("Delegation.kt")
|
||||
public void testDelegation() throws Exception {
|
||||
|
||||
+12
@@ -264,6 +264,18 @@ public class SymbolLightClassesByPsiForLibraryTestGenerated extends AbstractSymb
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/typeAnnotations.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typealiasInAnnotation.kt")
|
||||
public void testTypealiasInAnnotation() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/typealiasInAnnotation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typealiasInTypeArguments.kt")
|
||||
public void testTypealiasInTypeArguments() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/typealiasInTypeArguments.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unresolvedWithAliasedImport.kt")
|
||||
public void testUnresolvedWithAliasedImport() throws Exception {
|
||||
|
||||
-6
@@ -108,12 +108,6 @@ public class SymbolLightClassesParentingForLibraryTestGenerated extends Abstract
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/DelegatedNested.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegatedProperty.kt")
|
||||
public void testDelegatedProperty() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/delegatedProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("Delegation.kt")
|
||||
public void testDelegation() throws Exception {
|
||||
|
||||
-6
@@ -108,12 +108,6 @@ public class SymbolLightClassesByFqNameForSourceTestGenerated extends AbstractSy
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/DelegatedNested.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegatedProperty.kt")
|
||||
public void testDelegatedProperty() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/delegatedProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("Delegation.kt")
|
||||
public void testDelegation() throws Exception {
|
||||
|
||||
+12
@@ -264,6 +264,18 @@ public class SymbolLightClassesByPsiForSourceTestGenerated extends AbstractSymbo
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/typeAnnotations.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typealiasInAnnotation.kt")
|
||||
public void testTypealiasInAnnotation() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/typealiasInAnnotation.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("typealiasInTypeArguments.kt")
|
||||
public void testTypealiasInTypeArguments() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByPsi/typealiasInTypeArguments.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("unresolvedWithAliasedImport.kt")
|
||||
public void testUnresolvedWithAliasedImport() throws Exception {
|
||||
|
||||
-6
@@ -108,12 +108,6 @@ public class SymbolLightClassesParentingForSourceTestGenerated extends AbstractS
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/DelegatedNested.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegatedProperty.kt")
|
||||
public void testDelegatedProperty() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/delegatedProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("Delegation.kt")
|
||||
public void testDelegation() throws Exception {
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
public abstract interface A /* A*/ {
|
||||
}
|
||||
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface Ann /* Ann*/ {
|
||||
public abstract java.lang.Class<?>[] kClass();// kClass()
|
||||
}
|
||||
|
||||
public abstract interface B /* B*/<T, R> {
|
||||
}
|
||||
|
||||
@Ann(kClass = {A.class, A.class, A.class, B.class, B.class})
|
||||
public abstract interface Test /* Test*/ {
|
||||
}
|
||||
|
||||
public final class TypealiasInAnnotationKt /* TypealiasInAnnotationKt*/ {
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// Test
|
||||
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
interface A
|
||||
interface B<T, R>
|
||||
|
||||
typealias OtherA = A
|
||||
typealias OtherOtherA = OtherA
|
||||
typealias OtherB<X, Y> = B<Y, X>
|
||||
|
||||
annotation class Ann(vararg val kClass: KClass<*>)
|
||||
|
||||
@Ann(A::class, OtherA::class, OtherOtherA::class, B::class, OtherB::class)
|
||||
interface Test
|
||||
+9
@@ -1,3 +1,9 @@
|
||||
public abstract interface A /* A*/ {
|
||||
}
|
||||
|
||||
public abstract interface B /* B*/<T, R> {
|
||||
}
|
||||
|
||||
public abstract interface Test /* Test*/ {
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public abstract A foo();// foo()
|
||||
@@ -11,3 +17,6 @@ public abstract interface Test /* Test*/ {
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public abstract B<A, B<A, java.lang.String>> barAliased();// barAliased()
|
||||
}
|
||||
|
||||
public final class TypealiasInTypeArgumentsKt /* TypealiasInTypeArgumentsKt*/ {
|
||||
}
|
||||
-5
@@ -99,11 +99,6 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/DelegatedNested.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("delegatedProperty.kt")
|
||||
public void testDelegatedProperty() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/delegatedProperty.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("Delegation.kt")
|
||||
public void testDelegation() throws Exception {
|
||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/Delegation.kt");
|
||||
|
||||
Reference in New Issue
Block a user