Ljubljana, Slovenia
From Bor Grošelj Simić to ~sircmpwn/hare-dev
Signed-off-by: Bor Grošelj Simić <bgs@turminal.net> --- v1 -> v2: rebase src/check.c | 187 +++++++++++++++++++++------------------------------- 1 file changed, 75 insertions(+), 112 deletions(-) diff --git a/src/check.c b/src/check.c index 6d8be47..7b03e63 100644 --- a/src/check.c +++ b/src/check.c @@ -719,6 +719,74 @@ check_expr_assert(struct context *ctx, } } [message trimmed]
From Bor Grošelj Simić to ~sircmpwn/hare-dev
References: https://todo.sr.ht/~sircmpwn/hare/787 Signed-off-by: Bor Grošelj Simić <bgs@turminal.net> --- v1 -> v2: rebase and mention of #787 src/check.c | 28 +++++++++++----------------- tests/01-arrays.ha | 7 +++++++ tests/03-pointers.ha | 40 ++++++++++++++++++++++++++++++++++++++++ tests/04-strings.ha | 17 +++++++++++++++++ tests/06-structs.ha | 9 ++++++++- tests/08-slices.ha | 3 +++ tests/09-funcs.ha | 4 ++++ tests/13-tagged.ha | 12 ++++++++++++ [message trimmed]
From Bor Grošelj Simić to ~sircmpwn/hare-dev
Closes: https://todo.sr.ht/~sircmpwn/hare/574 Signed-off-by: Bor Grošelj Simić <bgs@turminal.net> --- include/check.h | 3 +- src/check.c | 167 ++++++++++++++++++++++++------------------------ src/gen.c | 2 +- src/typedef.c | 2 +- 4 files changed, 88 insertions(+), 86 deletions(-) diff --git a/include/check.h b/include/check.h index b81bceb..6d93da2 100644 --- a/include/check.h +++ b/include/check.h @@ -39,6 +39,7 @@ struct context { [message trimmed]
From Bor Grošelj Simić to ~sircmpwn/hare-dev
@test functions were previously allowed to have errors as long as -T wasn't passed to harec Signed-off-by: Bor Grošelj Simić <bgs@turminal.net> --- src/check.c | 11 ++++------- tests/09-funcs.ha | 4 ++++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/check.c b/src/check.c index e506fb7..a8c58e6 100644 --- a/src/check.c +++ b/src/check.c @@ -3310,11 +3310,6 @@ check_function(struct context *ctx, [message trimmed]
From Bor Grošelj Simić to ~sircmpwn/hare-dev
they were all simple enough to be merged into check_declaration Signed-off-by: Bor Grošelj Simić <bgs@turminal.net> --- src/check.c | 242 +++++++++++++++++--------------------------- src/scope.c | 2 +- tests/11-globals.ha | 5 + 3 files changed, 99 insertions(+), 150 deletions(-) diff --git a/src/check.c b/src/check.c index e2867de..e506fb7 100644 --- a/src/check.c +++ b/src/check.c @@ -3303,46 +3303,21 @@ check_expression(struct context *ctx, [message trimmed]
From Bor Grošelj Simić to ~sircmpwn/hare-dev
the values were the same anyway Signed-off-by: Bor Grošelj Simić <bgs@turminal.net> --- include/ast.h | 12 ++++++------ include/check.h | 12 +++--------- src/check.c | 48 ++++++++++++++++++++++++------------------------ src/gen.c | 8 ++++---- src/parse.c | 8 ++++---- src/type_store.c | 2 +- src/typedef.c | 18 +++++++++--------- 7 files changed, 51 insertions(+), 57 deletions(-) diff --git a/include/ast.h b/include/ast.h [message trimmed]
From Bor Grošelj Simić to ~sircmpwn/hare-dev
in case of expandable arrays, the assignability check was called too late which made some invalid initializers pass through check Signed-off-by: Bor Grošelj Simić <bgs@turminal.net> --- src/check.c | 43 ++++++++++++++++++++++--------------------- tests/11-globals.ha | 4 ++++ 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/src/check.c b/src/check.c index c977542..cfc5b44 100644 --- a/src/check.c +++ b/src/check.c @@ -3639,19 +3639,21 @@ resolve_const(struct context *ctx, struct incomplete_declaration *idecl) [message trimmed]
From Bor Grošelj Simić to ~sircmpwn/hare-dev
Signed-off-by: Bor Grošelj Simić <bgs@turminal.net> --- src/check.c | 65 +++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 19 deletions(-) diff --git a/src/check.c b/src/check.c index 8a2ca2e..c977542 100644 --- a/src/check.c +++ b/src/check.c @@ -3358,8 +3358,9 @@ check_function(struct context *ctx, struct ast_function_parameters *params = afndecl->prototype.params; while (params) { if (!params->name) { error_norec(ctx, params->loc, NULL,[message trimmed]
From Bor Grošelj Simić to ~sircmpwn/hare-dev
Instead of calling expect with a condition, places with nonrecoverable errors can make a proper error branch and put a call to error_norec there. Signed-off-by: Bor Grošelj Simić <bgs@turminal.net> --- src/check.c | 177 ++++++++++++++++++++++++++++------------------------ 1 file changed, 97 insertions(+), 80 deletions(-) diff --git a/src/check.c b/src/check.c index b1f3427..8a2ca2e 100644 --- a/src/check.c +++ b/src/check.c @@ -4,6 +4,7 @@ [message trimmed]
From Bor Grošelj Simić to ~sircmpwn/hare-dev
The general idea here is that there is some context available in resolve* that we want to avoid keeping around until check* or worse, recomputing it in check*. These patches achieve this by making resolve* do all the work, thus eliminating the need for a separate set of functions, except for check_function, which is big and complicated and needs to remain as it is. Bor Grošelj Simić (7): check: replace expect with error_norec replace some of the unrecoverable errors with regular errors fix const assignability issues merge AST_DECL* and DECL* remove check_const, check_global and check_type always check @test functions create declarations in resolve_*