runtime(vim): Update base-syntax, match multiline return types

fixes #14442.
closes: #16914

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/syntax/generator/vim.vim.base b/runtime/syntax/generator/vim.vim.base
index eff438b..cf73244 100644
--- a/runtime/syntax/generator/vim.vim.base
+++ b/runtime/syntax/generator/vim.vim.base
@@ -2,7 +2,7 @@
 " Language:	   Vim script
 " Maintainer:	   Hirohito Higashi <h.east.727 ATMARK gmail.com>
 "	   Doug Kearns <dougkearns@gmail.com>
-" Last Change:	   2025 Mar 13
+" Last Change:	   2025 Mar 17
 " Former Maintainer: Charles E. Campbell
 
 " DO NOT CHANGE DIRECTLY.
@@ -402,8 +402,16 @@
 syn match	vimFunction	"\<fu\%[nction]\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)\+"	contains=@vimFuncList skipwhite nextgroup=vimFuncParams
 syn match	vimDef	"\<def\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)\+"		contains=@vimDefList            nextgroup=vimDefParams
 
-syn match	vimFuncComment	contained	+".*+ skipwhite skipempty nextgroup=vimFuncBody,vimEndfunction
-syn match	vimDefComment	contained	"#.*" skipwhite skipempty nextgroup=vimDefBody,vimEnddef
+syn region	vimFuncComment	contained
+      \ start=+".*+
+      \ skip=+\n\s*\\\|\n\s*"\\ +
+      \ end="$"
+      \ skipwhite skipempty nextgroup=vimFuncBody,vimEndfunction
+syn region	vimDefComment	contained
+      \ start="#.*"
+      \ skip=+\n\s*\\\|\n\s*#\\ +
+      \ end="$"
+      \ skipwhite skipempty nextgroup=vimDefBody,vimEnddef
 
 syn match	vimFuncBang	contained	"!"
 syn match	vimFuncSID	contained	"\c<sid>"
@@ -435,15 +443,24 @@
 " Types: {{{2
 " =====
 
-syn region	vimReturnType	contained	start=":\s" end="$" matchgroup=vim9Comment end="\ze[#"]" skipwhite skipempty nextgroup=vimDefBody,vimDefComment,vimEnddef,vimCommentError contains=vimTypeSep transparent
+syn region	vimReturnType	contained
+      \ start=":\%(\s\|\n\)\@="
+      \ skip=+\n\s*\\\|\n\s*#\\ \|^\s*#\\ +
+      \ end="$"
+      \ matchgroup=vim9Comment
+      "\ allow for legacy script tail comment error
+      \ end="\ze[#"]"
+      \ skipwhite skipempty nextgroup=vimDefBody,vimDefComment,vimEnddef,vimCommentError
+      \ contains=@vim9Continue,@vimType
+      \ transparent
 syn match	vimParamType	contained	":\s"	skipwhite skipnl nextgroup=@vimType contains=vimTypeSep
 
-syn match	vimTypeSep	contained	":\s\@=" skipwhite nextgroup=@vimType
+syn match	vimTypeSep	contained	":\%(\s\|\n\)\@=" skipwhite nextgroup=@vimType
 syn keyword	vimType	contained	any blob bool channel float job number string void
 syn match	vimType	contained	"\<func\>"
 syn region	vimCompoundType	contained	matchgroup=vimType start="\<func("            end=")" nextgroup=vimTypeSep contains=@vimType oneline transparent
 syn region	vimCompoundType   contained         matchgroup=vimType start="\<\%(list\|dict\)<" end=">"                      contains=@vimType oneline transparent
-syn match	vimUserType	contained	"\<\u\w*\>"
+syn match	vimUserType	contained	"\<\%(\h\w*\.\)*\u\w*\>"
 
 syn cluster vimType contains=vimType,vimCompoundType,vimUserType
 
@@ -456,7 +473,7 @@
   syn match	vim9MethodDefName		contained	"\<\h\w*\>"	nextgroup=vim9MethodDefParams contains=@vim9MethodName
   syn region	vim9MethodDefParams	contained
         \ matchgroup=Delimiter start="(" end=")"
-        \ skipwhite skipnl nextgroup=vim9MethodDefBody,vimDefComment,vimEnddef,vim9MethodDefReturnType,vimCommentError
+        \ skipwhite skipnl nextgroup=vim9MethodDefBody,vim9MethodDefComment,vimEnddef,vim9MethodDefReturnType,vimCommentError
         \ contains=vimDefParam,vim9Comment,vimFuncParamEquals
 
   syn match	vim9ConstructorDefName	contained	"\<new\w*\>"
@@ -467,14 +484,25 @@
         \ contains=vim9This,vimOper
   syn region	vim9ConstructorDefParams	contained
         \ matchgroup=Delimiter start="(" end=")"
-        \ skipwhite skipnl nextgroup=vim9MethodDefBody,vimDefComment,vimEnddef,vimCommentError
+        \ skipwhite skipnl nextgroup=vim9MethodDefBody,vim9MethodDefComment,vimEnddef,vimCommentError
         \ contains=vim9ConstructorDefParam,vim9Comment,vimFuncParamEquals
 
   syn region	vim9MethodDefReturnType	contained
-        \ start=":\s" end="$" matchgroup=vim9Comment end="\ze[#"]"
-        \ skipwhite skipnl nextgroup=vim9MethodDefBody,vimDefComment,vimCommentError
-        \ contains=vimTypeSep
+        \ start=":\%(\s\|\n\)\@="
+        \ skip=+\n\s*\\\|\n\s*#\\ \|^\s*#\\ +
+        \ end="$"
+        \ matchgroup=vim9Comment
+        \ end="\ze#"
+        \ skipwhite skipnl nextgroup=vim9MethodDefBody,vim9MethodDefComment,vimEnddef,vimCommentError
+        \ contains=@vim9Continue,vimType,vimTypeSep
         \ transparent
+
+  syn region	vim9MethodDefComment	contained
+        \ start="#.*"
+        \ skip=+\n\s*\\\|\n\s*#\\ +
+        \ end="$"
+        \ skipwhite skipempty nextgroup=vim9MethodDefBody,vimEnddef
+
   syn region	vim9MethodDefBody		contained
         \ start="^.\=" matchgroup=vimCommand end="\<enddef\>"
         \ skipwhite nextgroup=vimCmdSep,vim9Comment,vimCommentError
@@ -1702,6 +1730,7 @@
  hi def link vim9LhsVariable	vimVar
  hi def link vim9LineComment	vimComment
  hi def link vim9MethodDef	vimCommand
+ hi def link vim9MethodDefComment	vimDefComment
  hi def link vim9MethodNameError	vimFunctionError
  hi def link vim9Null	Constant
  hi def link vim9Public	vimCommand
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_return_type_00.dump b/runtime/syntax/testdir/dumps/vim_ex_def_return_type_00.dump
new file mode 100644
index 0000000..04e16a4
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_return_type_00.dump
@@ -0,0 +1,20 @@
+>v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| +0#0000000&@64
+|#+0#0000e05&| |V|i|m|9| |f|u|n|c|t|i|o|n| |r|e|t|u|r|n| |t|y|p|e|s| +0#0000000&@46
+|#+0#0000e05&| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |h|i| |l|i|n|k| |v|i|m|U|s|e|r|T|y|p|e| |T|o|d|o| +0#0000000&@33
+@75
+@75
+|#+0#0000e05&| |I|s@1|u|e| |#|1|4@2|2| |(|v|i|m|.|v|i|m|:| |c|o|n|f|u|s|i|o|n| |f|o|r| |f|u|n|c|t|i|o|n| |r|e|t|u|r|n| |t|y|p|e|s| |s|t|a|r|t|i|n|g| |o|n| |a|n
+|o|t|h|e|r| |l|i|n|e|)| +0#0000000&@63
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|T|e|s|t|A|_@61|(+0#e000e06&|)|:+0#0000000&| 
+@4|\+0#e000e06&| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&@64
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|T|e|s|t|B|_@3|(+0#e000e06&|r+0#0000000&|e|s|u|l|t|:| |d+0#00e0003&|i|c|t|<|l|i|s|t|<|n|u|m|b|e|r|>@1|,+0#0000000&| |f|s|:| |l+0#00e0003&|i|s|t|<|f|u|n|c|(|n|u|m|b|e|r|)|:+0#0000000&| |n+0#00e0003&|u|m|b|e|r|>|)+0#e000e06&|:+0#0000000&| 
+@4|\+0#e000e06&| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&@64
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|T|e|s|t|C|_@3|(+0#e000e06&|m+0#0000000&|a|y|b|e|:| |b+0#00e0003&|o@1|l|,+0#0000000&| |F|:| |f+0#00e0003&|u|n|c|(|)|:+0#0000000&| |d+0#00e0003&|i|c|t|<|f|u|n|c|(|n|u|m|b|e|r|)|:+0#0000000&| |n+0#00e0003&|u|m|b|e|r|>|)+0#e000e06&|:+0#0000000&| |f+0#00e0003&|u|n|c|(|)|:+0#0000000&| 
+@8|\+0#e000e06&| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&@60
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|(+0#e000e06&|)| +0#0000000&|=+0#af5f00255&|>| +0#0000000&|{+0#e000e06&| +0#0000000&@56
+@57|1|,|1| @10|T|o|p| 
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_return_type_01.dump b/runtime/syntax/testdir/dumps/vim_ex_def_return_type_01.dump
new file mode 100644
index 0000000..ed7fd6c
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_return_type_01.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@3|\+0#e000e06&| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&@64
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|T|e|s|t|C|_@3|(+0#e000e06&|m+0#0000000&|a|y|b|e|:| |b+0#00e0003&|o@1|l|,+0#0000000&| |F|:| |f+0#00e0003&|u|n|c|(|)|:+0#0000000&| |d+0#00e0003&|i|c|t|<|f|u|n|c|(|n|u|m|b|e|r|)|:+0#0000000&| |n+0#00e0003&|u|m|b|e|r|>|)+0#e000e06&|:+0#0000000&| |f+0#00e0003&|u|n|c|(|)|:+0#0000000&| 
+@8|\+0#e000e06&| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&@60
+@4>r+0#af5f00255&|e|t|u|r|n| +0#0000000&|(+0#e000e06&|)| +0#0000000&|=+0#af5f00255&|>| +0#0000000&|{+0#e000e06&| +0#0000000&@56
+@4|}+0#e000e06&| +0#0000000&@69
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+@75
+|d+0#af5f00255&|e|f| +0#0000000&|T|e|s|t|D|_@3|(+0#e000e06&|f+0#0000000&|s|:| |l+0#00e0003&|i|s|t|<|f|u|n|c|(|)|:+0#0000000&| |d+0#00e0003&|i|c|t|<|f|u|n|c|(|n|u|m|b|e|r|)|:+0#0000000&| |b+0#00e0003&|o@1|l|>@1|)+0#e000e06&|:+0#0000000&| |f+0#00e0003&|u|n|c|(|)|:+0#0000000&| |f+0#00e0003&|u|n|c|(|)|:+0#0000000&| 
+@8|\+0#e000e06&| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&@60
+@4|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|(+0#e000e06&|)| +0#0000000&|=+0#af5f00255&|>| +0#0000000&|(+0#e000e06&|)| +0#0000000&|=+0#af5f00255&|>| +0#0000000&|{+0#e000e06&| +0#0000000&@50
+@4|}+0#e000e06&| +0#0000000&@69
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+@75
+|c+0#af5f00255&|l|a|s@1| +0#0000000&|T|e|s|t|s| @63
+@4|d+0#af5f00255&|e|f| +0#0000000&|T|e|s|t|A|_@57|(+0#e000e06&|)|:+0#0000000&| 
+@8|\+0#e000e06&| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&@60
+@4|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@64
+@57|1|8|,|5| @9|2|9|%| 
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_return_type_02.dump b/runtime/syntax/testdir/dumps/vim_ex_def_return_type_02.dump
new file mode 100644
index 0000000..dc6ab66
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_return_type_02.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@64
+@75
+@4|d+0#af5f00255&|e|f| +0#0000000&|T|e|s|t|B|(+0#e000e06&|r+0#0000000&|e|s|u|l|t|:| |d+0#00e0003&|i|c|t|<|l|i|s|t|<|n|u|m|b|e|r|>@1|,+0#0000000&| |f|s|:| |l+0#00e0003&|i|s|t|<|f|u|n|c|(|n|u|m|b|e|r|)|:+0#0000000&| |n+0#00e0003&|u|m|b|e|r|>|)+0#e000e06&|:+0#0000000&| 
+@8|\+0#e000e06&| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&@60
+@4|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@64
+> @74
+@4|d+0#af5f00255&|e|f| +0#0000000&|T|e|s|t|C|(+0#e000e06&|m+0#0000000&|a|y|b|e|:| |b+0#00e0003&|o@1|l|,+0#0000000&| |F|:| |f+0#00e0003&|u|n|c|(|)|:+0#0000000&| |d+0#00e0003&|i|c|t|<|f|u|n|c|(|n|u|m|b|e|r|)|:+0#0000000&| |n+0#00e0003&|u|m|b|e|r|>|)+0#e000e06&|:+0#0000000&| |f+0#00e0003&|u|n|c|(|)|:+0#0000000&| 
+@12|\+0#e000e06&| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&@56
+@8|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|(+0#e000e06&|)| +0#0000000&|=+0#af5f00255&|>| +0#0000000&|{+0#e000e06&| +0#0000000&@52
+@8|}+0#e000e06&| +0#0000000&@65
+@4|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@64
+@75
+@4|d+0#af5f00255&|e|f| +0#0000000&|T|e|s|t|D|(+0#e000e06&|f+0#0000000&|s|:| |l+0#00e0003&|i|s|t|<|f|u|n|c|(|)|:+0#0000000&| |d+0#00e0003&|i|c|t|<|f|u|n|c|(|n|u|m|b|e|r|)|:+0#0000000&| |b+0#00e0003&|o@1|l|>@1|)+0#e000e06&|:+0#0000000&| |f+0#00e0003&|u|n|c|(|)|:+0#0000000&| |f+0#00e0003&|u|n|c|(|)|:+0#0000000&| 
+@12|\+0#e000e06&| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&@56
+@8|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|(+0#e000e06&|)| +0#0000000&|=+0#af5f00255&|>| +0#0000000&|(+0#e000e06&|)| +0#0000000&|=+0#af5f00255&|>| +0#0000000&|{+0#e000e06&| +0#0000000&@46
+@8|}+0#e000e06&| +0#0000000&@65
+@4|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@64
+|e+0#af5f00255&|n|d|c|l|a|s@1| +0#0000000&@66
+@75
+@57|3|6|,|0|-|1| @7|7|3|%| 
diff --git a/runtime/syntax/testdir/dumps/vim_ex_def_return_type_03.dump b/runtime/syntax/testdir/dumps/vim_ex_def_return_type_03.dump
new file mode 100644
index 0000000..a4e7113
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim_ex_def_return_type_03.dump
@@ -0,0 +1,20 @@
+| +0&#ffffff0@74
+|d+0#af5f00255&|e|f| +0#0000000&|F|(+0#e000e06&|G+0#0000000&|:| |f+0#00e0003&|u|n|c|(|n|u|m|b|e|r|,+0#0000000&| |n+0#00e0003&|u|m|b|e|r|,+0#0000000&| |n+0#00e0003&|u|m|b|e|r|)|:+0#0000000&| |l+0#0000001#ffff4012|i|b|.|T|r|a|m|p|o|l|i|n|e|)+0#e000e06#ffffff0|:+0#0000000&| @19
+@40|\+0#e000e06&| +0#0000000&|f+0#00e0003&|u|n|c|(|n|u|m|b|e|r|,+0#0000000&| |n+0#00e0003&|u|m|b|e|r|,+0#0000000&| |n+0#00e0003&|u|m|b|e|r|)|:+0#0000000&| @3
+@40|\+0#e000e06&| +0#0000000&|f+0#00e0003&|u|n|c|(|)|:+0#0000000&| |l+0#0000001#ffff4012|i|b|.|T|r|a|m|p|o|l|i|n|e| +0#0000000#ffffff0@10
+@8|r+0#af5f00255&|e|t|u|r|n| +0#0000000&|(+0#e000e06&@1|H+0#0000000&|:| |f+0#00e0003&|u|n|c|(|n|u|m|b|e|r|,+0#0000000&| |n+0#00e0003&|u|m|b|e|r|,+0#0000000&| |n+0#00e0003&|u|m|b|e|r|)|:+0#0000000&| |l+0#0000001#ffff4012|i|b|.|T|r|a|m|p|o|l|i|n|e|)+0#e000e06#ffffff0| +0#0000000&|=+0#af5f00255&|>| +0#0000000&@6
+@32>(+0#e000e06&|a+0#0000000&|1|:| |n+0#00e0003&|u|m|b|e|r|,+0#0000000&| |a|2|:| |n+0#00e0003&|u|m|b|e|r|,+0#0000000&| |n|:| |n+0#00e0003&|u|m|b|e|r|)+0#e000e06&| +0#0000000&|=+0#af5f00255&|>| +0#0000000&@4
+@32|(+0#e000e06&|)| +0#0000000&|=+0#af5f00255&|>| +0#0000000&@37
+@16|H|(+0#e000e06&|a+0#0000000&|2|,| |(+0#e000e06&|a+0#0000000&|1| |++0#af5f00255&| +0#0000000&|a|2|)+0#e000e06&|,+0#0000000&| |(+0#e000e06&|n+0#0000000&| |-+0#af5f00255&| +0#0000000&|1+0#e000002&|)+0#e000e06&@2|(|G+0#0000000&|)+0#e000e06&| +0#0000000&@29
+|e+0#af5f00255&|n|d@1|e|f| +0#0000000&@68
+@75
+|d+0#af5f00255&|e|f|c|o|m|p|i|l|e| +0#0000000&@64
+@75
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|5|4|,|5|-|3@1| @6|B|o|t| 
diff --git a/runtime/syntax/testdir/input/vim_ex_def_return_type.vim b/runtime/syntax/testdir/input/vim_ex_def_return_type.vim
new file mode 100644
index 0000000..af88721
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim_ex_def_return_type.vim
@@ -0,0 +1,60 @@
+vim9script
+# Vim9 function return types
+# VIM_TEST_SETUP hi link vimUserType Todo
+
+
+# Issue #14442 (vim.vim: confusion for function return types starting on another line)
+
+def TestA______________________________________________________________():
+    \ void
+enddef
+
+def TestB____(result: dict<list<number>>, fs: list<func(number): number>):
+    \ void
+enddef
+
+def TestC____(maybe: bool, F: func(): dict<func(number): number>): func():
+	\ void
+    return () => {
+    }
+enddef
+
+def TestD____(fs: list<func(): dict<func(number): bool>>): func(): func():
+	\ void
+    return () => () => {
+    }
+enddef
+
+class Tests
+    def TestA__________________________________________________________():
+	\ void
+    enddef
+
+    def TestB(result: dict<list<number>>, fs: list<func(number): number>):
+	\ void
+    enddef
+
+    def TestC(maybe: bool, F: func(): dict<func(number): number>): func():
+	    \ void
+	return () => {
+	}
+    enddef
+
+    def TestD(fs: list<func(): dict<func(number): bool>>): func(): func():
+	    \ void
+	return () => () => {
+	}
+    enddef
+endclass
+
+def F(G: func(number, number, number): lib.Trampoline):
+					\ func(number, number, number):
+					\ func(): lib.Trampoline
+	return ((H: func(number, number, number): lib.Trampoline) =>
+				(a1: number, a2: number, n: number) =>
+				() =>
+		H(a2, (a1 + a2), (n - 1)))(G)
+enddef
+
+defcompile
+
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index fbfc8ad..1baf5b5 100644
--- a/runtime/syntax/vim.vim
+++ b/runtime/syntax/vim.vim
@@ -2,7 +2,7 @@
 " Language:	   Vim script
 " Maintainer:	   Hirohito Higashi <h.east.727 ATMARK gmail.com>
 "	   Doug Kearns <dougkearns@gmail.com>
-" Last Change:	   2025 Mar 13
+" Last Change:	   2025 Mar 17
 " Former Maintainer: Charles E. Campbell
 
 " DO NOT CHANGE DIRECTLY.
@@ -452,8 +452,16 @@
 syn match	vimFunction	"\<fu\%[nction]\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)\+"	contains=@vimFuncList skipwhite nextgroup=vimFuncParams
 syn match	vimDef	"\<def\>!\=\s*\%(<[sS][iI][dD]>\|[sg]:\)\=\%(\i\|[#.]\|{.\{-1,}}\)\+"		contains=@vimDefList            nextgroup=vimDefParams
 
-syn match	vimFuncComment	contained	+".*+ skipwhite skipempty nextgroup=vimFuncBody,vimEndfunction
-syn match	vimDefComment	contained	"#.*" skipwhite skipempty nextgroup=vimDefBody,vimEnddef
+syn region	vimFuncComment	contained
+      \ start=+".*+
+      \ skip=+\n\s*\\\|\n\s*"\\ +
+      \ end="$"
+      \ skipwhite skipempty nextgroup=vimFuncBody,vimEndfunction
+syn region	vimDefComment	contained
+      \ start="#.*"
+      \ skip=+\n\s*\\\|\n\s*#\\ +
+      \ end="$"
+      \ skipwhite skipempty nextgroup=vimDefBody,vimEnddef
 
 syn match	vimFuncBang	contained	"!"
 syn match	vimFuncSID	contained	"\c<sid>"
@@ -485,15 +493,24 @@
 " Types: {{{2
 " =====
 
-syn region	vimReturnType	contained	start=":\s" end="$" matchgroup=vim9Comment end="\ze[#"]" skipwhite skipempty nextgroup=vimDefBody,vimDefComment,vimEnddef,vimCommentError contains=vimTypeSep transparent
+syn region	vimReturnType	contained
+      \ start=":\%(\s\|\n\)\@="
+      \ skip=+\n\s*\\\|\n\s*#\\ \|^\s*#\\ +
+      \ end="$"
+      \ matchgroup=vim9Comment
+      "\ allow for legacy script tail comment error
+      \ end="\ze[#"]"
+      \ skipwhite skipempty nextgroup=vimDefBody,vimDefComment,vimEnddef,vimCommentError
+      \ contains=@vim9Continue,@vimType
+      \ transparent
 syn match	vimParamType	contained	":\s"	skipwhite skipnl nextgroup=@vimType contains=vimTypeSep
 
-syn match	vimTypeSep	contained	":\s\@=" skipwhite nextgroup=@vimType
+syn match	vimTypeSep	contained	":\%(\s\|\n\)\@=" skipwhite nextgroup=@vimType
 syn keyword	vimType	contained	any blob bool channel float job number string void
 syn match	vimType	contained	"\<func\>"
 syn region	vimCompoundType	contained	matchgroup=vimType start="\<func("            end=")" nextgroup=vimTypeSep contains=@vimType oneline transparent
 syn region	vimCompoundType   contained         matchgroup=vimType start="\<\%(list\|dict\)<" end=">"                      contains=@vimType oneline transparent
-syn match	vimUserType	contained	"\<\u\w*\>"
+syn match	vimUserType	contained	"\<\%(\h\w*\.\)*\u\w*\>"
 
 syn cluster vimType contains=vimType,vimCompoundType,vimUserType
 
@@ -506,7 +523,7 @@
   syn match	vim9MethodDefName		contained	"\<\h\w*\>"	nextgroup=vim9MethodDefParams contains=@vim9MethodName
   syn region	vim9MethodDefParams	contained
         \ matchgroup=Delimiter start="(" end=")"
-        \ skipwhite skipnl nextgroup=vim9MethodDefBody,vimDefComment,vimEnddef,vim9MethodDefReturnType,vimCommentError
+        \ skipwhite skipnl nextgroup=vim9MethodDefBody,vim9MethodDefComment,vimEnddef,vim9MethodDefReturnType,vimCommentError
         \ contains=vimDefParam,vim9Comment,vimFuncParamEquals
 
   syn match	vim9ConstructorDefName	contained	"\<new\w*\>"
@@ -517,14 +534,25 @@
         \ contains=vim9This,vimOper
   syn region	vim9ConstructorDefParams	contained
         \ matchgroup=Delimiter start="(" end=")"
-        \ skipwhite skipnl nextgroup=vim9MethodDefBody,vimDefComment,vimEnddef,vimCommentError
+        \ skipwhite skipnl nextgroup=vim9MethodDefBody,vim9MethodDefComment,vimEnddef,vimCommentError
         \ contains=vim9ConstructorDefParam,vim9Comment,vimFuncParamEquals
 
   syn region	vim9MethodDefReturnType	contained
-        \ start=":\s" end="$" matchgroup=vim9Comment end="\ze[#"]"
-        \ skipwhite skipnl nextgroup=vim9MethodDefBody,vimDefComment,vimCommentError
-        \ contains=vimTypeSep
+        \ start=":\%(\s\|\n\)\@="
+        \ skip=+\n\s*\\\|\n\s*#\\ \|^\s*#\\ +
+        \ end="$"
+        \ matchgroup=vim9Comment
+        \ end="\ze#"
+        \ skipwhite skipnl nextgroup=vim9MethodDefBody,vim9MethodDefComment,vimEnddef,vimCommentError
+        \ contains=@vim9Continue,vimType,vimTypeSep
         \ transparent
+
+  syn region	vim9MethodDefComment	contained
+        \ start="#.*"
+        \ skip=+\n\s*\\\|\n\s*#\\ +
+        \ end="$"
+        \ skipwhite skipempty nextgroup=vim9MethodDefBody,vimEnddef
+
   syn region	vim9MethodDefBody		contained
         \ start="^.\=" matchgroup=vimCommand end="\<enddef\>"
         \ skipwhite nextgroup=vimCmdSep,vim9Comment,vimCommentError
@@ -1760,6 +1788,7 @@
  hi def link vim9LhsVariable	vimVar
  hi def link vim9LineComment	vimComment
  hi def link vim9MethodDef	vimCommand
+ hi def link vim9MethodDefComment	vimDefComment
  hi def link vim9MethodNameError	vimFunctionError
  hi def link vim9Null	Constant
  hi def link vim9Public	vimCommand