Merge pull request #10129 from tamasvajk/kotlin-fix-comment-type-alias

Kotlin: Extract type alias doc comments
This commit is contained in:
Tamás Vajk
2022-08-22 16:10:50 +02:00
committed by GitHub
4 changed files with 11 additions and 1 deletions

View File

@@ -170,6 +170,7 @@ open class KotlinFileExtractor(
is IrProperty -> return getPropertyLabel(element) is IrProperty -> return getPropertyLabel(element)
is IrField -> return getFieldLabel(element) is IrField -> return getFieldLabel(element)
is IrEnumEntry -> return getEnumEntryLabel(element) is IrEnumEntry -> return getEnumEntryLabel(element)
is IrTypeAlias -> return getTypeAliasLabel(element)
// Fresh entities: // Fresh entities:
is IrBody -> return null is IrBody -> return null

View File

@@ -1574,7 +1574,7 @@ open class KotlinUsesExtractor(
fun useEnumEntry(ee: IrEnumEntry): Label<out DbField> = fun useEnumEntry(ee: IrEnumEntry): Label<out DbField> =
tw.getLabelFor(getEnumEntryLabel(ee)) tw.getLabelFor(getEnumEntryLabel(ee))
private fun getTypeAliasLabel(ta: IrTypeAlias): String { fun getTypeAliasLabel(ta: IrTypeAlias): String {
val parentId = useDeclarationParent(ta.parent, true) val parentId = useDeclarationParent(ta.parent, true)
return "@\"type_alias;{$parentId};${ta.name.asString()}\"" return "@\"type_alias;{$parentId};${ta.name.asString()}\""
} }

View File

@@ -8,6 +8,7 @@ comments
| comments.kt:35:5:35:34 | /** Medium is in the middle */ | /** Medium is in the middle */ | | 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: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: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 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 |
| 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: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: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: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 commentSections
| comments.kt:1:1:1:25 | /** Kdoc with no owner */ | Kdoc with no owner | | 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 | | 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: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:37:5:37:23 | /** This is high */ | This is high |
| comments.kt:42:5:44:6 | /**\n * A variable.\n */ | A variable. | | 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 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 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. | | A variable. | A variable. |
| Adds a [member] to this group.\n | Adds a [member] to this group.\n | | Adds a [member] to this group.\n | Adds a [member] to this group.\n |
| Creates an empty group. | Creates an empty group. | | Creates an empty group. | Creates an empty group. |

View File

@@ -44,3 +44,8 @@ fun fn1() {
*/ */
val a = 1 val a = 1
} }
/**
* A type alias comment
*/
typealias MyType = Group