Compare commits
No commits in common. "104fd6b517a81bf9190dd4e0c2fc0e94249f5379" and "f2b99fe23bcf88832241477ea1e662186f86dd29" have entirely different histories.
104fd6b517
...
f2b99fe23b
@ -2247,7 +2247,7 @@ class Compiler(
|
||||
throw ScriptError(cc.currentPos(), "try block must have either catch or finally clause or both")
|
||||
|
||||
val stmtPos = body.pos
|
||||
val tryStatement = object : Statement() {
|
||||
return object : Statement() {
|
||||
override val pos: Pos = stmtPos
|
||||
override suspend fun execute(scope: Scope): Obj {
|
||||
var result: Obj = ObjVoid
|
||||
@ -2296,7 +2296,6 @@ class Compiler(
|
||||
return result
|
||||
}
|
||||
}
|
||||
return TryStatement(tryStatement, stmtPos)
|
||||
}
|
||||
|
||||
private fun parseEnumDeclaration(isExtern: Boolean = false): Statement {
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright 2026 Sergey S. Chernov
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.sergeych.lyng
|
||||
|
||||
import net.sergeych.lyng.obj.Obj
|
||||
|
||||
class TryStatement(
|
||||
private val delegate: Statement,
|
||||
private val startPos: Pos,
|
||||
) : Statement() {
|
||||
override val pos: Pos = startPos
|
||||
|
||||
override suspend fun execute(scope: Scope): Obj {
|
||||
return delegate.execute(scope)
|
||||
}
|
||||
}
|
||||
@ -78,23 +78,6 @@ class BytecodeCompiler(
|
||||
is VarDeclStatement -> compileVarDecl(name, stmt)
|
||||
is net.sergeych.lyng.ThrowStatement -> compileThrowStatement(name, stmt)
|
||||
is net.sergeych.lyng.ExtensionPropertyDeclStatement -> compileExtensionPropertyDecl(name, stmt)
|
||||
is net.sergeych.lyng.TryStatement -> {
|
||||
val value = emitStatementEval(stmt)
|
||||
builder.emit(Opcode.RET, value.slot)
|
||||
val localCount = maxOf(nextSlot, value.slot + 1) - scopeSlotCount
|
||||
builder.build(
|
||||
name,
|
||||
localCount,
|
||||
addrCount = nextAddrSlot,
|
||||
returnLabels = returnLabels,
|
||||
scopeSlotDepths,
|
||||
scopeSlotIndices,
|
||||
scopeSlotNames,
|
||||
localSlotNames,
|
||||
localSlotMutables,
|
||||
localSlotDepths
|
||||
)
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
@ -217,7 +200,6 @@ class BytecodeCompiler(
|
||||
is AssignOpRef -> compileAssignOp(ref) ?: compileEvalRef(ref)
|
||||
is AssignIfNullRef -> compileAssignIfNull(ref)
|
||||
is IncDecRef -> compileIncDec(ref, true)
|
||||
is RangeRef -> compileRangeRef(ref)
|
||||
is ConditionalRef -> compileConditional(ref)
|
||||
is ElvisRef -> compileElvis(ref)
|
||||
is CallRef -> compileCall(ref)
|
||||
@ -315,7 +297,12 @@ class BytecodeCompiler(
|
||||
builder.emit(Opcode.NEG_REAL, a.slot, out)
|
||||
CompiledValue(out, SlotType.REAL)
|
||||
}
|
||||
else -> compileEvalRef(ref)
|
||||
else -> {
|
||||
val obj = ensureObjSlot(a)
|
||||
val methodId = builder.addConst(BytecodeConst.StringVal("negate"))
|
||||
builder.emit(Opcode.CALL_VIRTUAL, obj.slot, methodId, 0, 0, out)
|
||||
CompiledValue(out, SlotType.OBJ)
|
||||
}
|
||||
}
|
||||
UnaryOp.NOT -> {
|
||||
when (a.type) {
|
||||
@ -325,7 +312,13 @@ class BytecodeCompiler(
|
||||
builder.emit(Opcode.INT_TO_BOOL, a.slot, tmp)
|
||||
builder.emit(Opcode.NOT_BOOL, tmp, out)
|
||||
}
|
||||
SlotType.OBJ, SlotType.UNKNOWN -> return compileEvalRef(ref)
|
||||
SlotType.OBJ, SlotType.UNKNOWN -> {
|
||||
val obj = ensureObjSlot(a)
|
||||
val methodId = builder.addConst(BytecodeConst.StringVal("logicalNot"))
|
||||
val tmpObj = allocSlot()
|
||||
builder.emit(Opcode.CALL_VIRTUAL, obj.slot, methodId, 0, 0, tmpObj)
|
||||
builder.emit(Opcode.OBJ_TO_BOOL, tmpObj, out)
|
||||
}
|
||||
else -> return null
|
||||
}
|
||||
CompiledValue(out, SlotType.BOOL)
|
||||
@ -335,7 +328,10 @@ class BytecodeCompiler(
|
||||
builder.emit(Opcode.INV_INT, a.slot, out)
|
||||
return CompiledValue(out, SlotType.INT)
|
||||
}
|
||||
return compileEvalRef(ref)
|
||||
val obj = ensureObjSlot(a)
|
||||
val methodId = builder.addConst(BytecodeConst.StringVal("bitNot"))
|
||||
builder.emit(Opcode.CALL_VIRTUAL, obj.slot, methodId, 0, 0, out)
|
||||
CompiledValue(out, SlotType.OBJ)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1217,34 +1213,6 @@ class BytecodeCompiler(
|
||||
return CompiledValue(dst, SlotType.OBJ)
|
||||
}
|
||||
|
||||
private fun compileRangeRef(ref: RangeRef): CompiledValue? {
|
||||
val startSlot = if (ref.left != null) {
|
||||
val start = compileRefWithFallback(ref.left, null, Pos.builtIn) ?: return null
|
||||
ensureObjSlot(start).slot
|
||||
} else {
|
||||
val slot = allocSlot()
|
||||
builder.emit(Opcode.CONST_NULL, slot)
|
||||
updateSlotType(slot, SlotType.OBJ)
|
||||
slot
|
||||
}
|
||||
val endSlot = if (ref.right != null) {
|
||||
val end = compileRefWithFallback(ref.right, null, Pos.builtIn) ?: return null
|
||||
ensureObjSlot(end).slot
|
||||
} else {
|
||||
val slot = allocSlot()
|
||||
builder.emit(Opcode.CONST_NULL, slot)
|
||||
updateSlotType(slot, SlotType.OBJ)
|
||||
slot
|
||||
}
|
||||
val inclusiveSlot = allocSlot()
|
||||
val inclusiveId = builder.addConst(BytecodeConst.Bool(ref.isEndInclusive))
|
||||
builder.emit(Opcode.CONST_BOOL, inclusiveId, inclusiveSlot)
|
||||
val dst = allocSlot()
|
||||
builder.emit(Opcode.MAKE_RANGE, startSlot, endSlot, inclusiveSlot, dst)
|
||||
updateSlotType(dst, SlotType.OBJ)
|
||||
return CompiledValue(dst, SlotType.OBJ)
|
||||
}
|
||||
|
||||
private fun compileAssignOpBinary(
|
||||
targetType: SlotType,
|
||||
rhs: CompiledValue,
|
||||
@ -1297,8 +1265,7 @@ class BytecodeCompiler(
|
||||
}
|
||||
|
||||
private fun compileIncDec(ref: IncDecRef, wantResult: Boolean): CompiledValue? {
|
||||
val target = ref.target as? LocalSlotRef
|
||||
if (target != null) {
|
||||
val target = ref.target as? LocalSlotRef ?: return null
|
||||
if (!allowLocalSlots) return null
|
||||
if (!target.isMutable || target.isDelegated) return null
|
||||
val slot = resolveSlot(target) ?: return null
|
||||
@ -1443,30 +1410,6 @@ class BytecodeCompiler(
|
||||
}
|
||||
}
|
||||
|
||||
val indexTarget = ref.target as? IndexRef ?: return null
|
||||
if (indexTarget.optionalRef) return null
|
||||
val receiver = compileRefWithFallback(indexTarget.targetRef, null, Pos.builtIn) ?: return null
|
||||
val index = compileRefWithFallback(indexTarget.indexRef, null, Pos.builtIn) ?: return null
|
||||
val current = allocSlot()
|
||||
builder.emit(Opcode.GET_INDEX, receiver.slot, index.slot, current)
|
||||
updateSlotType(current, SlotType.OBJ)
|
||||
val oneSlot = allocSlot()
|
||||
val oneId = builder.addConst(BytecodeConst.ObjRef(ObjInt.One))
|
||||
builder.emit(Opcode.CONST_OBJ, oneId, oneSlot)
|
||||
val result = allocSlot()
|
||||
val op = if (ref.isIncrement) Opcode.ADD_OBJ else Opcode.SUB_OBJ
|
||||
if (wantResult && ref.isPost) {
|
||||
val old = allocSlot()
|
||||
builder.emit(Opcode.MOVE_OBJ, current, old)
|
||||
builder.emit(op, current, oneSlot, result)
|
||||
builder.emit(Opcode.SET_INDEX, receiver.slot, index.slot, result)
|
||||
return CompiledValue(old, SlotType.OBJ)
|
||||
}
|
||||
builder.emit(op, current, oneSlot, result)
|
||||
builder.emit(Opcode.SET_INDEX, receiver.slot, index.slot, result)
|
||||
return CompiledValue(result, SlotType.OBJ)
|
||||
}
|
||||
|
||||
private fun compileConditional(ref: ConditionalRef): CompiledValue? {
|
||||
val condition = compileRefWithFallback(ref.condition, SlotType.BOOL, Pos.builtIn) ?: return null
|
||||
if (condition.type != SlotType.BOOL) return null
|
||||
@ -1882,7 +1825,6 @@ class BytecodeCompiler(
|
||||
is net.sergeych.lyng.ClassDeclStatement -> emitStatementEval(target)
|
||||
is net.sergeych.lyng.FunctionDeclStatement -> emitStatementEval(target)
|
||||
is net.sergeych.lyng.EnumDeclStatement -> emitStatementEval(target)
|
||||
is net.sergeych.lyng.TryStatement -> emitStatementEval(target)
|
||||
is net.sergeych.lyng.BreakStatement -> compileBreak(target)
|
||||
is net.sergeych.lyng.ContinueStatement -> compileContinue(target)
|
||||
is net.sergeych.lyng.ReturnStatement -> compileReturn(target)
|
||||
|
||||
@ -105,7 +105,6 @@ class BytecodeStatement private constructor(
|
||||
is net.sergeych.lyng.ClassDeclStatement -> false
|
||||
is net.sergeych.lyng.FunctionDeclStatement -> false
|
||||
is net.sergeych.lyng.EnumDeclStatement -> false
|
||||
is net.sergeych.lyng.TryStatement -> false
|
||||
else -> true
|
||||
}
|
||||
}
|
||||
|
||||
@ -182,8 +182,6 @@ class CmdBuilder {
|
||||
listOf(OperandKind.SLOT, OperandKind.SLOT, OperandKind.SLOT)
|
||||
Opcode.SET_INDEX ->
|
||||
listOf(OperandKind.SLOT, OperandKind.SLOT, OperandKind.SLOT)
|
||||
Opcode.MAKE_RANGE ->
|
||||
listOf(OperandKind.SLOT, OperandKind.SLOT, OperandKind.SLOT, OperandKind.SLOT)
|
||||
Opcode.LIST_LITERAL ->
|
||||
listOf(OperandKind.CONST, OperandKind.SLOT, OperandKind.COUNT, OperandKind.SLOT)
|
||||
Opcode.GET_THIS_MEMBER ->
|
||||
@ -227,7 +225,6 @@ class CmdBuilder {
|
||||
Opcode.BOX_OBJ -> CmdBoxObj(operands[0], operands[1])
|
||||
Opcode.OBJ_TO_BOOL -> CmdObjToBool(operands[0], operands[1])
|
||||
Opcode.RANGE_INT_BOUNDS -> CmdRangeIntBounds(operands[0], operands[1], operands[2], operands[3])
|
||||
Opcode.MAKE_RANGE -> CmdMakeRange(operands[0], operands[1], operands[2], operands[3])
|
||||
Opcode.CHECK_IS -> CmdCheckIs(operands[0], operands[1], operands[2])
|
||||
Opcode.ASSERT_IS -> CmdAssertIs(operands[0], operands[1])
|
||||
Opcode.RET_LABEL -> CmdRetLabel(operands[0], operands[1])
|
||||
|
||||
@ -72,7 +72,6 @@ object CmdDisassembler {
|
||||
is CmdCheckIs -> Opcode.CHECK_IS to intArrayOf(cmd.objSlot, cmd.typeSlot, cmd.dst)
|
||||
is CmdAssertIs -> Opcode.ASSERT_IS to intArrayOf(cmd.objSlot, cmd.typeSlot)
|
||||
is CmdRangeIntBounds -> Opcode.RANGE_INT_BOUNDS to intArrayOf(cmd.src, cmd.startSlot, cmd.endSlot, cmd.okSlot)
|
||||
is CmdMakeRange -> Opcode.MAKE_RANGE to intArrayOf(cmd.startSlot, cmd.endSlot, cmd.inclusiveSlot, cmd.dst)
|
||||
is CmdResolveScopeSlot -> Opcode.RESOLVE_SCOPE_SLOT to intArrayOf(cmd.scopeSlot, cmd.addrSlot)
|
||||
is CmdLoadObjAddr -> Opcode.LOAD_OBJ_ADDR to intArrayOf(cmd.addrSlot, cmd.dst)
|
||||
is CmdStoreObjAddr -> Opcode.STORE_OBJ_ADDR to intArrayOf(cmd.src, cmd.addrSlot)
|
||||
@ -214,7 +213,7 @@ object CmdDisassembler {
|
||||
listOf(OperandKind.SLOT, OperandKind.SLOT)
|
||||
Opcode.CHECK_IS ->
|
||||
listOf(OperandKind.SLOT, OperandKind.SLOT, OperandKind.SLOT)
|
||||
Opcode.RANGE_INT_BOUNDS, Opcode.MAKE_RANGE ->
|
||||
Opcode.RANGE_INT_BOUNDS ->
|
||||
listOf(OperandKind.SLOT, OperandKind.SLOT, OperandKind.SLOT, OperandKind.SLOT)
|
||||
Opcode.RET_LABEL, Opcode.THROW ->
|
||||
listOf(OperandKind.CONST, OperandKind.SLOT)
|
||||
|
||||
@ -141,21 +141,6 @@ class CmdConstBool(internal val constId: Int, internal val dst: Int) : Cmd() {
|
||||
}
|
||||
}
|
||||
|
||||
class CmdMakeRange(
|
||||
internal val startSlot: Int,
|
||||
internal val endSlot: Int,
|
||||
internal val inclusiveSlot: Int,
|
||||
internal val dst: Int,
|
||||
) : Cmd() {
|
||||
override suspend fun perform(frame: CmdFrame) {
|
||||
val start = frame.slotToObj(startSlot)
|
||||
val end = frame.slotToObj(endSlot)
|
||||
val inclusive = frame.slotToObj(inclusiveSlot).toBool()
|
||||
frame.storeObjResult(dst, ObjRange(start, end, isEndInclusive = inclusive))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
class CmdConstNull(internal val dst: Int) : Cmd() {
|
||||
override suspend fun perform(frame: CmdFrame) {
|
||||
frame.setObj(dst, ObjNull)
|
||||
|
||||
@ -29,7 +29,6 @@ enum class Opcode(val code: Int) {
|
||||
CONST_NULL(0x09),
|
||||
BOX_OBJ(0x0A),
|
||||
RANGE_INT_BOUNDS(0x0B),
|
||||
MAKE_RANGE(0x0C),
|
||||
|
||||
INT_TO_REAL(0x10),
|
||||
REAL_TO_INT(0x11),
|
||||
|
||||
@ -20,7 +20,7 @@ import net.sergeych.lyng.eval
|
||||
import kotlin.test.Ignore
|
||||
import kotlin.test.Test
|
||||
|
||||
@Ignore("TODO(bytecode-only): uses fallback (coroutines)")
|
||||
@Ignore("TODO(bytecode-only): uses fallback")
|
||||
class TestCoroutines {
|
||||
|
||||
@Test
|
||||
|
||||
@ -27,7 +27,7 @@ import kotlin.test.assertEquals
|
||||
import kotlin.test.assertIs
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
@Ignore("TODO(bytecode-only): exception rethrow mismatch")
|
||||
@Ignore("TODO(bytecode-only): uses fallback (try/catch)")
|
||||
class EmbeddingExceptionTest {
|
||||
|
||||
@Test
|
||||
|
||||
@ -24,7 +24,7 @@ import net.sergeych.lyng.eval
|
||||
import kotlin.test.Ignore
|
||||
import kotlin.test.Test
|
||||
|
||||
@Ignore("TODO(bytecode-only): uses fallback (C3 MRO)")
|
||||
@Ignore("TODO(bytecode-only): uses fallback")
|
||||
class MIC3MroTest {
|
||||
|
||||
@Test
|
||||
|
||||
@ -26,6 +26,7 @@ import kotlin.test.Test
|
||||
import kotlin.test.assertFails
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
@Ignore("TODO(bytecode-only): uses fallback (cast failure message)")
|
||||
class MIDiagnosticsTest {
|
||||
|
||||
@Test
|
||||
@ -86,7 +87,6 @@ class MIDiagnosticsTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("TODO(bytecode-only): cast message mismatch")
|
||||
fun castFailureMentionsActualAndTargetTypes() = runTest {
|
||||
val ex = assertFails {
|
||||
eval(
|
||||
|
||||
@ -20,7 +20,7 @@ import net.sergeych.lyng.eval
|
||||
import kotlin.test.Ignore
|
||||
import kotlin.test.Test
|
||||
|
||||
@Ignore("TODO(bytecode-only): uses fallback (qualified MI)")
|
||||
@Ignore("TODO(bytecode-only): uses fallback")
|
||||
class MIQualifiedDispatchTest {
|
||||
|
||||
@Test
|
||||
|
||||
@ -26,6 +26,7 @@ import kotlin.test.Ignore
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertFailsWith
|
||||
|
||||
@Ignore("TODO(bytecode-only): uses fallback")
|
||||
class NamedArgsTest {
|
||||
|
||||
@Test
|
||||
|
||||
@ -186,7 +186,6 @@ class ScriptTest {
|
||||
assertEquals(0, ti.cancelCount)
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testForLoopCancelsOnBreak() = runTest {
|
||||
val scope = Script.newScope()
|
||||
@ -202,7 +201,6 @@ class ScriptTest {
|
||||
assertEquals(1, ti.cancelCount)
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testForLoopCancelsOnException() = runTest {
|
||||
val scope = Script.newScope()
|
||||
@ -851,7 +849,6 @@ class ScriptTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testWhileBlockIsolation1() = runTest {
|
||||
eval(
|
||||
@ -868,7 +865,6 @@ class ScriptTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testWhileBlockIsolation2() = runTest {
|
||||
assertFails {
|
||||
@ -885,7 +881,6 @@ class ScriptTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testWhileBlockIsolation3() = runTest {
|
||||
eval(
|
||||
@ -911,7 +906,6 @@ class ScriptTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun whileNonLocalBreakTest() = runTest {
|
||||
assertEquals(
|
||||
@ -2278,7 +2272,6 @@ class ScriptTest {
|
||||
assertEquals("111", r.toString())
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun doWhileValuesTest() = runTest {
|
||||
eval(
|
||||
@ -2323,7 +2316,6 @@ class ScriptTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun doWhileValuesLabelTest() = runTest {
|
||||
withTimeout(5.seconds) {
|
||||
@ -2357,7 +2349,6 @@ class ScriptTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testSimpleWhen() = runTest {
|
||||
eval(
|
||||
@ -2382,7 +2373,6 @@ class ScriptTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testWhenIs() = runTest {
|
||||
eval(
|
||||
@ -2413,7 +2403,6 @@ class ScriptTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testWhenIn() = runTest {
|
||||
eval(
|
||||
@ -2461,7 +2450,6 @@ class ScriptTest {
|
||||
assertEquals("$~", l[0].value)
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testMatchOperator() = runTest {
|
||||
eval(
|
||||
@ -2481,7 +2469,6 @@ class ScriptTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testMatchingOperator2() = runTest {
|
||||
eval(
|
||||
@ -2510,7 +2497,6 @@ class ScriptTest {
|
||||
// )
|
||||
// }
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testWhenSample1() = runTest {
|
||||
eval(
|
||||
@ -2530,7 +2516,6 @@ class ScriptTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testWhenSample2() = runTest {
|
||||
eval(
|
||||
@ -2802,7 +2787,6 @@ class ScriptTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testParallels2() = runTest {
|
||||
withContext(Dispatchers.Default) {
|
||||
@ -2850,7 +2834,6 @@ class ScriptTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testExtend() = runTest() {
|
||||
eval(
|
||||
@ -3866,7 +3849,6 @@ class ScriptTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun binarySearchTest2() = runTest {
|
||||
eval(
|
||||
@ -4001,7 +3983,6 @@ class ScriptTest {
|
||||
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testIterableMinMax() = runTest {
|
||||
eval(
|
||||
@ -4377,7 +4358,6 @@ class ScriptTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testHangOnPrintlnInMethods() = runTest {
|
||||
eval(
|
||||
@ -4585,7 +4565,6 @@ class ScriptTest {
|
||||
}
|
||||
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testDestructuringAssignment() = runTest {
|
||||
eval(
|
||||
@ -4735,7 +4714,6 @@ class ScriptTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testUserClassExceptions() = runTest {
|
||||
eval(
|
||||
@ -4809,7 +4787,6 @@ class ScriptTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testExceptionToString() = runTest {
|
||||
eval(
|
||||
@ -4848,7 +4825,6 @@ class ScriptTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testRaiseAsError() = runTest {
|
||||
var x = evalNamed(
|
||||
@ -4884,7 +4860,6 @@ class ScriptTest {
|
||||
assertContains(x1.message!!, "tc2")
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testFilterStackTrace() = runTest {
|
||||
var x = try {
|
||||
@ -4910,7 +4885,6 @@ class ScriptTest {
|
||||
}
|
||||
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testLyngToKotlinExceptionHelpers() = runTest {
|
||||
var x = evalNamed(
|
||||
@ -4968,7 +4942,6 @@ class ScriptTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testLazyLocals() = runTest() {
|
||||
eval(
|
||||
@ -5135,7 +5108,6 @@ class ScriptTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testForInIterableDisasm() = runTest {
|
||||
val scope = Script.newScope()
|
||||
@ -5163,7 +5135,6 @@ class ScriptTest {
|
||||
println("[DEBUG_LOG] type(\"153\")=${r2.inspect(scope)}")
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testForInIterableBytecode() = runTest {
|
||||
val result = eval(
|
||||
@ -5179,7 +5150,6 @@ class ScriptTest {
|
||||
assertEquals(ObjInt(12), result)
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testForInIterableUnknownTypeDisasm() = runTest {
|
||||
val scope = Script.newScope()
|
||||
@ -5260,7 +5230,6 @@ class ScriptTest {
|
||||
assertEquals(ObjFalse, scope.eval("isInt(\"42\")"))
|
||||
}
|
||||
|
||||
@Ignore("Bytecode: unsupported or incorrect behavior")
|
||||
@Test
|
||||
fun testFilterBug() = runTest {
|
||||
eval(
|
||||
|
||||
@ -20,9 +20,9 @@ import net.sergeych.lyng.eval
|
||||
import kotlin.test.Ignore
|
||||
import kotlin.test.Test
|
||||
|
||||
@Ignore("TODO(bytecode-only): uses fallback")
|
||||
class StdlibTest {
|
||||
@Test
|
||||
@Ignore("TODO(bytecode-only): iterable filter mismatch")
|
||||
fun testIterableFilter() = runTest {
|
||||
eval("""
|
||||
assertEquals([2,4,6,8], (1..8).filter{ println("call2"); it % 2 == 0 }.toList() )
|
||||
@ -33,7 +33,6 @@ class StdlibTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("TODO(bytecode-only): range first/last mismatch")
|
||||
fun testFirstLast() = runTest {
|
||||
eval("""
|
||||
assertEquals(1, (1..8).first )
|
||||
@ -42,7 +41,6 @@ class StdlibTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("TODO(bytecode-only): range take mismatch")
|
||||
fun testTake() = runTest {
|
||||
eval("""
|
||||
val r = 1..8
|
||||
@ -52,7 +50,6 @@ class StdlibTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("TODO(bytecode-only): any/all mismatch")
|
||||
fun testAnyAndAll() = runTest {
|
||||
eval("""
|
||||
assert( [1,2,3].any { it > 2 } )
|
||||
@ -90,7 +87,6 @@ class StdlibTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("TODO(bytecode-only): range drop mismatch")
|
||||
fun testDrop() = runTest {
|
||||
eval("""
|
||||
assertEquals([7,8], (1..8).drop(6).toList() )
|
||||
@ -99,7 +95,6 @@ class StdlibTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("TODO(bytecode-only): flatten/filter mismatch")
|
||||
fun testFlattenAndFilter() = runTest {
|
||||
eval("""
|
||||
assertEquals([1,2,3,4,5,6], [1,3,5].map { [it, it+1] }.flatten() )
|
||||
@ -115,7 +110,6 @@ class StdlibTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("TODO(bytecode-only): count mismatch")
|
||||
fun testCount() = runTest {
|
||||
eval("""
|
||||
assertEquals(5, (1..10).toList().count { it % 2 == 1 } )
|
||||
@ -123,7 +117,6 @@ class StdlibTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("TODO(bytecode-only): with mismatch")
|
||||
fun testWith() = runTest {
|
||||
eval("""
|
||||
class Person(val name, var age)
|
||||
|
||||
@ -31,6 +31,7 @@ import kotlin.test.assertContentEquals
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
@Ignore("TODO(bytecode-only): uses fallback (unary minus, MI, simple types)")
|
||||
class LynonTests {
|
||||
|
||||
@Test
|
||||
@ -703,7 +704,6 @@ class Wallet( id, ownerKey, balance=0, createdAt=Instant.now().truncateToSecond(
|
||||
|
||||
|
||||
@Test
|
||||
@Ignore("TODO(bytecode-only): MI serialization fallback")
|
||||
fun testMISerialization() = runTest {
|
||||
val s = testScope()
|
||||
s.eval("""
|
||||
|
||||
@ -41,6 +41,7 @@ suspend fun executeSampleTests(fileName: String) {
|
||||
}
|
||||
}
|
||||
|
||||
@Ignore("TODO(bytecode-only): uses fallback")
|
||||
class SamplesTest {
|
||||
|
||||
@Test
|
||||
|
||||
@ -27,7 +27,7 @@ import kotlin.test.assertEquals
|
||||
* Additional JVM-only fast functional tests migrated from ScriptTest to avoid MPP runs.
|
||||
* Keep each test fast (<1s) and with clear assertions.
|
||||
*/
|
||||
@Ignore("TODO(bytecode-only): uses fallback (binarySearch/logical chains)")
|
||||
@Ignore("TODO(bytecode-only): uses fallback (logical ops/binarySearch)")
|
||||
class ScriptSubsetJvmTest_Additions {
|
||||
private suspend fun evalInt(code: String): Long = (Scope().eval(code) as ObjInt).value
|
||||
private suspend fun evalList(code: String): List<Any?> = (Scope().eval(code) as ObjList).list.map { (it as? ObjInt)?.value ?: it }
|
||||
@ -105,7 +105,7 @@ class ScriptSubsetJvmTest_Additions {
|
||||
}
|
||||
|
||||
|
||||
@Ignore("TODO(bytecode-only): hangs (while/continue?)")
|
||||
@Ignore("TODO(bytecode-only): uses fallback")
|
||||
class ScriptSubsetJvmTest_Additions2 {
|
||||
private suspend fun evalInt(code: String): Long = (Scope().eval(code) as ObjInt).value
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user