Skip to content

Commit

Permalink
Raise error when formal part is illegal. Issue nickg#1091
Browse files Browse the repository at this point in the history
  • Loading branch information
NikLeberg committed Dec 10, 2024
1 parent 4062b25 commit e256da8
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -3123,8 +3123,15 @@ static tree_t p_formal_part(type_t *signature)
}
break;

default:
case T_RECORD_REF:
case T_ARRAY_REF:
case T_ARRAY_SLICE:
case T_TYPE_CONV:
break;

default:
parse_error(CURRENT_LOC, "illegal formal designator");
return error_expr();
}

return name;
Expand Down
11 changes: 11 additions & 0 deletions test/parse/issue1091.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
entity adderN is
port(addend: in boolean);
end;

architecture struct_adderN of adderN is
component adder is
port(addend: in boolean);
end component;
begin
u: adder port map(addend'last_value => addend);
end;
19 changes: 19 additions & 0 deletions test/test_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -7035,6 +7035,24 @@ START_TEST(test_issue1090)
}
END_TEST

START_TEST(test_issue1091)
{
input_from_file(TESTDIR "/parse/issue1091.vhd");

const error_t expect[] = {
{ 10, "illegal formal designator" },
{ -1, NULL }
};
expect_errors(expect);

parse_and_check(T_ENTITY, T_ARCH);

fail_unless(parse() == NULL);

check_expected_errors();
}
END_TEST

Suite *get_parse_tests(void)
{
Suite *s = suite_create("parse");
Expand Down Expand Up @@ -7205,6 +7223,7 @@ Suite *get_parse_tests(void)
tcase_add_test(tc_core, test_protected3);
tcase_add_test(tc_core, test_pkgindecl);
tcase_add_test(tc_core, test_issue1090);
tcase_add_test(tc_core, test_issue1091);
suite_add_tcase(s, tc_core);

return s;
Expand Down

0 comments on commit e256da8

Please sign in to comment.