diff --git a/parser_library/src/expressions/conditional_assembly/ca_operator_unary.cpp b/parser_library/src/expressions/conditional_assembly/ca_operator_unary.cpp index c301797a7..6e3477f79 100644 --- a/parser_library/src/expressions/conditional_assembly/ca_operator_unary.cpp +++ b/parser_library/src/expressions/conditional_assembly/ca_operator_unary.cpp @@ -66,7 +66,7 @@ void ca_function_unary_operator::resolve_expression_tree(ca_expression_ctx expr_ expr_kind = expr_ctx.kind; m_expr_ctx = expr_ctx; expr_ctx.kind = ca_common_expr_policy::get_operands_type(function, expr_ctx.kind); - expr->resolve_expression_tree(m_expr_ctx, diags); + expr->resolve_expression_tree(expr_ctx, diags); } context::SET_t ca_function_unary_operator::operation(context::SET_t operand, const evaluation_context& eval_ctx) const diff --git a/parser_library/test/expressions/character_expression_test.cpp b/parser_library/test/expressions/character_expression_test.cpp index d1d15b179..acda5366e 100644 --- a/parser_library/test/expressions/character_expression_test.cpp +++ b/parser_library/test/expressions/character_expression_test.cpp @@ -323,4 +323,33 @@ TEST(character_expression, invalid_expression) // // EXPECT_TRUE(a.diags().empty()); // EXPECT_EQ(get_var_value(a.hlasm_ctx(), "C"), "VENFG"); -//} \ No newline at end of file +//} + +TEST(character_expression, valid_function) +{ + std::string input = + R"( +&A SETA 210 +&C SETC (BYTE &A) +)"; + analyzer a(input); + a.analyze(); + a.collect_diags(); + + EXPECT_TRUE(a.diags().empty()); + EXPECT_EQ(get_var_value(a.hlasm_ctx(), "C"), "K"); +} + +TEST(character_expression, invalid_function) +{ + std::string input = + R"( +&A SETC 'X' +&C SETC (BYTE &A) +)"; + analyzer a(input); + a.analyze(); + a.collect_diags(); + + EXPECT_TRUE(matches_message_codes(a.diags(), { "CE012" })); +} \ No newline at end of file