patch 8.2.2390: Vim9: using positive offset is unexpected
Problem: Vim9: using positive offset is unexpected.
Solution: Use int8_T instead of char. (James McCoy)
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 2fad4ac..ae5cb12 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -826,10 +826,8 @@
if ((isn = generate_instr(cctx, ISN_CHECKTYPE)) == NULL)
return FAIL;
isn->isn_arg.type.ct_type = alloc_type(expected);
- // Use the negated offset so that it's always positive. Some systems don't
- // support negative numbers for "char".
- isn->isn_arg.type.ct_off = (char)-offset;
- isn->isn_arg.type.ct_arg_idx = argidx;
+ isn->isn_arg.type.ct_off = (int8_T)offset;
+ isn->isn_arg.type.ct_arg_idx = (int8_T)argidx;
// type becomes expected
((type_T **)stack->ga_data)[stack->ga_len + offset] = expected;