diff src/userfunc.c @ 25046:2f702d19013a v8.2.3060

patch 8.2.3060: Vim9: cannot use ternary operator in parenthesis Commit: https://github.com/vim/vim/commit/98f9a5f4cbe6061e09bccf6074afe0a88a504219 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 26 22:22:38 2021 +0200 patch 8.2.3060: Vim9: cannot use ternary operator in parenthesis Problem: Vim9: cannot use ternary operator in parenthesis. Solution: Do not use "=~" for a default argument value. (closes https://github.com/vim/vim/issues/8462)
author Bram Moolenaar <Bram@vim.org>
date Sat, 26 Jun 2021 22:30:05 +0200
parents a9a21631c090
children 8f2262c72178
line wrap: on
line diff
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -275,9 +275,10 @@ get_function_args(
 		break;
 
 	    // Recognize " = expr" but not " == expr".  A lambda can have
-	    // "(a = expr" but "(a == expr" is not a lambda.
+	    // "(a = expr" but "(a == expr" and "(a =~ expr" are not a lambda.
 	    np = skipwhite(p);
-	    if (*np == '=' && np[1] != '=' && default_args != NULL)
+	    if (*np == '=' && np[1] != '=' && np[1] != '~'
+						       && default_args != NULL)
 	    {
 		typval_T	rettv;