Update compile-time resolution and tests

This commit is contained in:
sergeych committed 2026-02-03 02:07:29 +03:00
1 parent 8f60a84e3b
commit 523b9d338b
46 files changed
+3771 -967

No files matched your search

@@ -37,7 +37,7 @@ class ScriptSubsetJvmTest_Additions3 {
@Test
fun controlFlow_when_and_ifElse_jvm_only() = runBlocking {
val code = """
fun classify(x) {
fun classify(x: Int) {
when(x) {
0 -> 100
1 -> 200
@@ -60,9 +60,9 @@ class ScriptSubsetJvmTest_Additions3 {
val code = """
class Box() {
var xs = [10,20,30]
fun get(i) { xs[i] }
fun get(i: Int) { xs[i] }
}
val maybe = null
val maybe: Box? = null
val b = Box()
// optional on null yields null
val r1 = maybe?.xs
@@ -77,7 +77,7 @@ class ScriptSubsetJvmTest_Additions3 {
@Test
fun exceptions_try_catch_finally_jvm_only() = runBlocking {
val code = """
fun risky(x) { if (x == 0) throw "boom" else 7 }
fun risky(x: Int) { if (x == 0) throw "boom" else 7 }
var s = 0
try { s = risky(0) } catch (e) { s = 1 } finally { s = s + 2 }
s
@@ -95,7 +95,7 @@ class ScriptSubsetJvmTest_Additions3 {
private var hidden = 9
fun getPub() { pub }
fun getHidden() { hidden }
fun setPub(v) { pub = v }
fun setPub(v: Int) { pub = v }
}
val c = C()
c.setPub(5)
@@ -109,7 +109,7 @@ class ScriptSubsetJvmTest_Additions3 {
@Test
fun collections_insert_remove_and_maps_jvm_only() = runBlocking {
val code = """
val lst = []
val lst: List<Int> = []
lst.insertAt(0, 2)
lst.insertAt(0, 1)
lst.removeAt(1)
@@ -144,8 +144,8 @@ class ScriptSubsetJvmTest_Additions3 {
try {
PerfFlags.SCOPE_POOL = true
val code = """
fun outer(a) {
fun inner(b) { if (b == 0) throw "err" else a + b }
fun outer(a: Int) {
fun inner(b: Int) { if (b == 0) throw "err" else a + b }
try { inner(0) } catch (e) { a + 2 }
}
outer(5)