fixed call arg precedence bug in last arg callable scenario

This commit is contained in:
sergeych committed 2025-11-27 08:15:06 +01:00
1 parent f0fc7ddd84
commit 83825a9272
3 files changed
+224 -58

No files matched your search

@@ -3544,6 +3544,40 @@ class ScriptTest {
""".trimIndent())
}
@Test
fun testCallAndResultOrder() = runTest {
eval("""
import lyng.stdlib
fun test(a="a", b="b", c="c") { [a, b, c] }
// the parentheses here are in fact unnecessary:
val ok1 = (test { void }).last()
assert( ok1 is Callable)
// it should work without them, as the call test() {} must be executed
// first, then the result should be used to call methods on it:
// the parentheses here are in fact unnecessary:
val ok2 = test { void }.last()
assert( ok2 is Callable)
""".trimIndent())
}
// @Test
// fun namedArgsProposal() = runTest {
// eval("""
// import lyng.stdlib
//
// fun test(a="a", b="b", c="c") { [a, b, c] }
//
// val l = (test{ void }).last()
// println(l)
//
// """.trimIndent())
// }
// @Ignore
// @Test