From f275b2a3b727cdd12fe7d5bb1bd3212941dba97e Mon Sep 17 00:00:00 2001 From: lirismankarina Date: Wed, 7 May 2025 18:01:39 +0300 Subject: [PATCH] Fixed test + clang release Signed-off-by: lirismankarina --- ets2panda/compiler/lowering/ets/unboxLowering.cpp | 6 ++++-- .../test/tsconfig/test-decl/typecheck-decl/expected.json | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ets2panda/compiler/lowering/ets/unboxLowering.cpp b/ets2panda/compiler/lowering/ets/unboxLowering.cpp index 29e8d1f375..7c5570d7aa 100644 --- a/ets2panda/compiler/lowering/ets/unboxLowering.cpp +++ b/ets2panda/compiler/lowering/ets/unboxLowering.cpp @@ -753,9 +753,11 @@ struct UnboxVisitor : public ir::visitor::EmptyAstVisitor { break; } } - ES2PANDA_ASSERT(nearestScriptFunction != nullptr); - retStmt->SetArgument(AdjustType(uctx_, retStmt->Argument(), nearestScriptFunction->Signature()->ReturnType())); + if (nearestScriptFunction != nullptr && retStmt != nullptr) { + retStmt->SetArgument( + AdjustType(uctx_, retStmt->Argument(), nearestScriptFunction->Signature()->ReturnType())); + } } void VisitIfStatement(ir::IfStatement *ifStmt) override diff --git a/ets2panda/test/tsconfig/test-decl/typecheck-decl/expected.json b/ets2panda/test/tsconfig/test-decl/typecheck-decl/expected.json index 49f23180a3..c11295340f 100644 --- a/ets2panda/test/tsconfig/test-decl/typecheck-decl/expected.json +++ b/ets2panda/test/tsconfig/test-decl/typecheck-decl/expected.json @@ -1,5 +1,5 @@ { "returncode": 1, - "stdout": "TypeError: Type 'int' is not compatible with type 'String' at property 'location' [main.ets:19:28]\nTypeError: Bad operand type, the types of the operands must be numeric, same enumeration, or boolean type. [main.ets:21:9]\n", + "stdout": "TypeError: Type 'Int' is not compatible with type 'String' at property 'location' [main.ets:19:28]\nTypeError: Operator '!=' cannot be applied to types 'String' and 'Int'. [main.ets:21:9]\n", "stderr": "" } \ No newline at end of file -- Gitee