[vim/vim] Vim9: No errors about if syntax inside def (PR #19263)

1 view
Skip to first unread message

h_east

unread,
Jan 27, 2026, 8:23:22 AM (22 hours ago) Jan 27
to vim/vim, Subscribed

Case 1

  • "E584: :elseif after :else" does not occur. SEGF almost always occurs
def Aaa()
    var a = 3
    if a == 2
    else
    elseif true
    else
    endif
enddef

Case 2

  • "E583: Multiple :else" does not occur.
def Aaa()
    if true
    else
    else
    endif
enddef

Note:
This issue is reported by @todashuta at vim-jp/issue vim-jp/issues#1455 (Note: Japanese lang.)


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/19263

Commit Summary

  • 7d4fcd2 Vim9: No errors about if syntax inside def

File Changes

(2 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19263@github.com>

Yegappan Lakshmanan

unread,
Jan 27, 2026, 1:26:12 PM (17 hours ago) Jan 27
to vim/vim, Subscribed

@yegappan commented on this pull request.


In src/testdir/test_vim9_script.vim:

> @@ -1995,6 +1995,25 @@ def Test_if_elseif_else_fails()
   END
   v9.CheckDefFailure(lines, 'E488:')
 
+
+  lines =<< trim END
+      if true
+      else
+      else
+      endif
+  END
+  v9.CheckDefFailure(lines, 'E583:')

Can you use CheckSourceDefFailure() instead of CheckDefFailure()? The former sources the script from a temporary buffer while the later sources from a temporary file. This makes a difference in the total time it takes to execute all the tests.


In src/testdir/test_vim9_script.vim:

> +      if true
+      else
+      else
+      endif
+  END
+  v9.CheckDefFailure(lines, 'E583:')
+
+  lines =<< trim END
+      var a = 3
+      if a == 2
+      else
+      elseif true
+      else
+      endif
+  END
+  v9.CheckDefFailure(lines, 'E584:')

Can you use CheckSourceDefFailure() instead of CheckDefFailure()?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19263/review/3712785388@github.com>

Reply all
Reply to author
Forward
0 new messages