diff --git a/LYNG_AI_SPEC.md b/LYNG_AI_SPEC.md index 5d69fff..63a13ca 100644 --- a/LYNG_AI_SPEC.md +++ b/LYNG_AI_SPEC.md @@ -94,7 +94,7 @@ m += "c" => 3 val [first, middle..., last] = [1, 2, 3, 4, 5] // Safe Navigation and Elvis -val companyName = person?.job?.company?.name ?? "Freelancer" +val companyName = person?.job?.company?.name ?: "Freelancer" ``` ## 8. Standard Library Discovery diff --git a/lynglib/src/commonTest/kotlin/OOTest.kt b/lynglib/src/commonTest/kotlin/OOTest.kt index 6021f37..a5c6834 100644 --- a/lynglib/src/commonTest/kotlin/OOTest.kt +++ b/lynglib/src/commonTest/kotlin/OOTest.kt @@ -868,4 +868,39 @@ class OOTest { assertEquals(44L, fn.invoke(scope, fn).toKotlin(s2)) assertEquals(45L, fn.invoke(s2, fn).toKotlin(s2)) } + + @Test + fun testToStringWithTransients() = runTest { + eval(""" + class C(amount,@Transient transient=0) { + val l by lazy { transient + amount } + fun lock() { + if( transient < 10 ) + C(amount).also { it.transient = transient + 10 } + else + this + } + } + println(C(1)) + println(C(1).lock().amount) + println(C(1).lock().lock().amount) + """.trimIndent()) + } + @Test + fun testToJsonString() = runTest { + eval(""" + class C(amount,@Transient transient=0) { + val l by lazy { transient + amount } + fun lock() { + if( transient < 10 ) + C(amount).also { it.transient = transient + 10 } + else + this + } + } + println(C(1)) + println(C(1).lock().amount) + println(C(1).lock().lock().amount) + """.trimIndent()) + } } \ No newline at end of file diff --git a/site/src/jsMain/kotlin/HomePage.kt b/site/src/jsMain/kotlin/HomePage.kt index 9c5a36f..f67bf03 100644 --- a/site/src/jsMain/kotlin/HomePage.kt +++ b/site/src/jsMain/kotlin/HomePage.kt @@ -62,7 +62,7 @@ fun HomePage() { var config = null config ?= { timeout: 30 } // Assign only if null - val timeout = config?.timeout ?? 60 + val timeout = config?.timeout ?: 60 println("Timeout is: " + timeout) """.trimIndent(), """