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.
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 44cdb09..d357fc4 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -3813,10 +3813,8 @@
case ISN_STORE:
--ectx->ec_stack.ga_len;
tv = STACK_TV_VAR(iptr->isn_arg.number);
- if (STACK_TV_BOT(0)->v_type == VAR_TYPEALIAS)
+ if (check_typval_is_value(STACK_TV_BOT(0)) == FAIL)
{
- semsg(_(e_using_typealias_as_value),
- STACK_TV_BOT(0)->vval.v_typealias->ta_name);
clear_tv(STACK_TV_BOT(0));
goto on_error;
}