Skip to content

Commit

Permalink
[Analysis API] Handle ConeFlexibleType when parsing to KaAnnotationValue
Browse files Browse the repository at this point in the history
  • Loading branch information
ting-yuan authored and teamcity committed Aug 2, 2024
1 parent bd222b7 commit afbb511
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 1 deletion.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ internal object FirAnnotationValueConverter {
}

is FirGetClassCall -> {
val coneType = getTargetType()?.fullyExpandedType(session)
val coneType = getTargetType()?.fullyExpandedType(session)?.lowerBoundIfFlexible()

if (coneType is ConeClassLikeType && coneType !is ConeErrorType) {
val classId = coneType.lookupTag.classId
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
KaNamedClassSymbol:
annotations: []
classId: JavaClass
classKind: CLASS
companionObject: null
compilerVisibility: Unknown
contextReceivers: []
isActual: false
isData: false
isExpect: false
isExternal: false
isFun: false
isInline: false
isInner: false
location: TOP_LEVEL
modality: OPEN
name: JavaClass
origin: JAVA_SOURCE
superTypes: [
KaUsualClassType:
annotations: []
typeArguments: []
type: kotlin/Any
]
typeParameters: []
visibility: UNKNOWN
getContainingFileSymbol: null
getContainingModule: KaSourceModule "Sources of main"
annotationApplicableTargets: null
deprecationStatus: null
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// MODULE: main
// FILE: JavaClass.java
import java.lang.annotation.*;

@Target(ElementType.TYPE_USE)
@interface MyAnnotation {
Class<?> typeParam();
}
class JavaClass extends @MyAnnotation(typeParam = String.class) Object {}

// FILE: main.kt
fun test() {
val x: J<caret>avaClass = TODO()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
open class JavaClass
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
KaNamedClassSymbol:
annotations: []
classId: JavaClass
classKind: CLASS
companionObject: null
compilerVisibility: PackageVisibility
contextReceivers: []
isActual: false
isData: false
isExpect: false
isExternal: false
isFun: false
isInline: false
isInner: false
location: TOP_LEVEL
modality: OPEN
name: JavaClass
origin: JAVA_SOURCE
superTypes: [
KaUsualClassType:
annotations: [
MyAnnotation(typeParam = kotlin.String::class)
psi: null
]
typeArguments: []
type: @R|MyAnnotation|(typeParam = <getClass>(<getClass>(R|kotlin/String!|))) kotlin/Any
]
typeParameters: []
visibility: PACKAGE_PRIVATE
getContainingFileSymbol: null
getContainingModule: KaSourceModule "Sources of main"
annotationApplicableTargets: null
deprecationStatus: null

0 comments on commit afbb511

Please sign in to comment.