File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed
java/ql/test/kotlin/library-tests/vararg Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change
1
+ diag
2
+ | test.kt:55:15:55:35 | Unexpected IrVararg |
1
3
varargsParams
2
4
| test.kt:8:15:8:28 | xs | file://:0:0:0:0 | int[] |
3
5
| test.kt:12:26:12:39 | xs | file://:0:0:0:0 | int[] |
4
6
| test.kt:20:24:20:37 | xs | file://:0:0:0:0 | int[] |
5
7
| test.kt:24:50:24:63 | xs | file://:0:0:0:0 | int[] |
6
8
| test.kt:28:37:28:50 | xs | file://:0:0:0:0 | int[] |
9
+ | test.kt:50:5:50:31 | s | file://:0:0:0:0 | String[] |
7
10
explicitVarargsArguments
8
11
| test.kt:12:50:12:51 | xs | test.kt:12:44:12:52 | this(...) |
9
12
| test.kt:38:25:38:29 | array | test.kt:38:5:38:30 | funWithOnlyVarArgs(...) |
10
13
| test.kt:39:41:39:45 | array | test.kt:39:5:39:46 | funWithArgsAndVarArgs(...) |
11
14
| test.kt:40:34:40:38 | array | test.kt:40:5:40:49 | funWithMiddleVarArgs(...) |
12
15
| test.kt:44:27:44:31 | array | test.kt:44:5:44:32 | new HasVarargConstructor(...) |
13
16
| test.kt:45:34:45:38 | array | test.kt:45:5:45:39 | new HasVarargConstructor(...) |
17
+ | test.kt:55:15:55:35 | tmp0_s | test.kt:55:13:55:43 | new X(...) |
14
18
implicitVarargsArguments
15
19
| intList.kt:3:21:3:22 | 10 | intList.kt:3:14:3:31 | listOf(...) | 0 |
16
20
| intList.kt:3:25:3:26 | 11 | intList.kt:3:14:3:31 | listOf(...) | 1 |
@@ -78,3 +82,5 @@ implicitVarargsArguments
78
82
| test.kt:44:5:44:32 | new HasVarargConstructor(...) | 0 | test.kt:44:27:44:31 | array |
79
83
| test.kt:45:5:45:39 | new HasVarargConstructor(...) | 0 | test.kt:45:27:45:29 | foo |
80
84
| test.kt:45:5:45:39 | new HasVarargConstructor(...) | 1 | test.kt:45:34:45:38 | array |
85
+ | test.kt:55:13:55:43 | new X(...) | 0 | test.kt:55:42:55:42 | 1 |
86
+ | test.kt:55:13:55:43 | new X(...) | 1 | test.kt:55:15:55:35 | tmp0_s |
Original file line number Diff line number Diff line change 1
1
import java
2
+ import semmle.code.java.Diagnostics
3
+
4
+ query predicate diag ( Diagnostic d ) {
5
+ d .getMessage ( ) = "Unexpected IrVararg"
6
+ }
2
7
3
8
query predicate varargsParams ( Parameter p , Type t ) {
4
9
p .getCallable ( ) .fromSource ( ) and
Original file line number Diff line number Diff line change 1
1
2
2
fun sink (sunk : Int ) {
3
-
3
+
4
4
}
5
5
6
6
open class HasVarargConstructor {
@@ -44,3 +44,13 @@ fun myFun() {
44
44
HasVarargConstructor (* array)
45
45
HasVarargConstructor (" foo" , * array)
46
46
}
47
+
48
+ open class X (
49
+ i : Int ,
50
+ public vararg val s : String
51
+ ) { }
52
+
53
+ fun fn (sl : List <String >) {
54
+ // reordered args:
55
+ val x = X (s = sl.toTypedArray(), i = 1 )
56
+ }
You can’t perform that action at this time.
0 commit comments