[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Allow arrays of size zero
From: |
Jose E. Marchesi |
Subject: |
Re: [PATCH] Allow arrays of size zero |
Date: |
Sun, 17 Nov 2019 13:53:42 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Hi John.
* src/pkl-typify.c (PKL_PHRASE_BEGIN_HANDLER): Change bound to accept
zero sized arrays.
Also, adjust the error message and correct the spelling.
---
src/pkl-typify.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/pkl-typify.c b/src/pkl-typify.c
index 86dc651..e28af80 100644
--- a/src/pkl-typify.c
+++ b/src/pkl-typify.c
@@ -2218,10 +2218,10 @@ PKL_PHASE_BEGIN_HANDLER (pkl_typify2_ps_type_array)
if (PKL_AST_TYPE_CODE (bound_type) == PKL_TYPE_INTEGRAL
&& PKL_AST_CODE (bound) == PKL_AST_INTEGER
- && ((int64_t) PKL_AST_INTEGER_VALUE (bound)) <= 0)
+ && ((int64_t) PKL_AST_INTEGER_VALUE (bound)) < 0)
{
PKL_ERROR (PKL_AST_LOC (bound),
- "array dimentions should be > 0");
+ "array dimensions may not be negative");
PKL_TYPIFY_PAYLOAD->errors++;
PKL_PASS_ERROR;
}
Looks good, but can you please also include a test in testsuite/poke.map
mapping a zero-sized array.
Thanks!