diff --git a/port/linux/test/parse-test.cpp b/port/linux/test/parse-test.cpp index 0fdb3638d..37383acd6 100644 --- a/port/linux/test/parse-test.cpp +++ b/port/linux/test/parse-test.cpp @@ -3538,3 +3538,19 @@ TEST(parser, branket_issue4) { EXPECT_EQ(pikaMemNow(), 0); } #endif + +TEST(parser, tuple1) { + pikaMemInfo.heapUsedMax = 0; + Args* buffs = New_strBuff(); + char* lines = "(a,b)\n"; + __platform_printf("%s\n", lines); + char* pikaAsm = Parser_multiLineToAsm(buffs, lines); + __platform_printf("%s", pikaAsm); + EXPECT_STREQ(pikaAsm, + "B0\n" + "1 REF a\n" + "1 REF b\n" + "0 RUN\n"); + args_deinit(buffs); + EXPECT_EQ(pikaMemNow(), 0); +} diff --git a/src/PikaVM.c b/src/PikaVM.c index 0b804b471..237415177 100644 --- a/src/PikaVM.c +++ b/src/PikaVM.c @@ -686,9 +686,14 @@ static Arg* VM_instruction_handler_RUN(PikaObj* self, VMState* vs, char* data) { vs->try_error_code == TRY_STATE_INNER) { sub_try_info.try_state = TRY_STATE_INNER; } - /* return arg directly */ if (strEqu(data, "")) { - return_arg = stack_popArg(&(vs->stack)); + if (VMState_getInputArgNum(vs) < 2) { + /* return arg directly */ + return_arg = stack_popArg(&(vs->stack)); + goto exit; + } + /* create a tuple */ + return_arg = VM_instruction_handler_LST(self, vs, ""); goto exit; } /* return tiny obj */ diff --git a/src/PikaVersion.h b/src/PikaVersion.h index 480cf65ca..7f1c3cb62 100644 --- a/src/PikaVersion.h +++ b/src/PikaVersion.h @@ -2,4 +2,4 @@ #define PIKA_VERSION_MINOR 9 #define PIKA_VERSION_MICRO 0 -#define PIKA_EDIT_TIME "2022/07/11 16:37:09" +#define PIKA_EDIT_TIME "2022/07/11 23:32:26"