diff src/vim9type.c @ 22494:4c21f7f6f9e3 v8.2.1795

patch 8.2.1795: Vim9: operators && and || have a confusing result Commit: https://github.com/vim/vim/commit/2bb2658bef9fb25b320f87147261b7154494a86f Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 3 22:52:39 2020 +0200 patch 8.2.1795: Vim9: operators && and || have a confusing result Problem: Vim9: operators && and || have a confusing result. Solution: Make the result a boolean.
author Bram Moolenaar <Bram@vim.org>
date Sat, 03 Oct 2020 23:00:04 +0200
parents 0e03ef68e738
children af26fadf333d
line wrap: on
line diff
--- a/src/vim9type.c
+++ b/src/vim9type.c
@@ -360,13 +360,12 @@ typval2type_int(typval_T *tv, garray_T *
 need_convert_to_bool(type_T *type, typval_T *tv)
 {
     return type != NULL && type == &t_bool && tv->v_type != VAR_BOOL
-	    && ((tv->v_lock & VAR_BOOL_OK)
-		|| (tv->v_type == VAR_NUMBER
-		       && (tv->vval.v_number == 0 || tv->vval.v_number == 1)));
+	    && (tv->v_type == VAR_NUMBER
+		       && (tv->vval.v_number == 0 || tv->vval.v_number == 1));
 }
 
 /*
- * Get a type_T for a typval_T and handle VAR_BOOL_OK.
+ * Get a type_T for a typval_T.
  * "type_list" is used to temporarily create types in.
  */
     type_T *
@@ -375,9 +374,8 @@ typval2type(typval_T *tv, garray_T *type
     type_T *type = typval2type_int(tv, type_gap);
 
     if (type != NULL && type != &t_bool
-	    && ((tv->v_type == VAR_NUMBER
-		    && (tv->vval.v_number == 0 || tv->vval.v_number == 1))
-		|| (tv->v_lock & VAR_BOOL_OK)))
+	    && (tv->v_type == VAR_NUMBER
+		    && (tv->vval.v_number == 0 || tv->vval.v_number == 1)))
     {
 	type_T *newtype = get_type_ptr(type_gap);