Skip to content

Commit 7927e1d

Browse files
committed
Kotlin: Add test case for comment on an anonymous object
1 parent 9979fa3 commit 7927e1d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

java/ql/test/kotlin/library-tests/comments/comments.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ comments
1414
| comments.kt:65:9:67:11 | /**\n * An accessor comment\n */ | /**\n * An accessor comment\n */ |
1515
| comments.kt:71:9:73:11 | /**\n * An anonymous function comment\n */ | /**\n * An anonymous function comment\n */ |
1616
| comments.kt:79:9:81:11 | /**\n * A local function comment\n */ | /**\n * A local function comment\n */ |
17+
| comments.kt:88:10:90:11 | /**\n * An anonymous object comment\n */ | /**\n * An anonymous object comment\n */ |
1718
commentOwners
1819
| 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 |
1920
| 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 |
@@ -32,6 +33,7 @@ commentOwners
3233
| comments.kt:71:9:73:11 | /**\n * An anonymous function comment\n */ | comments.kt:70:5:76:10 | l |
3334
| comments.kt:71:9:73:11 | /**\n * An anonymous function comment\n */ | comments.kt:70:5:76:10 | l |
3435
| comments.kt:79:9:81:11 | /**\n * A local function comment\n */ | comments.kt:82:9:82:24 | localFn |
36+
| comments.kt:88:10:90:11 | /**\n * An anonymous object comment\n */ | comments.kt:87:15:92:5 | |
3537
commentNoOwners
3638
| comments.kt:1:1:1:25 | /** Kdoc with no owner */ |
3739
| comments.kt:24:9:24:25 | // A line comment |
@@ -52,6 +54,7 @@ commentSections
5254
| comments.kt:65:9:67:11 | /**\n * An accessor comment\n */ | An accessor comment |
5355
| comments.kt:71:9:73:11 | /**\n * An anonymous function comment\n */ | An anonymous function comment |
5456
| comments.kt:79:9:81:11 | /**\n * A local function comment\n */ | A local function comment |
57+
| comments.kt:88:10:90:11 | /**\n * An anonymous object comment\n */ | An anonymous object comment |
5558
commentSectionContents
5659
| 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 |
5760
| A local function comment | A local function comment |
@@ -61,6 +64,7 @@ commentSectionContents
6164
| Adds a [member] to this group.\n | Adds a [member] to this group.\n |
6265
| An accessor comment | An accessor comment |
6366
| An anonymous function comment | An anonymous function comment |
67+
| An anonymous object comment | An anonymous object comment |
6468
| An init block comment | An init block comment |
6569
| Creates an empty group. | Creates an empty group. |
6670
| Kdoc with no owner | Kdoc with no owner |

java/ql/test/kotlin/library-tests/comments/comments.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class InitBlock {
5757
init { }
5858
}
5959

60-
class X {
60+
open class X {
6161
/**
6262
* A prop comment
6363
*/
@@ -82,3 +82,12 @@ class X {
8282
fun localFn() {}
8383
}
8484
}
85+
86+
class XX {
87+
fun f() = object :
88+
/**
89+
* An anonymous object comment
90+
*/
91+
X() {
92+
}
93+
}

0 commit comments

Comments
 (0)