diff src/vim9compile.c @ 33913:a259471e74fe v9.0.2156

patch 9.0.2156: Vim9: can use typealias in assignment Commit: https://github.com/vim/vim/commit/9ed53752df1020a6881ac68d1bde2852c9a680aa Author: Ernie Rael <errael@raelity.com> Date: Mon Dec 11 17:40:46 2023 +0100 patch 9.0.2156: Vim9: can use typealias in assignment Problem: Vim9: can use typealias in an assignment Solution: Generate errors when class/typealias involved in the rhs of an assignment closes: #13637 Signed-off-by: Ernie Rael <errael@raelity.com> Signed-off-by: Christian Brabandt <cb@256bit.org> Generate errors when class/typealias involved in assignment.
author Christian Brabandt <cb@256bit.org>
date Mon, 11 Dec 2023 17:45:06 +0100
parents 2172872dfbcd
children 45a50fd59a73
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2797,6 +2797,8 @@ compile_assignment(
 
 		rhs_type = cctx->ctx_type_stack.ga_len == 0 ? &t_void
 						  : get_type_on_stack(cctx, 0);
+		if (check_type_is_value(rhs_type) == FAIL)
+		    goto theend;
 		if (lhs.lhs_lvar != NULL && (is_decl || !lhs.lhs_has_type))
 		{
 		    if ((rhs_type->tt_type == VAR_FUNC