diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt index a82af365b96..4cc80977871 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinFileExtractor.kt @@ -170,6 +170,7 @@ open class KotlinFileExtractor( is IrProperty -> return getPropertyLabel(element) is IrField -> return getFieldLabel(element) is IrEnumEntry -> return getEnumEntryLabel(element) + is IrTypeAlias -> return getTypeAliasLabel(element) // Fresh entities: is IrBody -> return null diff --git a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt index ccd82785b16..db25b2b84a7 100644 --- a/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt +++ b/java/kotlin-extractor/src/main/kotlin/KotlinUsesExtractor.kt @@ -1574,7 +1574,7 @@ open class KotlinUsesExtractor( fun useEnumEntry(ee: IrEnumEntry): Label = tw.getLabelFor(getEnumEntryLabel(ee)) - private fun getTypeAliasLabel(ta: IrTypeAlias): String { + fun getTypeAliasLabel(ta: IrTypeAlias): String { val parentId = useDeclarationParent(ta.parent, true) return "@\"type_alias;{$parentId};${ta.name.asString()}\"" } diff --git a/java/ql/test/kotlin/library-tests/comments/comments.expected b/java/ql/test/kotlin/library-tests/comments/comments.expected index 740f50d8b56..904df44e5db 100644 --- a/java/ql/test/kotlin/library-tests/comments/comments.expected +++ b/java/ql/test/kotlin/library-tests/comments/comments.expected @@ -8,6 +8,7 @@ comments | comments.kt:35:5:35:34 | /** Medium is in the middle */ | /** Medium is in the middle */ | | comments.kt:37:5:37:23 | /** This is high */ | /** This is high */ | | comments.kt:42:5:44:6 | /**\n * A variable.\n */ | /**\n * A variable.\n */ | +| comments.kt:48:1:50:3 | /**\n * A type alias comment\n */ | /**\n * A type alias comment\n */ | commentOwners | comments.kt:4:1:11:3 | /**\n * A group of *members*.\n *\n * This class has no useful logic; it's just a documentation example.\n *\n * @property name the name of this group.\n * @constructor Creates an empty group.\n */ | comments.kt:12:1:31:1 | Group | | comments.kt:4:1:11:3 | /**\n * A group of *members*.\n *\n * This class has no useful logic; it's just a documentation example.\n *\n * @property name the name of this group.\n * @constructor Creates an empty group.\n */ | comments.kt:12:1:31:1 | Group | @@ -18,6 +19,7 @@ commentOwners | comments.kt:35:5:35:34 | /** Medium is in the middle */ | comments.kt:36:5:36:14 | Medium | | comments.kt:37:5:37:23 | /** This is high */ | comments.kt:38:5:38:11 | High | | comments.kt:42:5:44:6 | /**\n * A variable.\n */ | comments.kt:45:5:45:13 | int a | +| comments.kt:48:1:50:3 | /**\n * A type alias comment\n */ | comments.kt:51:1:51:24 | MyType | commentSections | comments.kt:1:1:1:25 | /** Kdoc with no owner */ | Kdoc with no owner | | comments.kt:4:1:11:3 | /**\n * A group of *members*.\n *\n * This class has no useful logic; it's just a documentation example.\n *\n * @property name the name of this group.\n * @constructor Creates an empty group.\n */ | A group of *members*.\n\nThis class has no useful logic; it's just a documentation example.\n\n | @@ -28,8 +30,10 @@ commentSections | comments.kt:35:5:35:34 | /** Medium is in the middle */ | Medium is in the middle | | comments.kt:37:5:37:23 | /** This is high */ | This is high | | comments.kt:42:5:44:6 | /**\n * A variable.\n */ | A variable. | +| comments.kt:48:1:50:3 | /**\n * A type alias comment\n */ | A type alias comment | commentSectionContents | A group of *members*.\n\nThis class has no useful logic; it's just a documentation example.\n\n | A group of *members*.\n\nThis class has no useful logic; it's just a documentation example.\n\n | +| A type alias comment | A type alias comment | | A variable. | A variable. | | Adds a [member] to this group.\n | Adds a [member] to this group.\n | | Creates an empty group. | Creates an empty group. | diff --git a/java/ql/test/kotlin/library-tests/comments/comments.kt b/java/ql/test/kotlin/library-tests/comments/comments.kt index 0981f19e7fa..e208d8eb44c 100644 --- a/java/ql/test/kotlin/library-tests/comments/comments.kt +++ b/java/ql/test/kotlin/library-tests/comments/comments.kt @@ -44,3 +44,8 @@ fun fn1() { */ val a = 1 } + +/** + * A type alias comment + */ +typealias MyType = Group