Skip to content

Commit de003fd

Browse files
tamasvajksmowton
authored andcommitted
Add test for return type of <clinit> methods
1 parent b0ee557 commit de003fd

File tree

6 files changed

+27
-0
lines changed

6 files changed

+27
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
| clinit.kt:0:0:0:0 | <clinit> | file:///usr/local/Cellar/kotlin/1.6.20/libexec/lib/kotlin-stdlib.jar/kotlin/Unit.class:0:0:0:0 | Unit |
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package foo.bar
2+
3+
var topLevelInt: Int = 0
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import java
2+
3+
from Method m
4+
where m.getName() = "<clinit>"
5+
select m, m.getReturnType()

java/ql/test/kotlin/library-tests/methods/exprs.expected

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
| clinit.kt:3:1:3:24 | ...=... | AssignExpr |
2+
| clinit.kt:3:1:3:24 | ...=... | KtInitializerAssignExpr |
3+
| clinit.kt:3:1:3:24 | <set-?> | VarAccess |
4+
| clinit.kt:3:1:3:24 | ClinitKt | TypeAccess |
5+
| clinit.kt:3:1:3:24 | ClinitKt | TypeAccess |
6+
| clinit.kt:3:1:3:24 | ClinitKt | TypeAccess |
7+
| clinit.kt:3:1:3:24 | ClinitKt.topLevelInt | VarAccess |
8+
| clinit.kt:3:1:3:24 | ClinitKt.topLevelInt | VarAccess |
9+
| clinit.kt:3:1:3:24 | ClinitKt.topLevelInt | VarAccess |
10+
| clinit.kt:3:1:3:24 | Unit | TypeAccess |
11+
| clinit.kt:3:1:3:24 | int | TypeAccess |
12+
| clinit.kt:3:1:3:24 | int | TypeAccess |
13+
| clinit.kt:3:1:3:24 | int | TypeAccess |
14+
| clinit.kt:3:24:3:24 | 0 | IntegerLiteral |
115
| methods2.kt:4:1:5:1 | Unit | TypeAccess |
216
| methods2.kt:4:26:4:31 | int | TypeAccess |
317
| methods2.kt:4:34:4:39 | int | TypeAccess |

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
methods
2+
| clinit.kt:0:0:0:0 | ClinitKt | clinit.kt:0:0:0:0 | <clinit> | <clinit>() | |
3+
| clinit.kt:0:0:0:0 | ClinitKt | clinit.kt:3:1:3:24 | getTopLevelInt | getTopLevelInt() | public, static |
4+
| clinit.kt:0:0:0:0 | ClinitKt | clinit.kt:3:1:3:24 | setTopLevelInt | setTopLevelInt(int) | public, static |
25
| methods2.kt:0:0:0:0 | Methods2Kt | methods2.kt:4:1:5:1 | fooBarTopLevelMethod | fooBarTopLevelMethod(int,int) | public, static |
36
| methods2.kt:7:1:10:1 | Class2 | methods2.kt:8:5:9:5 | fooBarClassMethod | fooBarClassMethod(int,int) | public |
47
| methods3.kt:0:0:0:0 | Methods3Kt | methods3.kt:3:1:3:42 | fooBarTopLevelMethodExt | fooBarTopLevelMethodExt(int,int) | public, static |

java/ql/test/kotlin/library-tests/methods/parameters.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
| clinit.kt:3:1:3:24 | setTopLevelInt | clinit.kt:3:1:3:24 | <set-?> | 0 |
12
| methods2.kt:4:1:5:1 | fooBarTopLevelMethod | methods2.kt:4:26:4:31 | x | 0 |
23
| methods2.kt:4:1:5:1 | fooBarTopLevelMethod | methods2.kt:4:34:4:39 | y | 1 |
34
| methods2.kt:8:5:9:5 | fooBarClassMethod | methods2.kt:8:27:8:32 | x | 0 |

0 commit comments

Comments
 (0)