Skip to content

Commit b4eb4ec

Browse files
committed
Kotlin: Add test case for top level local class extraction
1 parent cee0e8e commit b4eb4ec

File tree

6 files changed

+36
-1
lines changed

6 files changed

+36
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| Top which doesn't have exactly 1 toString |

java/ql/test/kotlin/library-tests/classes/PrintAst.expected

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ classes.kt:
77
# 32| 0: [Parameter] s
88
# 32| 0: [TypeAccess] String
99
# 32| 5: [BlockStmt] { ... }
10+
# 158| 2: [Method] fn1
11+
# 158| 3: [TypeAccess] Unit
12+
# 158| 5: [BlockStmt] { ... }
13+
# 162| 3: [Method] fn2
14+
# 162| 3: [TypeAccess] Object
15+
# 162| 5: [BlockStmt] { ... }
16+
# 162| 0: [ReturnStmt] return ...
17+
# 162| 0: [StmtExpr] <Stmt>
18+
# 162| 0: [BlockStmt] { ... }
19+
# 162| 1: [ExprStmt] <Expr>;
20+
# 162| 0: [ClassInstanceExpr] new (...)
21+
# 162| -3: [TypeAccess] Object
1022
# 2| 2: [Class] ClassOne
1123
# 2| 1: [Constructor] ClassOne
1224
# 2| 5: [BlockStmt] { ... }
@@ -558,6 +570,16 @@ classes.kt:
558570
# 153| 0: [ClassInstanceExpr] new Cl01(...)
559571
# 153| -3: [TypeAccess] Cl01
560572
# 153| 0: [TypeAccess] U1
573+
# 159| 27: [Class] X
574+
# 159| 1: [Constructor] X
575+
# 159| 5: [BlockStmt] { ... }
576+
# 159| 0: [SuperConstructorInvocationStmt] super(...)
577+
# 159| 1: [BlockStmt] { ... }
578+
# 162| 28: [Class]
579+
# 162| 1: [Constructor]
580+
# 162| 5: [BlockStmt] { ... }
581+
# 162| 0: [SuperConstructorInvocationStmt] super(...)
582+
# 162| 1: [BlockStmt] { ... }
561583
generic_anonymous.kt:
562584
# 0| [CompilationUnit] generic_anonymous
563585
# 0| 1: [Class] Generic_anonymousKt

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
| classes.kt:141:13:145:13 | Cl1 | Cl0$Cl1 | final, private |
4040
| classes.kt:150:1:156:1 | Cl00 | Cl00 | final, public |
4141
| classes.kt:151:5:155:5 | Cl01 | Cl00$Cl01 | final, public |
42+
| classes.kt:159:5:159:14 | X | X | final, private |
43+
| classes.kt:162:13:162:22 | | | final, private |
4244
| generic_anonymous.kt:0:0:0:0 | Generic_anonymousKt | Generic_anonymousKt | final, public |
4345
| generic_anonymous.kt:1:1:9:1 | Generic | Generic | final, private |
4446
| generic_anonymous.kt:3:19:5:3 | new Object(...) { ... } | <anonymous class> | final, private |

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,10 @@ class Cl00<U0> {
153153
val x = Cl01<U1>()
154154
}
155155
}
156-
}
156+
}
157+
158+
fun fn1() {
159+
class X {}
160+
}
161+
162+
fun fn2() = object { }

java/ql/test/kotlin/library-tests/classes/ctorCalls.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ superCall
3939
| classes.kt:141:13:145:13 | super(...) |
4040
| classes.kt:150:1:156:1 | super(...) |
4141
| classes.kt:151:5:155:5 | super(...) |
42+
| classes.kt:159:5:159:14 | super(...) |
43+
| classes.kt:162:13:162:22 | super(...) |
4244
| generic_anonymous.kt:1:1:9:1 | super(...) |
4345
| generic_anonymous.kt:3:19:5:3 | super(...) |
4446
| generic_anonymous.kt:15:1:33:1 | super(...) |

java/ql/test/kotlin/library-tests/classes/superTypes.expected

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
| classes.kt:141:13:145:13 | Cl1 | file://<external>/Object.class:0:0:0:0 | Object |
4545
| classes.kt:150:1:156:1 | Cl00 | file://<external>/Object.class:0:0:0:0 | Object |
4646
| classes.kt:151:5:155:5 | Cl01 | file://<external>/Object.class:0:0:0:0 | Object |
47+
| classes.kt:159:5:159:14 | X | file://<external>/Object.class:0:0:0:0 | Object |
48+
| classes.kt:162:13:162:22 | | file://<external>/Object.class:0:0:0:0 | Object |
4749
| file://<external>/C1$<no name provided>$Local3.class:0:0:0:0 | Local3<Integer> | file://<external>/Object.class:0:0:0:0 | Object |
4850
| file://<external>/C1$Local1.class:0:0:0:0 | Local1<Integer> | file://<external>/Object.class:0:0:0:0 | Object |
4951
| file://<external>/C1$Local2.class:0:0:0:0 | Local2<Integer> | file://<external>/Object.class:0:0:0:0 | Object |

0 commit comments

Comments
 (0)