patch 8.2.0683: Vim9: parsing type does not always work
Problem: Vim9: parsing type does not always work.
Solution: Handle func type without return value. Test more closures.
Fix type check offset. Fix garbage collection.
diff --git a/src/vim9compile.c b/src/vim9compile.c
index eb84e35..a4a71de 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -824,7 +824,7 @@
isn->isn_arg.type.ct_off = offset;
// type becomes vartype
- ((type_T **)stack->ga_data)[stack->ga_len - 1] = vartype;
+ ((type_T **)stack->ga_data)[stack->ga_len + offset] = vartype;
return OK;
}
@@ -1671,8 +1671,13 @@
if (*p == ',')
p = skipwhite(p + 1);
}
- if (*p == ')' && p[1] == ':')
- p = skip_type(skipwhite(p + 2));
+ if (*p == ')')
+ {
+ if (p[1] == ':')
+ p = skip_type(skipwhite(p + 2));
+ else
+ p = skipwhite(p + 1);
+ }
}
return p;