Skip to content

Commit 05f70e9

Browse files
authored
Merge pull request github#10633 from igfoo/igfoo/ministdlib
Kotlin: Add a ministdlib test
2 parents 4dcf4f2 + 01fe465 commit 05f70e9

File tree

5 files changed

+46
-0
lines changed

5 files changed

+46
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package kotlin
2+
3+
/*
4+
This is a mini standard library replacement, to make it easy to write
5+
very small tests that create very small databases.
6+
7+
If you define a class, then you will need to also define any members that
8+
compiler/ir/ir.psi2ir/src/org/jetbrains/kotlin/psi2ir/descriptors/IrBuiltInsOverDescriptors.kt
9+
expects (e.g. with findFunctions(...).first) to exist.
10+
*/
11+
12+
public open class Any {
13+
fun toString(): String { return this.toString() }
14+
open operator fun equals(other: Any?): Boolean { return this.equals(other) }
15+
}
16+
17+
public class String {
18+
operator fun plus(other: Any?): String { return this.plus(other) }
19+
}
20+
21+
public class Boolean {
22+
operator fun not(): Boolean { return this.not() }
23+
}
24+
25+
public class Int {
26+
operator fun plus(other: Int): Int { return this.plus(other) }
27+
operator fun times(other: Int): Int { return this.times(other) }
28+
infix fun xor(other: Int): Int { return this.xor(other) }
29+
}
30+
31+
public object Unit {
32+
}
33+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
class MyClass {}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
| MiniStdLib.kt:12:1:15:1 | Any |
2+
| MiniStdLib.kt:17:1:19:1 | String |
3+
| MiniStdLib.kt:21:1:23:1 | Boolean |
4+
| MiniStdLib.kt:25:1:29:1 | Int |
5+
| MiniStdLib.kt:31:1:32:1 | Unit |
6+
| MyClass.kt:1:1:1:16 | MyClass |
7+
| file://:0:0:0:0 | FakeKotlinClass |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import java
2+
3+
from Class c
4+
select c
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
codeql-extractor-kotlin-options: -no-jdk -no-reflect -no-stdlib -Xallow-kotlin-package

0 commit comments

Comments
 (0)