Skip to content

Commit

Permalink
include type arguments in reference elements's referencedName/toString
Browse files Browse the repository at this point in the history
Fixes #1200
  • Loading branch information
evant committed Feb 16, 2024
1 parent 14d7bf8 commit 7587d98
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ class KSClassifierReferenceImpl private constructor(val ktUserType: KtUserType)
}

override fun referencedName(): String {
return ktUserType.referencedName ?: ""
val typeArgs = typeArguments
return if (typeArgs.isEmpty()) {
ktUserType.referencedName ?: ""
} else {
ktUserType.referencedName + typeArgs.joinToString(prefix = "<", postfix = ">") { it.type?.toString() ?: "*" }
}
}

override val qualifier: KSClassifierReference? by lazy {
Expand Down
2 changes: 1 addition & 1 deletion test-utils/testData/api/referenceElement.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// TEST PROCESSOR: ReferenceElementProcessor
// EXPECTED:
// KSClassifierReferenceImpl: Qualifier of B is A
// KSClassifierReferenceImpl: Qualifier of C is A
// KSClassifierReferenceImpl: Qualifier of C<Int> is A<String>
// KSClassifierReferenceImpl: Qualifier of Int is null
// KSClassifierReferenceImpl: Qualifier of String is null
// KSClassifierReferenceDescriptorImpl: Qualifier of Int is null
Expand Down

0 comments on commit 7587d98

Please sign in to comment.