runtime(vim): Update base syntax, match generic functions

Commit: 
https://github.com/vim/vim/commit/72473ce9f8e111072360a7589e2c5bee079305da
Author: Doug Kearns <dougkea...@gmail.com>
Date:   Wed Jul 23 21:25:57 2025 +0200

    runtime(vim): Update base syntax, match generic functions
    
    Match Vim9 generic functions, added in 
https://github.com/vim/vim/issues/17313.
    
    closes: #17722
    
    Signed-off-by: Doug Kearns <dougkea...@gmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/runtime/syntax/generator/vim.vim.base 
b/runtime/syntax/generator/vim.vim.base
index 63c1bb5c9..7a3e45905 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 <dougkea...@gmail.com>
-" Last Change:    2025 Jul 18
+" Last Change:    2025 Jul 23
 " Former Maintainer: Charles E. Campbell
 
 " DO NOT CHANGE DIRECTLY.
@@ -267,6 +267,8 @@ syn match vimVimVar "\<v:"          
nextgroup=vimSubscript,vimVimVarName,vimVarNameError
 syn match vimOptionVar "&\%([lg]:\)\="         
nextgroup=vimSubscript,vimOptionVarName,vimVarNameError
 syn cluster vimSpecialVar      
contains=vimEnvvar,vimLetRegister,vimOptionVar,vimVimVar
 
+Vim9 syn match vimVar  contained        "\<\h\w*\ze<"          
nextgroup=vim9TypeArgs
+
 Vim9 syn match vim9LhsVariable "\s\=\h[a-zA-Z0-9#_]*\ze\s\+[-+/*%]\=="
 Vim9 syn match vim9LhsVariable "\s\=\h[a-zA-Z0-9#_]*\ze\s\+\.\.="
 Vim9 syn match vim9LhsVariable "\s\=\%([bwgt]:\)\=\h[a-zA-Z0-9#_]*\ze\s\+=<<"  
skipwhite nextgroup=vimLetHeredoc       contains=vimVarScope
@@ -468,7 +470,7 @@ syn match   vimFunctionName contained
       \ contains=vimFunctionError,vimFunctionScope,vimFunctionSID,Tag
 syn match      vimDefName      contained
       \ "\%(<[sS][iI][dD]>\|[bwglstav]:\)\=\%([[:alnum:]_#.]\+\|{.\{-1,}}\)\+"
-      \ nextgroup=vimDefParams,vimCmdSep,vimComment,vim9Comment
+      \ 
nextgroup=vimDefTypeParams,vimDefParams,vimCmdSep,vimComment,vim9Comment
       \ contains=vimFunctionError,vimFunctionScope,vimFunctionSID,Tag
 
 syn match      vimFunction     "\<fu\%[nction]\>"      skipwhite 
nextgroup=vimFunctionBang,vimFunctionName,vimFunctionPattern,vimCmdSep,vimComment
@@ -498,8 +500,15 @@ syn region vimDefParams    contained
       \ end=")"
       \ skipwhite skipempty 
nextgroup=vimDefBody,vimDefComment,vimEnddef,vimReturnType,vimCommentError
       \ contains=vimDefParam,vim9Comment,vimFunctionParamEquals,vimOperParen
+syn region     vimDefTypeParams        contained
+      \ matchgroup=Delimiter
+      \ start="<"
+      \ end=">"
+      \ nextgroup=vimDefParams
+      \ contains=vim9DefTypeParam
 syn match      vimFunctionParam        contained       "\<\h\w*\>\|\.\.\."     
skipwhite nextgroup=vimFunctionParamEquals
 syn match      vimDefParam     contained       "\<\h\w*\>"             
skipwhite nextgroup=vimParamType,vimFunctionParamEquals
+syn match      vim9DefTypeParam        contained       "\<\u\w*\>"
 
 syn match      vimFunctionParamEquals contained        "="                     
skipwhite         nextgroup=@vimExprList
 syn match      vimFunctionMod       contained  
"\<\%(abort\|closure\|dict\|range\)\>"  skipwhite skipempty 
nextgroup=vimFunctionBody,vimFunctionComment,vimEndfunction,vimFunctionMod,vim9CommentError
@@ -531,7 +540,7 @@ if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'f'
   syn region   vimDefFold
         \ start="\<def!"
         "\ assume no dict literal in curly-brace name expressions
-        \ start="\<def\>\s*\%([[:alnum:]_:<>.#]\+\|{.\{-1,}}\)\+("
+        \ start="\<def\>\s*\%([[:alnum:]_:<>.#]\+\|{.\{-1,}}\)\+[<(]"
         \ end="^\s*:\=\s*enddef\>"
         \ contains=vimDef
         \ extend fold keepend transparent
@@ -573,14 +582,20 @@ if s:vim9script
 
   " Methods {{{3
   syn match    vim9MethodDef           contained       "\<def\>"       
skipwhite nextgroup=vim9MethodDefName,vim9ConstructorDefName
-  syn match    vim9MethodDefName               contained       "\<\h\w*\>"     
nextgroup=vim9MethodDefParams contains=@vim9MethodName
+  syn match    vim9MethodDefName               contained       "\<\h\w*\>"     
nextgroup=vim9MethodDefParams,vim9MethodDefTypeParams contains=@vim9MethodName
   syn region   vim9MethodDefParams     contained
         \ matchgroup=Delimiter start="(" end=")"
         \ skipwhite skipnl 
nextgroup=vim9MethodDefBody,vim9MethodDefComment,vimEnddef,vim9MethodDefReturnType,vimCommentError
         \ contains=vimDefParam,vim9Comment,vimFunctionParamEquals
+  syn region   vim9MethodDefTypeParams contained
+        \ matchgroup=Delimiter
+        \ start="<"
+        \ end=">"
+        \ nextgroup=vim9MethodDefParams
+        \ contains=vim9DefTypeParam
 
   syn match    vim9ConstructorDefName  contained       "\<_\=new\w*\>"
-        \ nextgroup=vim9ConstructorDefParams
+        \ nextgroup=vim9ConstructorDefParams,vim9ConstuctorDefTypeParams
         \ contains=@vim9MethodName
   syn match    vim9ConstructorDefParam contained       "\<\%(this\.\)\=\h\w*\>"
         \ skipwhite nextgroup=vimParamType,vimFunctionParamEquals
@@ -589,6 +604,12 @@ if s:vim9script
         \ matchgroup=Delimiter start="(" end=")"
         \ skipwhite skipnl 
nextgroup=vim9MethodDefBody,vim9MethodDefComment,vimEnddef,vimCommentError
         \ contains=vim9ConstructorDefParam,vim9Comment,vimFunctionParamEquals
+  syn region   vim9ConstuctorDefTypeParams     contained
+        \ matchgroup=Delimiter
+        \ start="<"
+        \ end=">"
+        \ nextgroup=vim9ConstructorDefParams
+        \ contains=vim9DefTypeParam
 
   syn region   vim9MethodDefReturnType contained
         \ start=":\%(\s\|
\)\@="
@@ -622,8 +643,11 @@ if s:vim9script
   syn cluster  vim9MethodName  contains=vim9MethodName,vim9MethodNameError
 
   if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'f'
-    syn region vim9MethodDefFold       contained       
start="\%(^\s*\%(:\=static\s\+\)\=\)\@16<=:\=def\s\+\h\i*(" 
end="^\s*:\=enddef\>" contains=vim9MethodDef fold keepend extend transparent
-    syn region vim9MethodDefFold       contained       
start="^\s*:\=def\s\+_\=new\i*("                      end="^\s*:\=enddef\>" 
contains=vim9MethodDef fold keepend extend transparent
+    syn region vim9MethodDefFold       contained
+          \ start="\%(^\s*\%(:\=static\s\+\)\=\)\@16<=:\=def\s\+\h\w*[<(]"
+          \ end="^\s*:\=enddef\>"
+          \ contains=vim9MethodDef
+          \ fold keepend extend transparent
   endif
 
   syn cluster vim9MethodDef contains=vim9MethodDef,vim9MethodDefFold
@@ -703,7 +727,7 @@ if s:vim9script
   syn match    vim9InterfaceName               contained       "\<\u\w*\>"     
skipwhite skipnl nextgroup=vim9Extends
 
   syn keyword  vim9AbstractDef         contained       def     skipwhite 
nextgroup=vim9AbstractDefName
-  syn match    vim9AbstractDefName     contained       "\<\h\w*\>"     
skipwhite nextgroup=vim9AbstractDefParams contains=@vim9MethodName
+  syn match    vim9AbstractDefName     contained       "\<\h\w*\>"     
skipwhite nextgroup=vim9AbstractDefParams,vim9AbstractDefTypeParams 
contains=@vim9MethodName
   syn region   vim9AbstractDefParams   contained
         \ matchgroup=Delimiter start="(" end=")"
         \ skipwhite skipnl 
nextgroup=vimDefComment,vim9AbstractDefReturnType,vimCommentError
@@ -713,6 +737,12 @@ if s:vim9script
         \ skipwhite skipnl nextgroup=vimDefComment,vimCommentError
         \ contains=vimTypeSep
         \ transparent
+  syn region   vim9AbstractDefTypeParams       contained
+        \ matchgroup=Delimiter
+        \ start="<"
+        \ end=">"
+        \ nextgroup=vim9AbstractDefParams
+        \ contains=vim9DefTypeParam
 
   VimFoldi syn region  vim9InterfaceBody       start="\<interface\>" 
matchgroup=vimCommand end="\<endinterface\>" contains=@vim9InterfaceBodyList 
transparent
 
@@ -1431,7 +1461,7 @@ syn match vimBracket contained    "[\<>]"
 syn case match
 
 " User Command Highlighting: {{{2
-syn match vimUsrCmd    
'^\s*\zs\u\%(\w*\)\@>\%([.(#[]\|\s\+\%([-+*/%]\=\|\.\.\)=\)\@!'
+syn match vimUsrCmd    
'^\s*\zs\u\%(\w*\)\@>\%([<.(#[]\|\s\+\%([-+*/%]\=\|\.\.\)=\)\@!'
 
 " Vim user commands
 
@@ -2088,18 +2118,26 @@ unlet s:interfaces
 " Function Call Highlighting: {{{2
 " (following Gautam Iyer's suggestion)
 " ==========================
-syn match      vimFunc contained       "\<\l\w*\ze\s*("                        
        skipwhite nextgroup=vimOperParen contains=vimFuncName
-syn match      vimUserFunc     contained       "\.\@1<=\l\w*\ze\s*("           
        skipwhite nextgroup=vimOperParen
-syn match      vimUserFunc     contained       
"\<\%([[:upper:]_]\|\%(\h\w*\.\)\+\h\)\w*\ze\s*("               skipwhite 
nextgroup=vimOperParen contains=vim9MethodName,vim9Super,vim9This
-syn match      vimUserFunc     contained       
"\<\%(g:\)\=\%(\h\w*#\)\+\h\w*\ze\s*("          skipwhite 
nextgroup=vimOperParen contains=vimVarScope
-syn match      vimUserFunc     contained       
"\%(\<[sgbwtlav]:\|<[sS][iI][dD]>\)\%(\h\w*\.\)*\h\w*\ze\s*("   skipwhite 
nextgroup=vimOperParen contains=vimVarScope,vimNotation
+syn match      vimFunc contained       "\<\l\w*\ze\s*("                        
                skipwhite nextgroup=vimOperParen                
contains=vimFuncName
+syn match      vimUserFunc     contained       
"\.\@1<=\l\w*\ze\%(\s*(\|<.*>(\)"                               skipwhite 
nextgroup=vimOperParen,vim9TypeArgs
+syn match      vimUserFunc     contained       
"\<\%([[:upper:]_]\|\%(\h\w*\.\)\+\h\)\w*\ze\%(\s*(\|<.*>(\)"           
skipwhite nextgroup=vimOperParen,vim9TypeArgs   
contains=vim9MethodName,vim9Super,vim9This
+syn match      vimUserFunc     contained       
"\<\%(g:\)\=\%(\h\w*#\)\+\h\w*\ze\%(\s*(\|<.*>(\)"                      
skipwhite nextgroup=vimOperParen                contains=vimVarScope
+syn match      vimUserFunc     contained       
"\%(\<[sgbwtlav]:\|<[sS][iI][dD]>\)\%(\h\w*\.\)*\h\w*\ze\%(\s*(\|<.*>(\)"       
skipwhite nextgroup=vimOperParen,vim9TypeArgs   contains=vimVarScope,vimNotation
 
-Vim9 syn match vim9UserFunc    
"^\s*\zs\%([sgbwtv]:\|<[sS][iI][dD]>\)\=\%(\h\w*[.#]\)*\h\w*\ze("               
skipwhite nextgroup=vimOperParen 
contains=vimVarScope,vimNotation,vim9MethodName,vim9Super,vim9This
-Vim9 syn match vim9Func        "^\s*\zs\l\w*\ze("                              
skipwhite nextgroup=vimOperParen contains=vimFuncName
+Vim9 syn match vim9UserFunc    
"^\s*\zs\%([sgbwtv]:\|<[sS][iI][dD]>\)\=\%(\h\w*[.#]\)*\h\w*\ze[<(]"            
        skipwhite nextgroup=vimOperParen,vim9TypeArgs   
contains=vimVarScope,vimNotation,vim9MethodName,vim9Super,vim9This
+Vim9 syn match vim9Func        "^\s*\zs\l\w*\ze("                              
        skipwhite nextgroup=vimOperParen                contains=vimFuncName
 
 syn cluster    vimFunc contains=vimFunc,vimUserFunc
 syn cluster    vim9Func        contains=vim9Func,vim9UserFunc
 
+syn region     vim9TypeArgs    contained
+      \ matchgroup=Delimiter
+      \ start="<\ze "
+      \ end=">"
+      \ nextgroup=vimOperParen
+      \ contains=@vimType
+      \ oneline
+
 " Beginners - Patterns that involve ^ {{{2
 " =========
 Vim9 syn region        vim9LineComment start=+^[       :]*\zs#.*$+ skip=+
\s*\\|
\s*#\ + end="$" contains=@vimCommentGroup,vimCommentString,vim9CommentTitle 
extend
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_00.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_00.dump
new file mode 100644
index 000000000..644b3e5e9
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_00.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1>v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| 
|h|i|g|h|l|i|g|h|t| |l|i|n|k| |v|i|m|9|D|e|f|T|y|p|e|P|a|r|a|m| |T|o|d|o| 
+0#0000000&@19
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |l|e|t| 
|g|:|v|i|m|s|y|n|_|f|o|l|d|i|n|g| |=| |"+0#e000002&|f|"| +0#0000000&@29
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |s|e|t|l| 
|f|d|c|=|2| |f|d|l|=|9@1| |f|d|m|=|s|y|n|t|a|x| +0#0000000&@27
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| +0#0000000&|S+0#e000e06&|e@1|:| 
+0#0000e05&|h|t@1|p|s|:|/@1|g|i|t|h|u|b|.|c|o|m|/|v|i|m|/|v|i|m|/|p|u|l@1|/|1|7|3|1|3|#|i|s@1|u|e|c|o|m@1|e|n|t|-|3|0|4|6@1|9|6|8|2|0|
 |(|A|l|i
+| +0&#a8a8a8255@1|a+0&#ffffff0|k|s|e|i| |B|u|d|a|v|e|i|)| +0#0000000&@58
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |S|e@1| 
|h|t@1|p|s|:|/@1|g|i|t|h|u|b|.|c|o|m|/|v|i|m|/|v|i|m|/|p|u|l@1|/|1|6@1|0|4|#|i|s@1|u|e|c|o|m@1|e|n|t|-|2|6|5|2|0|2|8|4|5|
 |.| +0#0000000&@4
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|x|p|o|r|t| 
+0#0000000&|i+0#af5f00255&|n|t|e|r|f|a|c|e| +0#0000000&|L|i|s|t|a|b|l|e| @47
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|C|o|n|s|<+0#e000e06&|E+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|_+0#0000000&|:|
 |E|)+0#e000e06&|:+0#0000000&| |L|i|s|t|a|b|l|e| @41
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|R|e|v|e|r|s|e|<+0#e000e06&|E+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|)|:+0#0000000&|
 |L|i|s|t|a|b|l|e| @42
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|R|e|s|t|(+0#e000e06&|)|:+0#0000000&| |L|i|s|t|a|b|l|e| @48
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|F|i|r|s|t|<+0#e000e06&|E+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|)|:+0#0000000&|
 |E| @51
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|e+0#00e0e07&|m|p|t|y|(+0#e000e06&|)|:+0#0000000&| 
|b+0#00e0003&|o@1|l| +0#0000000&@51
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|l+0#00e0e07&|e|n|(+0#e000e06&|)|:+0#0000000&| 
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@51
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|s+0#00e0e07&|t|r|i|n|g|(+0#e000e06&|)|:+0#0000000&| 
|s+0#00e0003&|t|r|i|n|g| +0#0000000&@48
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|n|d|i|n|t|e|r|f|a|c|e| 
+0#0000000&@60
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+@57|1|,|1| @10|T|o|p| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_01.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_01.dump
new file mode 100644
index 000000000..40b7f99da
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_01.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|F|i|r|s|t|<+0#e000e06&|E+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|)|:+0#0000000&|
 |E| @51
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|e+0#00e0e07&|m|p|t|y|(+0#e000e06&|)|:+0#0000000&| 
|b+0#00e0003&|o@1|l| +0#0000000&@51
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|l+0#00e0e07&|e|n|(+0#e000e06&|)|:+0#0000000&| 
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@51
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|s+0#00e0e07&|t|r|i|n|g|(+0#e000e06&|)|:+0#0000000&| 
|s+0#00e0003&|t|r|i|n|g| +0#0000000&@48
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|n|d|i|n|t|e|r|f|a|c|e| 
+0#0000000&@60
+| +0#0000e05#a8a8a8255@1> +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|n|u|m| 
+0#0000000&|E|m|p|t|y|L|i|s|t| |i+0#af5f00255&|m|p|l|e|m|e|n|t|s| 
+0#0000000&|L|i|s|t|a|b|l|e| @38
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|I|N|S|T|A|N|C|E| @60
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|C|o|n|s|<+0#e000e06&|E+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|v+0#0000000&|a|l|u|e|:|
 |E|)+0#e000e06&|:+0#0000000&| |L|i|s|t|a|b|l|e| @37
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|L|i|s|t|.|n+0#00e0e07&|e|w|<+0#e000e06&|E+0#0000000&|>+0#e000e06&|(|v+0#0000000&|a|l|u|e|)+0#e000e06&|
 +0#0000000&@39
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|R|e|v|e|r|s|e|<+0#e000e06&|E+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|)|:+0#0000000&|
 |L|i|s|t|a|b|l|e| @42
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|t+0#00e0e07&|h|i|s| +0#0000000&@53
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|R|e|s|t|(+0#e000e06&|)|:+0#0000000&| |L|i|s|t|a|b|l|e| @48
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|t+0#00e0e07&|h|i|s| +0#0000000&@53
+@57|1|8|,|0|-|1| @8|6|%| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_02.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_02.dump
new file mode 100644
index 000000000..b797ebfd4
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_02.dump
@@ -0,0 +1,20 @@
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|t+0#00e0e07&|h|i|s| +0#0000000&@53
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|F|i|r|s|t|<+0#e000e06&|E+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|)|:+0#0000000&|
 |E| @51
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|n+0#e000002&|u|l@1| +0#0000000&@53
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3>e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|e+0#00e0e07&|m|p|t|y|(+0#e000e06&|)|:+0#0000000&| 
|b+0#00e0003&|o@1|l| +0#0000000&@51
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|t+0#e000002&|r|u|e| +0#0000000&@53
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|l+0#00e0e07&|e|n|(+0#e000e06&|)|:+0#0000000&| 
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@51
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|0+0#e000002&| +0#0000000&@56
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|s+0#00e0e07&|t|r|i|n|g|(+0#e000e06&|)|:+0#0000000&| 
|s+0#00e0003&|t|r|i|n|g| +0#0000000&@48
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|'+0#e000002&|[|]|'| +0#0000000&@53
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|n|d|e|n|u|m| +0#0000000&@65
+@57|3|6|,|5| @9|1|5|%| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_03.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_03.dump
new file mode 100644
index 000000000..48b0229fd
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_03.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|n|d|e|n|u|m| +0#0000000&@65
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|l|a|s@1| +0#0000000&|L|i|s|t| 
|i+0#af5f00255&|m|p|l|e|m|e|n|t|s| +0#0000000&|L|i|s|t|a|b|l|e| @42
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|c+0#af5f00255&|o|n|s|t| 
+0#0000000&|_|v|a|l|u|e|:| |a+0#00e0003&|n|y| +0#0000000&@51
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|c+0#af5f00255&|o|n|s|t| 
+0#0000000&|_|s|i|z|e|:| |n+0#00e0003&|u|m|b|e|r| +0#0000000&@49
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3>v+0#af5f00255&|a|r| 
+0#0000000&|_|n|e|x|t|:| |L|i|s|t|a|b|l|e| @49
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|n+0#00e0e07&|e|w|<+0#e000e06&|E+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|v+0#0000000&|a|l|u|e|:|
 |E|)+0#e000e06&| +0#0000000&@48
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@7|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|v|a|l|u|e| 
|=+0#af5f00255&| +0#0000000&|v|a|l|u|e| @45
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@7|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|s|i|z|e| 
|=+0#af5f00255&| +0#0000000&|1+0#e000002&| +0#0000000&@50
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@7|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|n|e|x|t| 
|=+0#af5f00255&| 
+0#0000000&|E|m|p|t|y|L|i|s|t|.+0#af5f00255&|I+0#0000000&|N|S|T|A|N|C|E| @33
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|_+0#00e0e07&|n|e|w|C|o|n|s|<+0#e000e06&|E+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|v+0#0000000&|a|l|u|e|:|
 |E|,| |s|i|z|e|:| |n+0#00e0003&|u|m|b|e|r|)+0#e000e06&| +0#0000000&@29
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@7|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|v|a|l|u|e| 
|=+0#af5f00255&| +0#0000000&|v|a|l|u|e| @45
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@7|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|s|i|z|e| 
|=+0#af5f00255&| +0#0000000&|s|i|z|e| @47
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|C|o|n|s|<+0#e000e06&|E+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|v+0#0000000&|a|l|u|e|:|
 |E|)+0#e000e06&|:+0#0000000&| |L|i|s|t|a|b|l|e| @37
+@57|5|4|,|5| @9|2|4|%| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_04.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_04.dump
new file mode 100644
index 000000000..7f11c19d8
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_04.dump
@@ -0,0 +1,20 @@
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|C|o|n|s|<+0#e000e06&|E+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|v+0#0000000&|a|l|u|e|:|
 |E|)+0#e000e06&|:+0#0000000&| |L|i|s|t|a|b|l|e| @37
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|c+0#af5f00255&|o|n|s|t| 
+0#0000000&|l|i|s|t|:| |L|i|s|t| |=+0#af5f00255&| 
+0#0000000&|L|i|s|t|.|_+0#00e0e07&|n|e|w|C|o|n|s|<+0#e000e06&|E+0#0000000&|>+0#e000e06&|(|v+0#0000000&|a|l|u|e|,|
 |(+0#e000e06&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|s|i|z|e| 
|++0#af5f00255&| +0#0000000&|1+0#e000002&|)+0#e000e06&@1| +0#0000000&@4
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@7|l|i|s|t|.+0#af5f00255&|_+0#0000000&|n|e|x|t| 
|=+0#af5f00255&| +0#0000000&|t+0#00e0e07&|h|i|s| +0#0000000&@47
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|l|i|s|t| @53
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1> +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|R|e|v|e|r|s|e|<+0#e000e06&|E+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|)|:+0#0000000&|
 |L|i|s|t|a|b|l|e| @42
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|v+0#af5f00255&|a|r| 
+0#0000000&|r|e|s|u|l|t|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|L|i|s|t|.|n+0#00e0e07&|e|w|<+0#e000e06&|E+0#0000000&|>+0#e000e06&|(|t+0#00e0e07&|h|i|s|.+0#0000000&|F|i|r|s|t|<+0#e000e06&|E+0#0000000&|>+0#e000e06&|(|)@1|
 +0#0000000&@13
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|v+0#af5f00255&|a|r| 
+0#0000000&|l|i|s|t|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|t+0#00e0e07&|h|i|s|.+0#0000000&|R|e|s|t|(+0#e000e06&|)| 
+0#0000000&@32
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@72
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|w+0#af5f00255&|h|i|l|e| 
+0#0000000&|!+0#af5f00255&|l+0#0000000&|i|s|t|.|e+0#00e0e07&|m|p|t|y|(+0#e000e06&|)|
 +0#0000000&@45
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@11|r|e|s|u|l|t| |=+0#af5f00255&| 
+0#0000000&|r|e|s|u|l|t|.|C|o|n|s|<+0#e000e06&|E+0#0000000&|>+0#e000e06&|(|l+0#0000000&|i|s|t|.|F|i|r|s|t|<+0#e000e06&|E+0#0000000&|>+0#e000e06&|(|)@1|
 +0#0000000&@20
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@11|l|i|s|t| |=+0#af5f00255&| 
+0#0000000&|l|i|s|t|.|R|e|s|t|(+0#e000e06&|)| +0#0000000&@42
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|e+0#af5f00255&|n|d|w|h|i|l|e| 
+0#0000000&@56
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@72
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|r|e|s|u|l|t| @51
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|R|e|s|t|(+0#e000e06&|)|:+0#0000000&| |L|i|s|t|a|b|l|e| @48
+@57|7|2|,|0|-|1| @7|3@1|%| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_05.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_05.dump
new file mode 100644
index 000000000..369255c05
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_05.dump
@@ -0,0 +1,20 @@
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|R|e|s|t|(+0#e000e06&|)|:+0#0000000&| |L|i|s|t|a|b|l|e| @48
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|n|e|x|t| @47
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|F|i|r|s|t|<+0#e000e06&|E+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|)|:+0#0000000&|
 |E| @51
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7>r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|v|a|l|u|e| @46
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|e+0#00e0e07&|m|p|t|y|(+0#e000e06&|)|:+0#0000000&| 
|b+0#00e0003&|o@1|l| +0#0000000&@51
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|(+0#e000e06&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|s|i|z|e|
 |=+0#af5f00255&@1| +0#0000000&|0+0#e000002&|)+0#e000e06&| +0#0000000&@40
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|l+0#00e0e07&|e|n|(+0#e000e06&|)|:+0#0000000&| 
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@51
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|s|i|z|e| @47
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|s+0#00e0e07&|t|r|i|n|g|(+0#e000e06&|)|:+0#0000000&| 
|s+0#00e0003&|t|r|i|n|g| +0#0000000&@48
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|i+0#af5f00255&|f| 
+0#0000000&|t+0#00e0e07&|h|i|s|.+0#0000000&|e+0#00e0e07&|m|p|t|y|(+0#e000e06&|)|
 +0#0000000&@49
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@11|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|'+0#e000002&|[|]|'| +0#0000000&@49
+@57|9|0|,|2|-|9| @7|4|2|%| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_06.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_06.dump
new file mode 100644
index 000000000..2736cf138
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_06.dump
@@ -0,0 +1,20 @@
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@11|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|'+0#e000002&|[|]|'| +0#0000000&@49
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|e+0#af5f00255&|n|d|i|f| 
+0#0000000&@59
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@72
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|v+0#af5f00255&|a|r| 
+0#0000000&|t|e|x|t|:| |s+0#00e0003&|t|r|i|n|g| +0#0000000&|=+0#af5f00255&| 
+0#0000000&|'+0#e000002&|[|'| +0#0000000&|.+0#af5f00255&@1| 
+0#0000000&|s+0#00e0e07&|t|r|i|n|g|(+0#e000e06&|t+0#00e0e07&|h|i|s|.+0#0000000&|F|i|r|s|t|<+0#e000e06&|a+0#00e0003&|n|y|>+0#e000e06&|(|)@1|
 +0#0000000&|.+0#af5f00255&@1| +0#0000000&|'+0#e000002&|,| |'| +0#0000000&@5
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|v+0#af5f00255&|a|r| 
+0#0000000&|l|i|s|t|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|t+0#00e0e07&|h|i|s|.+0#0000000&|R|e|s|t|(+0#e000e06&|)| 
+0#0000000&@32
+||+0#0000e05#a8a8a8255| > +0#0000000#ffffff0@72
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|w+0#af5f00255&|h|i|l|e| 
+0#0000000&|!+0#af5f00255&|l+0#0000000&|i|s|t|.|e+0#00e0e07&|m|p|t|y|(+0#e000e06&|)|
 +0#0000000&@45
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@11|t|e|x|t| |.+0#af5f00255&@1|=| 
+0#0000000&|s+0#00e0e07&|t|r|i|n|g|(+0#e000e06&|l+0#0000000&|i|s|t|.|F|i|r|s|t|<+0#e000e06&|a+0#00e0003&|n|y|>+0#e000e06&|(|)@1|
 +0#0000000&|.+0#af5f00255&@1| +0#0000000&|'+0#e000002&|,| |'| +0#0000000&@18
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@11|l|i|s|t| |=+0#af5f00255&| 
+0#0000000&|l|i|s|t|.|R|e|s|t|(+0#e000e06&|)| +0#0000000&@42
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|e+0#af5f00255&|n|d|w|h|i|l|e| 
+0#0000000&@56
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@72
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|s+0#00e0e07&|t|r|p|a|r|t|(+0#e000e06&|t+0#0000000&|e|x|t|,| 
|0+0#e000002&|,+0#0000000&| 
|(+0#e000e06&|s+0#00e0e07&|t|r|l|e|n|(+0#e000e06&|t+0#0000000&|e|x|t|)+0#e000e06&|
 +0#0000000&|-+0#af5f00255&| +0#0000000&|2+0#e000002&|)+0#e000e06&@1| 
+0#0000000&|.+0#af5f00255&@1| +0#0000000&|'+0#e000002&|]|'| +0#0000000&@14
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|n|d|c|l|a|s@1| +0#0000000&@64
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|x|p|o|r|t| 
+0#0000000&|d+0#af5f00255&|e|f| 
+0#0000000&|M|a|k|e|E|m|p|t|y|L|i|s|t|(+0#e000e06&|)|:+0#0000000&| 
|L|i|s|t|a|b|l|e| @36
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|E|m|p|t|y|L|i|s|t|.+0#af5f00255&|I+0#0000000&|N|S|T|A|N|C|E| @43
+||+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|n|d@1|e|f| +0#0000000&@66
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+@57|1|0|8|,|0|-|1| @6|5|2|%| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_07.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_07.dump
new file mode 100644
index 000000000..881fb0968
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_07.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|x|p|o|r|t| 
+0#0000000&|d+0#af5f00255&|e|f| 
+0#0000000&|M|a|k|e|L|i|s|t|<+0#e000e06&|E+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|v+0#0000000&|a|l|u|e|:|
 |E|)+0#e000e06&|:+0#0000000&| |L|i|s|t|a|b|l|e| @30
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|L|i|s|t|.|n+0#00e0e07&|e|w|<+0#e000e06&|E+0#0000000&|>+0#e000e06&|(|v+0#0000000&|a|l|u|e|)+0#e000e06&|
 +0#0000000&@43
+||+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|n|d@1|e|f| +0#0000000&@66
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| >e+0#af5f00255#ffffff0|x|p|o|r|t| 
+0#0000000&|d+0#af5f00255&|e|f| 
+0#0000000&|M|a|p|<+0#e000e06&|T+0#0000001#ffff4012|,+0#0000000#ffffff0| 
|U+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|l+0#0000000&|i|s|t|a|b|l|e|:| 
|L|i|s|t|a|b|l|e|,| |M|a|p@1|e|r|:| 
|f+0#00e0003&|u|n|c|(|T+0#0000000&|)+0#00e0003&|:+0#0000000&| 
|U|)+0#e000e06&|:+0#0000000&| |L|i|s|t|a|b|l|e| @2
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|v+0#af5f00255&|a|r| 
+0#0000000&|r|e|s|u|l|t|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|E|m|p|t|y|L|i|s|t|.+0#af5f00255&|I+0#0000000&|N|S|T|A|N|C|E| @27
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|v+0#af5f00255&|a|r| 
+0#0000000&|l|i|s|t|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|l|i|s|t|a|b|l|e| @39
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@72
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|w+0#af5f00255&|h|i|l|e| 
+0#0000000&|!+0#af5f00255&|l+0#0000000&|i|s|t|.|e+0#00e0e07&|m|p|t|y|(+0#e000e06&|)|
 +0#0000000&@49
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r|e|s|u|l|t| |=+0#af5f00255&| 
+0#0000000&|r|e|s|u|l|t|.|C|o|n|s|<+0#e000e06&|U+0#0000000&|>+0#e000e06&|(|M+0#0000000&|a|p@1|e|r|(+0#e000e06&|l+0#0000000&|i|s|t|.|F|i|r|s|t|<+0#e000e06&|T+0#0000000&|>+0#e000e06&|(|)@2|
 +0#0000000&@16
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|l|i|s|t| |=+0#af5f00255&| 
+0#0000000&|l|i|s|t|.|R|e|s|t|(+0#e000e06&|)| +0#0000000&@46
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d|w|h|i|l|e| 
+0#0000000&@60
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@72
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|r|e|s|u|l|t|.|R|e|v|e|r|s|e|<+0#e000e06&|U+0#0000000&|>+0#e000e06&|(|)|
 +0#0000000&@42
+||+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|n|d@1|e|f| +0#0000000&@66
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|x|p|o|r|t| 
+0#0000000&|d+0#af5f00255&|e|f| 
+0#0000000&|F|i|l|t|e|r|<+0#e000e06&|T+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|l+0#0000000&|i|s|t|a|b|l|e|:|
 |L|i|s|t|a|b|l|e|,| |P|r|e|d|i|c|a|t|e|:| 
|f+0#00e0003&|u|n|c|(|T+0#0000000&|)+0#00e0003&|:+0#0000000&| 
|b+0#00e0003&|o@1|l|)+0#e000e06&|:+0#0000000&| |L|i|s|t|a
+|-+0#0000e05#a8a8a8255| |b+0#0000000#ffffff0|l|e| @69
+@57|1|2|6|,|1| @8|6|0|%| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_08.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_08.dump
new file mode 100644
index 000000000..c243859a6
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_08.dump
@@ -0,0 +1,20 @@
+|-+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|x|p|o|r|t| 
+0#0000000&|d+0#af5f00255&|e|f| 
+0#0000000&|F|i|l|t|e|r|<+0#e000e06&|T+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|l+0#0000000&|i|s|t|a|b|l|e|:|
 |L|i|s|t|a|b|l|e|,| |P|r|e|d|i|c|a|t|e|:| 
|f+0#00e0003&|u|n|c|(|T+0#0000000&|)+0#00e0003&|:+0#0000000&| 
|b+0#00e0003&|o@1|l|)+0#e000e06&|:+0#0000000&| |L|i|s|t|a
+|-+0#0000e05#a8a8a8255| |b+0#0000000#ffffff0|l|e| @69
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|v+0#af5f00255&|a|r| 
+0#0000000&|r|e|s|u|l|t|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|E|m|p|t|y|L|i|s|t|.+0#af5f00255&|I+0#0000000&|N|S|T|A|N|C|E| @27
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|v+0#af5f00255&|a|r| 
+0#0000000&|l|i|s|t|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|l|i|s|t|a|b|l|e| @39
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@72
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3>w+0#af5f00255&|h|i|l|e| 
+0#0000000&|!+0#af5f00255&|l+0#0000000&|i|s|t|.|e+0#00e0e07&|m|p|t|y|(+0#e000e06&|)|
 +0#0000000&@49
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|i+0#af5f00255&|f| 
+0#0000000&|P|r|e|d|i|c|a|t|e|(+0#e000e06&|l+0#0000000&|i|s|t|.|F|i|r|s|t|<+0#e000e06&|T+0#0000000&|>+0#e000e06&|(|)@1|
 +0#0000000&@35
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@11|r|e|s|u|l|t| |=+0#af5f00255&| 
+0#0000000&|r|e|s|u|l|t|.|C|o|n|s|<+0#e000e06&|T+0#0000000&|>+0#e000e06&|(|l+0#0000000&|i|s|t|.|F|i|r|s|t|<+0#e000e06&|T+0#0000000&|>+0#e000e06&|(|)@1|
 +0#0000000&@20
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|e+0#af5f00255&|n|d|i|f| 
+0#0000000&@59
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@72
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|l|i|s|t| |=+0#af5f00255&| 
+0#0000000&|l|i|s|t|.|R|e|s|t|(+0#e000e06&|)| +0#0000000&@46
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d|w|h|i|l|e| 
+0#0000000&@60
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@72
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|r|e|s|u|l|t|.|R|e|v|e|r|s|e|<+0#e000e06&|T+0#0000000&|>+0#e000e06&|(|)|
 +0#0000000&@42
+||+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|n|d@1|e|f| +0#0000000&@66
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0@59| +0#0000000&@12
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|M|a|k|e|E|m|p|t|y|L|i|s|t|(+0#e000e06&|)| +0#0000000&@52
+@57|1|4|2|,|5| @8|6|9|%| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_09.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_09.dump
new file mode 100644
index 000000000..4e4185570
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_09.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|M|a|k|e|E|m|p|t|y|L|i|s|t|(+0#e000e06&|)| +0#0000000&@52
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| 
+0#0000000&|l|i|s|t|X|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|M|a|k|e|E|m|p|t|y|L|i|s|t|(+0#e000e06&|)| +0#0000000&@33
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3|.+0#af5f00255&|C+0#0000000&|o|n|s|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|0+0#e000002&|)+0#e000e06&|.+0#af5f00255&|C+0#0000000&|o|n|s|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|1+0#e000002&|)+0#e000e06&|.+0#af5f00255&|C+0#0000000&|o|n|s|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|2+0#e000002&|)+0#e000e06&|.+0#af5f00255&|C+0#0000000&|o|n|s|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|3+0#e000002&|)+0#e000e06&|
 +0#0000000&@4
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| 
+0#0000000&|l|i|s|t|Y|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|M|a|k|e|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|0+0#e000002&|)+0#e000e06&|
 +0#0000000&@29
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3>.+0#af5f00255&|C+0#0000000&|o|n|s|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|1+0#e000002&|)+0#e000e06&|.+0#af5f00255&|C+0#0000000&|o|n|s|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|2+0#e000002&|)+0#e000e06&|.+0#af5f00255&|C+0#0000000&|o|n|s|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|3+0#e000002&|)+0#e000e06&|
 +0#0000000&@20
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| +0#0000000&|l|i|s|t|X| 
|=+0#af5f00255&@1| +0#0000000&|l|i|s|t|Y| @53
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| +0#0000000&|l|i|s|t|X| 
@62
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|l|i|s|t|X|.|R|e|v|e|r|s|e|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|)|
 +0#0000000&@44
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|M|a|k|e|E|m|p|t|y|L|i|s|t|(+0#e000e06&|)|.+0#af5f00255&|R+0#0000000&|e|v|e|r|s|e|<+0#e000e06&|a+0#00e0003&|n|y|>+0#e000e06&|(|)|
 +0#0000000&@37
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|F|i|l|t|e|r|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|l+0#0000000&|i|s|t|X|,|
 |(+0#e000e06&|v+0#0000000&|a|l|u|e|:| |n+0#00e0003&|u|m|b|e|r|)+0#e000e06&| 
+0#0000000&|=+0#af5f00255&|>| +0#0000000&|v|a|l|u|e| |%+0#af5f00255&| 
+0#0000000&|2+0#e000002&| +0#0000000&|!+0#af5f00255&|=| 
+0#0000000&|0+0#e000002&|)+0#e000e06&| +0#0000000&@11
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|M|a|p|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|,+0#0000000&| 
|s+0#00e0003&|t|r|i|n|g|>+0#e000e06&|(|l+0#0000000&|i|s|t|X|,| 
|(+0#e000e06&|v+0#0000000&|a|l|u|e|:| |n+0#00e0003&|u|m|b|e|r|)+0#e000e06&| 
+0#0000000&|=+0#af5f00255&|>| 
+0#0000000&|n+0#00e0e07&|r|2|c|h|a|r|(+0#e000e06&@1|v+0#0000000&|a|l|u|e| 
|++0#af5f00255&| +0#0000000&|6+0#e000002&|0|)+0#e000e06&|,+0#0000000&| 
+| +0#0000e05#a8a8a8255@1|1+0#e000002#ffffff0|)+0#e000e06&@1| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|4+0#e000002&| 
+0#0000000&|l|i|s|t|X|.|l+0#00e0e07&|e|n|(+0#e000e06&|)| 
+0#0000000&|l|i|s|t|Y|.|l+0#00e0e07&|e|n|(+0#e000e06&|)| +0#0000000&@42
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| +0#0000000&|l|i|s|t|X| 
@62
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| +0#0000000&|l|i|s|t|Y| 
@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| 
+0#0000000&|l|i|s|t|3|X|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|l|i|s|t|X|.|R|e|s|t|(+0#e000e06&|)| +0#0000000&@35
+@57|1|6|0|,|5| @8|7|8|%| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_10.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_10.dump
new file mode 100644
index 000000000..ffda6f920
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_10.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| 
+0#0000000&|l|i|s|t|3|X|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|l|i|s|t|X|.|R|e|s|t|(+0#e000e06&|)| +0#0000000&@35
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| 
+0#0000000&|l|i|s|t|3|Y|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|l|i|s|t|Y|.|R|e|s|t|(+0#e000e06&|)| +0#0000000&@35
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|3+0#e000002&| 
+0#0000000&|l|i|s|t|3|X|.|l+0#00e0e07&|e|n|(+0#e000e06&|)| 
+0#0000000&|l|i|s|t|3|Y|.|l+0#00e0e07&|e|n|(+0#e000e06&|)| +0#0000000&@40
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| +0#0000000&|l|i|s|t|3|X| 
@61
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| +0#0000000&|l|i|s|t|3|Y| 
@61
+| +0#0000e05#a8a8a8255@1> +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| 
+0#0000000&|l|i|s|t|2|X|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|l|i|s|t|3|X|.|R|e|s|t|(+0#e000e06&|)| +0#0000000&@34
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| 
+0#0000000&|l|i|s|t|2|Y|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|l|i|s|t|3|Y|.|R|e|s|t|(+0#e000e06&|)| +0#0000000&@34
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|2+0#e000002&| 
+0#0000000&|l|i|s|t|2|X|.|l+0#00e0e07&|e|n|(+0#e000e06&|)| 
+0#0000000&|l|i|s|t|2|Y|.|l+0#00e0e07&|e|n|(+0#e000e06&|)| +0#0000000&@40
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| +0#0000000&|l|i|s|t|2|X| 
@61
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| +0#0000000&|l|i|s|t|2|Y| 
@61
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| 
+0#0000000&|l|i|s|t|1|X|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|l|i|s|t|2|X|.|R|e|s|t|(+0#e000e06&|)| +0#0000000&@34
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| 
+0#0000000&|l|i|s|t|1|Y|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|l|i|s|t|2|Y|.|R|e|s|t|(+0#e000e06&|)| +0#0000000&@34
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|1+0#e000002&| 
+0#0000000&|l|i|s|t|1|X|.|l+0#00e0e07&|e|n|(+0#e000e06&|)| 
+0#0000000&|l|i|s|t|1|Y|.|l+0#00e0e07&|e|n|(+0#e000e06&|)| +0#0000000&@40
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| +0#0000000&|l|i|s|t|1|X| 
@61
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| +0#0000000&|l|i|s|t|1|Y| 
@61
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| 
+0#0000000&|l|i|s|t|0|X|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|l|i|s|t|1|X|.|R|e|s|t|(+0#e000e06&|)| +0#0000000&@34
+@57|1|7@1|,|0|-|1| @6|8|7|%| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_11.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_11.dump
new file mode 100644
index 000000000..5a6e03071
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_11.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| 
+0#0000000&|l|i|s|t|0|X|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|l|i|s|t|1|X|.|R|e|s|t|(+0#e000e06&|)| +0#0000000&@34
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| 
+0#0000000&|l|i|s|t|0|Y|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|l|i|s|t|1|Y|.|R|e|s|t|(+0#e000e06&|)| +0#0000000&@34
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|0+0#e000002&| 
+0#0000000&|l|i|s|t|0|X|.|l+0#00e0e07&|e|n|(+0#e000e06&|)| 
+0#0000000&|l|i|s|t|0|Y|.|l+0#00e0e07&|e|n|(+0#e000e06&|)| +0#0000000&@40
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| +0#0000000&|l|i|s|t|0|X| 
@61
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| +0#0000000&|l|i|s|t|0|Y| 
@61
+| +0#0000e05#a8a8a8255@1> +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| 
+0#0000000&|l|i|s|t|0|X|_|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|l|i|s|t|0|X|.|R|e|s|t|(+0#e000e06&|)| +0#0000000&@33
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| 
+0#0000000&|l|i|s|t|0|Y|_|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|l|i|s|t|0|Y|.|R|e|s|t|(+0#e000e06&|)| +0#0000000&@33
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|0+0#e000002&| 
+0#0000000&|l|i|s|t|0|X|_|.|l+0#00e0e07&|e|n|(+0#e000e06&|)| 
+0#0000000&|l|i|s|t|0|Y|_|.|l+0#00e0e07&|e|n|(+0#e000e06&|)| +0#0000000&@38
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|l|i|s|t|0|X|_| @60
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|l|i|s|t|0|Y|_| @60
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| 
+0#0000000&|l|i|s|t|0|X|_@1|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|l|i|s|t|0|X|_|.|R|e|s|t|(+0#e000e06&|)| +0#0000000&@31
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| 
+0#0000000&|l|i|s|t|0|Y|_@1|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|l|i|s|t|0|Y|_|.|R|e|s|t|(+0#e000e06&|)| +0#0000000&@31
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|0+0#e000002&| 
+0#0000000&|l|i|s|t|0|X|_@1|.|l+0#00e0e07&|e|n|(+0#e000e06&|)| 
+0#0000000&|l|i|s|t|0|Y|_@1|.|l+0#00e0e07&|e|n|(+0#e000e06&|)| +0#0000000&@36
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|l|i|s|t|0|X|_@1| @59
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|l|i|s|t|0|Y|_@1| @59
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+@57|1|9|5|,|0|-|1| @6|9|6|%| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_12.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_12.dump
new file mode 100644
index 000000000..e4e65e3bf
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_list_12.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| 
+0#0000000&|l|i|s|t|Z|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|M|a|k|e|L|i|s|t|<+0#e000e06&|L+0#0000000&|i|s|t|a|b|l|e|>+0#e000e06&|(|M+0#0000000&|a|k|e|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|-+0#af5f00255&|1+0#e000002&|)+0#e000e06&@1|
 +0#0000000&@8
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| 
+0#0000000&|l|i|s|t|Z@1|:| |L|i|s|t|a|b|l|e| |=+0#af5f00255&| 
+0#0000000&|l|i|s|t|Z|.|C|o|n|s|<+0#e000e06&|L+0#0000000&|i|s|t|a|b|l|e|>+0#e000e06&|(|M+0#0000000&|a|k|e|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|0+0#e000002&|)+0#e000e06&@1|
 +0#0000000&@6
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3|.+0#af5f00255&|C+0#0000000&|o|n|s|<+0#e000e06&|L+0#0000000&|i|s|t|a|b|l|e|>+0#e000e06&|(|M+0#0000000&|a|k|e|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|1+0#e000002&|)+0#e000e06&@1|
 +0#0000000&@32
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3|.+0#af5f00255&|C+0#0000000&|o|n|s|<+0#e000e06&|L+0#0000000&|i|s|t|a|b|l|e|>+0#e000e06&|(|M+0#0000000&|a|k|e|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|2+0#e000002&|)+0#e000e06&@1|
 +0#0000000&@32
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3>.+0#af5f00255&|C+0#0000000&|o|n|s|<+0#e000e06&|L+0#0000000&|i|s|t|a|b|l|e|>+0#e000e06&|(|M+0#0000000&|a|k|e|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|3+0#e000002&|)+0#e000e06&@1|
 +0#0000000&@32
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| +0#0000000&|l|i|s|t|Z@1| 
@61
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|2|1|3|,|5| @8|B|o|t| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_00.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_00.dump
new file mode 100644
index 000000000..0098b2251
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_00.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1>v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| 
|h|i|g|h|l|i|g|h|t| |l|i|n|k| |v|i|m|9|D|e|f|T|y|p|e|P|a|r|a|m| |T|o|d|o| 
+0#0000000&@19
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |l|e|t| 
|g|:|v|i|m|s|y|n|_|f|o|l|d|i|n|g| |=| |"+0#e000002&|f|"| +0#0000000&@29
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |s|e|t|l| 
|f|d|c|=|2| |f|d|l|=|9@1| |f|d|m|=|s|y|n|t|a|x| +0#0000000&@27
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| +0#0000000&|S+0#e000e06&|e@1|:| 
+0#0000e05&|h|t@1|p|s|:|/@1|g|i|t|h|u|b|.|c|o|m|/|v|i|m|/|v|i|m|/|p|u|l@1|/|1|7|3|1|3|#|i|s@1|u|e|c|o|m@1|e|n|t|-|3|0|4|6@1|9|6|8|2|0|
 |(|A|l|i
+| +0&#a8a8a8255@1|a+0&#ffffff0|k|s|e|i| |B|u|d|a|v|e|i|)| +0#0000000&@58
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |S|e@1| 
|h|t@1|p|s|:|/@1|g|i|t|h|u|b|.|c|o|m|/|v|i|m|/|v|i|m|/|i|s@1|u|e|s|/|1|4|3@1|0|#|i|s@1|u|e|c|o|m@1|e|n|t|-|2|0|2|8|9|3|8|5|1|5|
 |.| +0#0000000&@1
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|x|p|o|r|t| 
+0#0000000&|c+0#af5f00255&|l|a|s@1| +0#0000000&|S|e|t| @56
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|f+0#af5f00255&|i|n|a|l| 
+0#0000000&|_|e|l|e|m|e|n|t|s|:| |d+0#00e0003&|i|c|t|<|n|u|m|b|e|r|>| 
+0#0000000&@39
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|c+0#af5f00255&|o|n|s|t| 
+0#0000000&|_|M|a|p@1|e|r|:| |f+0#00e0003&|u|n|c|(|n|u|m|b|e|r|,+0#0000000&| 
|s+0#00e0003&|t|r|i|n|g|)|:+0#0000000&| |a+0#00e0003&|n|y| +0#0000000&@28
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|c+0#af5f00255&|o|n|s|t| 
+0#0000000&|T|o|S|t|r|i|n|g|e|r|:| |f+0#00e0003&|u|n|c|(|a|n|y|)|:+0#0000000&| 
|s+0#00e0003&|t|r|i|n|g| +0#0000000&@33
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|c+0#af5f00255&|o|n|s|t| 
+0#0000000&|F|r|o|m|S|t|r|i|n|g|e|r|:| 
|f+0#00e0003&|u|n|c|(|s|t|r|i|n|g|)|:+0#0000000&| |a+0#00e0003&|n|y| 
+0#0000000&@31
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|s+0#af5f00255&|t|a|t|i|c| 
+0#0000000&|d+0#af5f00255&|e|f| 
+0#0000000&|_|M|a|p@1|e|r|<+0#e000e06&|E+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|F+0#0000000&|:|
 |f+0#00e0003&|u|n|c|(|s|t|r|i|n|g|)|:+0#0000000&| 
|E|)+0#e000e06&|:+0#0000000&| |f+0#00e0003&|u|n|c|(|n|u|m|b|e|r|,+0#0000000&| 
|s+0#00e0003&|t|r|i|n|g|)|:+0#0000000&| |E| @2
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|(+0#e000e06&@1|G+0#0000000&|:| 
|f+0#00e0003&|u|n|c|(|s|t|r|i|n|g|)|:+0#0000000&| |E|)+0#e000e06&| 
+0#0000000&|=+0#af5f00255&|>| +0#0000000&|(+0#e000e06&|_+0#0000000&|:| 
|n+0#00e0003&|u|m|b|e|r|,+0#0000000&| |v|:| 
|s+0#00e0003&|t|r|i|n|g|)+0#e000e06&|:+0#0000000&| |E| |=+0#af5f00255&|>| 
+0#0000000&|G|(+0#e000e06&|v+0#0000000&|)+0#e000e06&
+||+0#0000e05#a8a8a8255| |)+0#e000e06#ffffff0|(|F+0#0000000&|)+0#e000e06&| 
+0#0000000&@68
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+@57|1|,|1| @10|T|o|p| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_01.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_01.dump
new file mode 100644
index 000000000..370240619
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_01.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|s+0#af5f00255&|t|a|t|i|c| 
+0#0000000&|d+0#af5f00255&|e|f| 
+0#0000000&|_|M|a|p@1|e|r|<+0#e000e06&|E+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|F+0#0000000&|:|
 |f+0#00e0003&|u|n|c|(|s|t|r|i|n|g|)|:+0#0000000&| 
|E|)+0#e000e06&|:+0#0000000&| |f+0#00e0003&|u|n|c|(|n|u|m|b|e|r|,+0#0000000&| 
|s+0#00e0003&|t|r|i|n|g|)|:+0#0000000&| |E| @2
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|(+0#e000e06&@1|G+0#0000000&|:| 
|f+0#00e0003&|u|n|c|(|s|t|r|i|n|g|)|:+0#0000000&| |E|)+0#e000e06&| 
+0#0000000&|=+0#af5f00255&|>| +0#0000000&|(+0#e000e06&|_+0#0000000&|:| 
|n+0#00e0003&|u|m|b|e|r|,+0#0000000&| |v|:| 
|s+0#00e0003&|t|r|i|n|g|)+0#e000e06&|:+0#0000000&| |E| |=+0#af5f00255&|>| 
+0#0000000&|G|(+0#e000e06&|v+0#0000000&|)+0#e000e06&
+||+0#0000e05#a8a8a8255| |)+0#e000e06#ffffff0|(|F+0#0000000&|)+0#e000e06&| 
+0#0000000&@68
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1> +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|n+0#00e0e07&|e|w|<+0#e000e06&|E+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|)|
 +0#0000000&@56
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@7|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|e|l|e|m|e|n|t|s|
 |=+0#af5f00255&| +0#0000000&|{+0#e000e06&|}| +0#0000000&@45
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@7|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|M|a|p@1|e|r|
 |=+0#af5f00255&| 
+0#0000000&|_|M|a|p@1|e|r|<+0#e000e06&|E+0#0000000&|>+0#e000e06&|(@1|s+0#0000000&|:|
 |s+0#00e0003&|t|r|i|n|g|)+0#e000e06&|:+0#0000000&| |E| |=+0#af5f00255&|>| 
+0#0000000&|e+0#00e0e07&|v|a|l|(+0#e000e06&|s+0#0000000&|)+0#e000e06&@1| 
+0#0000000&@12
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@7|t+0#00e0e07&|h|i|s|.+0#af5f00255&|T+0#0000000&|o|S|t|r|i|n|g|e|r|
 |=+0#af5f00255&| +0#0000000&|(+0#e000e06&|a+0#0000000&|:| 
|E|)+0#e000e06&|:+0#0000000&| |s+0#00e0003&|t|r|i|n|g| 
+0#0000000&|=+0#af5f00255&|>| 
+0#0000000&|s+0#00e0e07&|t|r|i|n|g|(+0#e000e06&|a+0#0000000&|)+0#e000e06&| 
+0#0000000&@19
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@7|t+0#00e0e07&|h|i|s|.+0#af5f00255&|F+0#0000000&|r|o|m|S|t|r|i|n|g|e|r|
 |=+0#af5f00255&| +0#0000000&|(+0#e000e06&|s+0#0000000&|:| 
|s+0#00e0003&|t|r|i|n|g|)+0#e000e06&|:+0#0000000&| |E| |=+0#af5f00255&|>| 
+0#0000000&|e+0#00e0e07&|v|a|l|(+0#e000e06&|s+0#0000000&|)+0#e000e06&| 
+0#0000000&@19
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|E+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|e+0#0000000&|l|e|m|e|n|t|s|:|
 |l+0#00e0003&|i|s|t|<|E+0#0000000&|>+0#00e0003&|,+0#0000000&| 
|T|o|S|t|r|i|n|g|e|r|:| 
|f+0#00e0003&|u|n|c|(|E+0#0000000&|)+0#00e0003&|:+0#0000000&| 
|s+0#00e0003&|t|r|i|n|g|,+0#0000000&| @2
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@39|F|r|o|m|S|t|r|i|n|g|e|r|:| 
|f+0#00e0003&|u|n|c|(|s|t|r|i|n|g|)|:+0#0000000&| |E|)+0#e000e06&| +0#0000000&@2
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@7|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|e|l|e|m|e|n|t|s|
 |=+0#af5f00255&| +0#0000000&|e|l|e|m|e|n|t|s| @39
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@11|-+0#af5f00255&|>|r+0#00e0e07&|e|d|u|c|e|(+0#e000e06&@2|F+0#0000000&|:|
 |f+0#00e0003&|u|n|c|(|E+0#0000000&|)+0#00e0003&|:+0#0000000&| 
|s+0#00e0003&|t|r|i|n|g|)+0#e000e06&| +0#0000000&|=+0#af5f00255&|>| 
+0#0000000&|(+0#e000e06&|d+0#0000000&|:| 
|d+0#00e0003&|i|c|t|<|n|u|m|b|e|r|>|,+0#0000000&| |v|:| |E|)+0#e000e06&| 
+0#0000000&|=+0#af5f00255&|>| +0#0000000&
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@15|e+0#00e0e07&|x|t|e|n|d|(+0#e000e06&|{|[|F+0#0000000&|(+0#e000e06&|v+0#0000000&|)+0#e000e06&|]|:+0#0000000&|
 |1+0#e000002&|}+0#e000e06&|,+0#0000000&| 
|d|)+0#e000e06&@1|(|T+0#0000000&|o|S|t|r|i|n|g|e|r|)+0#e000e06&|,+0#0000000&| 
@20
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@15|{+0#e000e06&|}|)| 
+0#0000000&@53
+@57|1|7|,|0|-|1| @8|7|%| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_02.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_02.dump
new file mode 100644
index 000000000..75211124b
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_02.dump
@@ -0,0 +1,20 @@
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@15|{+0#e000e06&|}|)| 
+0#0000000&@53
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@7|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|M|a|p@1|e|r|
 |=+0#af5f00255&| 
+0#0000000&|_|M|a|p@1|e|r|<+0#e000e06&|E+0#0000000&|>+0#e000e06&|(|F+0#0000000&|r|o|m|S|t|r|i|n|g|e|r|)+0#e000e06&|
 +0#0000000&@25
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@7|t+0#00e0e07&|h|i|s|.+0#af5f00255&|T+0#0000000&|o|S|t|r|i|n|g|e|r|
 |=+0#af5f00255&| +0#0000000&|T|o|S|t|r|i|n|g|e|r| @36
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@7|t+0#00e0e07&|h|i|s|.+0#af5f00255&|F+0#0000000&|r|o|m|S|t|r|i|n|g|e|r|
 |=+0#af5f00255&| +0#0000000&|F|r|o|m|S|t|r|i|n|g|e|r| @32
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1> +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|_|F|r|o|m|L|i|s|t|<+0#e000e06&|E+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|e+0#0000000&|l|e|m|e|n|t|s|:|
 |l+0#00e0003&|i|s|t|<|E+0#0000000&|>+0#00e0003&|)+0#e000e06&|:+0#0000000&| 
|S|e|t| @28
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|S|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|E+0#0000000&|>+0#e000e06&|(|e+0#0000000&|l|e|m|e|n|t|s|,|
 |t+0#00e0e07&|h|i|s|.+0#af5f00255&|T+0#0000000&|o|S|t|r|i|n|g|e|r|,| 
|t+0#00e0e07&|h|i|s|.+0#af5f00255&|F+0#0000000&|r|o|m|S|t|r
+||+0#0000e05#a8a8a8255| |i+0#0000000#ffffff0|n|g|e|r|)+0#e000e06&| 
+0#0000000&@66
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|C|o|n|t|a|i|n|s|<+0#e000e06&|E+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|e+0#0000000&|l|e|m|e|n|t|:|
 |E|)+0#e000e06&|:+0#0000000&| |b+0#00e0003&|o@1|l| +0#0000000&@35
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|h+0#00e0e07&|a|s|_|k|e|y|(+0#e000e06&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|e|l|e|m|e|n|t|s|,|
 
|t+0#00e0e07&|h|i|s|.+0#0000000&|T|o|S|t|r|i|n|g|e|r|(+0#e000e06&|e+0#0000000&|l|e|m|e|n|t|)+0#e000e06&@1|
 +0#0000000&@8
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|E|l|e|m|e|n|t|s|<+0#e000e06&|E+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|)|:+0#0000000&|
 |l+0#00e0003&|i|s|t|<|E+0#0000000&|>+0#00e0003&| +0#0000000&@42
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|k+0#00e0e07&|e|y|s|(+0#e000e06&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|e|l|e|m|e|n|t|s|)+0#e000e06&|-+0#af5f00255&|>|m+0#00e0e07&|a|p|n|e|w|(+0#e000e06&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|M|a|p@1|e|r|)+0#e000e06&|
 +0#0000000&@15
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+@57|3|5|,|0|-|1| @7|1|8|%| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_03.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_03.dump
new file mode 100644
index 000000000..6ded4fe9d
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_03.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|e+0#00e0e07&|m|p|t|y|(+0#e000e06&|)|:+0#0000000&| 
|b+0#00e0003&|o@1|l| +0#0000000&@51
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|e+0#00e0e07&|m|p|t|y|(+0#e000e06&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|e|l|e|m|e|n|t|s|)+0#e000e06&|
 +0#0000000&@36
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3>d+0#af5f00255&|e|f| 
+0#0000000&|l+0#00e0e07&|e|n|(+0#e000e06&|)|:+0#0000000&| 
|n+0#00e0003&|u|m|b|e|r| +0#0000000&@51
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|l+0#00e0e07&|e|n|(+0#e000e06&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|e|l|e|m|e|n|t|s|)+0#e000e06&|
 +0#0000000&@38
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|s+0#00e0e07&|t|r|i|n|g|(+0#e000e06&|)|:+0#0000000&| 
|s+0#00e0003&|t|r|i|n|g| +0#0000000&@48
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|s+0#00e0e07&|t|r|i|n|g|(+0#e000e06&|k+0#00e0e07&|e|y|s|(+0#e000e06&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|e|l|e|m|e|n|t|s|)+0#e000e06&@1|
 +0#0000000&@29
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|#+0#0000e05&| |{|1|,| |2|,| 
|3|}| |⊇| |{|1|,| |2|}|.| +0#0000000&@47
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|S|u|p|e|r|s|e|t|(+0#e000e06&|t+0#0000000&|h|a|t|:| 
|S|e|t|)+0#e000e06&|:+0#0000000&| |b+0#00e0003&|o@1|l| +0#0000000&@39
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|(+0#e000e06&|l+0#00e0e07&|e|n|(+0#e000e06&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|e|l|e|m|e|n|t|s|)+0#e000e06&|
 +0#0000000&|>+0#af5f00255&|=| 
+0#0000000&|l+0#00e0e07&|e|n|(+0#e000e06&|t+0#0000000&|h|a|t|.+0#af5f00255&|_+0#0000000&|e|l|e|m|e|n|t|s|)+0#e000e06&@1|
 +0#0000000&|&+0#af5f00255&@1| 
+0#0000000&|t|h|a|t|.+0#af5f00255&|_+0#0000000&|e|l|e|m
+||+0#0000e05#a8a8a8255| |e+0#0000000#ffffff0|n|t|s| @68
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@11|-+0#af5f00255&|>|k+0#00e0e07&|e|y|s|(+0#e000e06&|)| 
+0#0000000&@52
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@11|-+0#af5f00255&|>|i+0#00e0e07&|n|d|e|x|o|f|(+0#e000e06&@2|s+0#0000000&|e|t|:|
 |S|e|t|)+0#e000e06&| +0#0000000&|=+0#af5f00255&|>| 
+0#0000000&|(+0#e000e06&|_+0#0000000&|:| |n+0#00e0003&|u|m|b|e|r|,+0#0000000&| 
|v|:| |s+0#00e0003&|t|r|i|n|g|)+0#e000e06&| +0#0000000&|=+0#af5f00255&|>| 
+0#0000000&|!+0#af5f00255&|s+0#0000000&|e|t|.+0#af5f00255&|_+0#0000000&|e|@+0#4040ff13&@2
+| +0#0000000&@56|5|2|,|5| @9|2|8|%| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_04.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_04.dump
new file mode 100644
index 000000000..7c473d897
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_04.dump
@@ -0,0 +1,20 @@
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@11|-+0#af5f00255&|>|i+0#00e0e07&|n|d|e|x|o|f|(+0#e000e06&@2|s+0#0000000&|e|t|:|
 |S|e|t|)+0#e000e06&| +0#0000000&|=+0#af5f00255&|>| 
+0#0000000&|(+0#e000e06&|_+0#0000000&|:| |n+0#00e0003&|u|m|b|e|r|,+0#0000000&| 
|v|:| |s+0#00e0003&|t|r|i|n|g|)+0#e000e06&| +0#0000000&|=+0#af5f00255&|>| 
+0#0000000&|!+0#af5f00255&|s+0#0000000&|e|t|.+0#af5f00255&|_+0#0000000&|e|l|e|m
+||+0#0000e05#a8a8a8255| |e+0#0000000#ffffff0|n|t|s| @68
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@15|-+0#af5f00255&|>|h+0#00e0e07&|a|s|_|k|e|y|(+0#e000e06&|v+0#0000000&|)+0#e000e06&@1|(|t+0#00e0e07&|h|i|s|)+0#e000e06&@1|
 +0#0000000&|<+0#af5f00255&| +0#0000000&|0+0#e000002&| +0#0000000&@32
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3>#+0#0000e05&| |{|1|,| |2|}| |⊆| 
|{|1|,| |2|,| |3|}|.| +0#0000000&@47
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|S|u|b|s|e|t|(+0#e000e06&|t+0#0000000&|h|a|t|:| 
|S|e|t|)+0#e000e06&|:+0#0000000&| |b+0#00e0003&|o@1|l| +0#0000000&@41
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|(+0#e000e06&|l+0#00e0e07&|e|n|(+0#e000e06&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|e|l|e|m|e|n|t|s|)+0#e000e06&|
 +0#0000000&|<+0#af5f00255&|=| 
+0#0000000&|l+0#00e0e07&|e|n|(+0#e000e06&|t+0#0000000&|h|a|t|.+0#af5f00255&|_+0#0000000&|e|l|e|m|e|n|t|s|)+0#e000e06&@1|
 +0#0000000&|&+0#af5f00255&@1| 
+0#0000000&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|e|l|e|m
+||+0#0000e05#a8a8a8255| |e+0#0000000#ffffff0|n|t|s| @68
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@11|-+0#af5f00255&|>|k+0#00e0e07&|e|y|s|(+0#e000e06&|)| 
+0#0000000&@52
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@11|-+0#af5f00255&|>|i+0#00e0e07&|n|d|e|x|o|f|(+0#e000e06&@2|s+0#0000000&|e|t|:|
 |S|e|t|)+0#e000e06&| +0#0000000&|=+0#af5f00255&|>| 
+0#0000000&|(+0#e000e06&|_+0#0000000&|:| |n+0#00e0003&|u|m|b|e|r|,+0#0000000&| 
|v|:| |s+0#00e0003&|t|r|i|n|g|)+0#e000e06&| +0#0000000&|=+0#af5f00255&|>| 
+0#0000000&|!+0#af5f00255&|s+0#0000000&|e|t|.+0#af5f00255&|_+0#0000000&|e|l|e|m
+||+0#0000e05#a8a8a8255| |e+0#0000000#ffffff0|n|t|s| @68
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@15|-+0#af5f00255&|>|h+0#00e0e07&|a|s|_|k|e|y|(+0#e000e06&|v+0#0000000&|)+0#e000e06&@1|(|t+0#0000000&|h|a|t|)+0#e000e06&@1|
 +0#0000000&|<+0#af5f00255&| +0#0000000&|0+0#e000002&| +0#0000000&@32
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|#+0#0000e05&| |{|1|,| |2|,| 
|3|}| |∪| |{|2|,| |3|,| |4|}| |=| |{|1|,| |2|,| |3|,| |4|}|.| +0#0000000&@29
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|U|n|i|o|n|(+0#e000e06&|t+0#0000000&|h|a|t|:| 
|S|e|t|)+0#e000e06&|:+0#0000000&| |S|e|t| @43
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|t+0#00e0e07&|h|i|s|.+0#0000000&|_|F|r|o|m|L|i|s|t|<+0#e000e06&|a+0#00e0003&|n|y|>+0#e000e06&|(|{|}|
 +0#0000000&@35
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@11|-+0#af5f00255&|>|e+0#00e0e07&|x|t|e|n|d|(+0#e000e06&|t+0#0000000&|h|a|t|.+0#af5f00255&|_+0#0000000&|e|l|e|m|e|n|t|s|)+0#e000e06&|
 +0#0000000&@36
+@57|6|8|,|5| @9|3|9|%| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_05.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_05.dump
new file mode 100644
index 000000000..cd34d7443
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_05.dump
@@ -0,0 +1,20 @@
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@11|-+0#af5f00255&|>|e+0#00e0e07&|x|t|e|n|d|(+0#e000e06&|t+0#0000000&|h|a|t|.+0#af5f00255&|_+0#0000000&|e|l|e|m|e|n|t|s|)+0#e000e06&|
 +0#0000000&@36
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@11|-+0#af5f00255&|>|e+0#00e0e07&|x|t|e|n|d|(+0#e000e06&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|e|l|e|m|e|n|t|s|)+0#e000e06&|
 +0#0000000&@36
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@11|-+0#af5f00255&|>|k+0#00e0e07&|e|y|s|(+0#e000e06&|)| 
+0#0000000&@52
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@11|-+0#af5f00255&|>|m+0#00e0e07&|a|p|(+0#e000e06&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|M|a|p@1|e|r|)+0#e000e06&@1|
 +0#0000000&@40
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1> +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|#+0#0000e05&| |{|1|,| |2|,| 
|3|}| |∩| |{|2|,| |3|,| |4|}| |=| |{|2|,| |3|}|.| +0#0000000&@35
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|I|n|t|e|r|s|e|c|t|i|o|n|(+0#e000e06&|t+0#0000000&|h|a|t|:| 
|S|e|t|)+0#e000e06&|:+0#0000000&| |S|e|t| @36
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|t+0#00e0e07&|h|i|s|.+0#0000000&|_|F|r|o|m|L|i|s|t|<+0#e000e06&|a+0#00e0003&|n|y|>+0#e000e06&|(|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|e|l|e|m|e|n|t|s|
 @23
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@11|-+0#af5f00255&|>|k+0#00e0e07&|e|y|s|(+0#e000e06&|)| 
+0#0000000&@52
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@11|-+0#af5f00255&|>|f+0#00e0e07&|i|l|t|e|r|(+0#e000e06&@2|s+0#0000000&|e|t|:|
 |S|e|t|)+0#e000e06&| +0#0000000&|=+0#af5f00255&|>| 
+0#0000000&|(+0#e000e06&|_+0#0000000&|:| |n+0#00e0003&|u|m|b|e|r|,+0#0000000&| 
|v|:| |s+0#00e0003&|t|r|i|n|g|)+0#e000e06&| +0#0000000&|=+0#af5f00255&|>| 
+0#0000000&|s|e|t|.+0#af5f00255&|_+0#0000000&|e|l|e|m|e|n
+||+0#0000e05#a8a8a8255| |t+0#0000000#ffffff0|s| @70
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@15|-+0#af5f00255&|>|h+0#00e0e07&|a|s|_|k|e|y|(+0#e000e06&|v+0#0000000&|)+0#e000e06&@1|(|t+0#0000000&|h|a|t|)+0#e000e06&@1|
 +0#0000000&@36
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@11|-+0#af5f00255&|>|m+0#00e0e07&|a|p|(+0#e000e06&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|M|a|p@1|e|r|)+0#e000e06&@1|
 +0#0000000&@40
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|#+0#0000e05&| |{|1|,| |2|,| 
|3|}| |\| |{|2|,| |3|,| |4|}| |=| |{|1|}|.| +0#0000000&@38
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|#+0#0000e05&| |{|2|,| |3|,| 
|4|}| |\| |{|1|,| |2|,| |3|}| |=| |{|4|}|.| +0#0000000&@38
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|S|e|t|D|i|f@1|e|r|e|n|c|e|(+0#e000e06&|t+0#0000000&|h|a|t|:| 
|S|e|t|)+0#e000e06&|:+0#0000000&| |S|e|t| @35
+@57|8|4|,|0|-|1| @7|4|9|%| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_06.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_06.dump
new file mode 100644
index 000000000..e647ceca4
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_06.dump
@@ -0,0 +1,20 @@
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|S|e|t|D|i|f@1|e|r|e|n|c|e|(+0#e000e06&|t+0#0000000&|h|a|t|:| 
|S|e|t|)+0#e000e06&|:+0#0000000&| |S|e|t| @35
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|t+0#00e0e07&|h|i|s|.+0#0000000&|_|F|r|o|m|L|i|s|t|<+0#e000e06&|a+0#00e0003&|n|y|>+0#e000e06&|(|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|e|l|e|m|e|n|t|s|
 @23
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@11|-+0#af5f00255&|>|k+0#00e0e07&|e|y|s|(+0#e000e06&|)| 
+0#0000000&@52
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@11|-+0#af5f00255&|>|f+0#00e0e07&|i|l|t|e|r|(+0#e000e06&@2|s+0#0000000&|e|t|:|
 |S|e|t|)+0#e000e06&| +0#0000000&|=+0#af5f00255&|>| 
+0#0000000&|(+0#e000e06&|_+0#0000000&|:| |n+0#00e0003&|u|m|b|e|r|,+0#0000000&| 
|v|:| |s+0#00e0003&|t|r|i|n|g|)+0#e000e06&| +0#0000000&|=+0#af5f00255&|>| 
+0#0000000&|!+0#af5f00255&|s+0#0000000&|e|t|.+0#af5f00255&|_+0#0000000&|e|l|e|m|e
+||+0#0000e05#a8a8a8255| |n+0#0000000#ffffff0|t|s| @69
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@15>-+0#af5f00255&|>|h+0#00e0e07&|a|s|_|k|e|y|(+0#e000e06&|v+0#0000000&|)+0#e000e06&@1|(|t+0#0000000&|h|a|t|)+0#e000e06&@1|
 +0#0000000&@36
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@11|-+0#af5f00255&|>|m+0#00e0e07&|a|p|(+0#e000e06&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|M|a|p@1|e|r|)+0#e000e06&@1|
 +0#0000000&@40
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|#+0#0000e05&| |{|1|,| |2|,| 
|3|}| |△| |{|2|,| |3|,| |4|}| |=| |{|1|,| |4|}|.| +0#0000000&@35
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|S|y|m@1|e|t|r|i|c|D|i|f@1|e|r|e|n|c|e|(+0#e000e06&|t+0#0000000&|h|a|t|:|
 |S|e|t|)+0#e000e06&|:+0#0000000&| |S|e|t| @29
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|t+0#00e0e07&|h|i|s|.+0#0000000&|U|n|i|o|n|(+0#e000e06&|t+0#0000000&|h|a|t|)+0#e000e06&|.+0#af5f00255&|S+0#0000000&|e|t|D|i|f@1|e|r|e|n|c|e|(+0#e000e06&|t+0#00e0e07&|h|i|s|.+0#0000000&|I|n|t|e|r|s|e|c|t|i|o|n|(+0#e000e06&|t+0#0000000&|h|a|t|)+0#e000e06&@1|
 +0#0000000&@2
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|n|d|c|l|a|s@1| +0#0000000&@64
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0@59| +0#0000000&@12
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| 
+0#0000000&|T|o|S|t|r|:| |f+0#00e0003&|u|n|c|(|n|u|m|b|e|r|)|:+0#0000000&| 
|s+0#00e0003&|t|r|i|n|g| +0#0000000&|=+0#af5f00255&| 
+0#0000000&|(+0#e000e06&|s+0#0000000&|:| |n+0#00e0003&|u|m|b|e|r|)+0#e000e06&| 
+0#0000000&|=+0#af5f00255&|>| 
+0#0000000&|s+0#00e0e07&|t|r|i|n|g|(+0#e000e06&|s+0#0000000&|)+0#e000e06&| 
+0#0000000&@12
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| 
+0#0000000&|F|r|o|m|S|t|r|:| |f+0#00e0003&|u|n|c|(|s|t|r|i|n|g|)|:+0#0000000&| 
|n+0#00e0003&|u|m|b|e|r| +0#0000000&|=+0#af5f00255&| 
+0#0000000&|(+0#e000e06&|s+0#0000000&|:| |s+0#00e0003&|t|r|i|n|g|)+0#e000e06&| 
+0#0000000&|=+0#af5f00255&|>| 
+0#0000000&|s+0#00e0e07&|t|r|2|n|r|(+0#e000e06&|s+0#0000000&|)+0#e000e06&| 
+0#0000000&@10
+@57|1|0@1|,|3|-|1|7| @5|5|9|%| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_07.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_07.dump
new file mode 100644
index 000000000..8ce2d2bec
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_07.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| 
+0#0000000&|F|r|o|m|S|t|r|:| |f+0#00e0003&|u|n|c|(|s|t|r|i|n|g|)|:+0#0000000&| 
|n+0#00e0003&|u|m|b|e|r| +0#0000000&|=+0#af5f00255&| 
+0#0000000&|(+0#e000e06&|s+0#0000000&|:| |s+0#00e0003&|t|r|i|n|g|)+0#e000e06&| 
+0#0000000&|=+0#af5f00255&|>| 
+0#0000000&|s+0#00e0e07&|t|r|2|n|r|(+0#e000e06&|s+0#0000000&|)+0#e000e06&| 
+0#0000000&@10
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|S|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|1+0#e000002&|,+0#0000000&|
 |2+0#e000002&|,+0#0000000&| |3+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|T|o|S|t|r|,| |F|r|o|m|S|t|r|)+0#e000e06&| +0#0000000&@17
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3|.+0#af5f00255&|S+0#0000000&|u|b|s|e|t|(+0#e000e06&|S+0#0000000&|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|1+0#e000002&|,+0#0000000&|
 |2+0#e000002&|]+0#e000e06&|,+0#0000000&| |T|o|S|t|r|,| 
|F|r|o|m|S|t|r|)+0#e000e06&@1| +0#0000000&@12
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|S|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|1+0#e000002&|,+0#0000000&|
 |2+0#e000002&|]+0#e000e06&|,+0#0000000&| |T|o|S|t|r|,| 
|F|r|o|m|S|t|r|)+0#e000e06&| +0#0000000&@20
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3>.+0#af5f00255&|S+0#0000000&|u|b|s|e|t|(+0#e000e06&|S+0#0000000&|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|1+0#e000002&|,+0#0000000&|
 |2+0#e000002&|,+0#0000000&| |3+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|T|o|S|t|r|,| |F|r|o|m|S|t|r|)+0#e000e06&@1| +0#0000000&@9
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|S|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|1+0#e000002&|,+0#0000000&|
 |2+0#e000002&|]+0#e000e06&|,+0#0000000&| |T|o|S|t|r|,| 
|F|r|o|m|S|t|r|)+0#e000e06&| +0#0000000&@20
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3|.+0#af5f00255&|S+0#0000000&|u|p|e|r|s|e|t|(+0#e000e06&|S+0#0000000&|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|1+0#e000002&|,+0#0000000&|
 |2+0#e000002&|,+0#0000000&| |3+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|T|o|S|t|r|,| |F|r|o|m|S|t|r|)+0#e000e06&@1| +0#0000000&@7
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|S|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|1+0#e000002&|,+0#0000000&|
 |2+0#e000002&|,+0#0000000&| |3+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|T|o|S|t|r|,| |F|r|o|m|S|t|r|)+0#e000e06&| +0#0000000&@17
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3|.+0#af5f00255&|S+0#0000000&|u|p|e|r|s|e|t|(+0#e000e06&|S+0#0000000&|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|1+0#e000002&|,+0#0000000&|
 |2+0#e000002&|]+0#e000e06&|,+0#0000000&| |T|o|S|t|r|,| 
|F|r|o|m|S|t|r|)+0#e000e06&@1| +0#0000000&@10
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|S|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|1+0#e000002&|,+0#0000000&|
 |2+0#e000002&|,+0#0000000&| |3+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|T|o|S|t|r|,| |F|r|o|m|S|t|r|)+0#e000e06&| +0#0000000&@17
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3|.+0#af5f00255&|U+0#0000000&|n|i|o|n|(+0#e000e06&|S+0#0000000&|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|2+0#e000002&|,+0#0000000&|
 |3+0#e000002&|,+0#0000000&| |4+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|T|o|S|t|r|,| |F|r|o|m|S|t|r|)+0#e000e06&@1| +0#0000000&@10
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3|.+0#af5f00255&|E+0#0000000&|l|e|m|e|n|t|s|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|)|
 +0#0000000&@49
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|S|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|2+0#e000002&|,+0#0000000&|
 |3+0#e000002&|,+0#0000000&| |4+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|T|o|S|t|r|,| |F|r|o|m|S|t|r|)+0#e000e06&| +0#0000000&@17
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3|.+0#af5f00255&|U+0#0000000&|n|i|o|n|(+0#e000e06&|S+0#0000000&|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|1+0#e000002&|,+0#0000000&|
 |2+0#e000002&|,+0#0000000&| |3+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|T|o|S|t|r|,| |F|r|o|m|S|t|r|)+0#e000e06&@1| +0#0000000&@10
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3|.+0#af5f00255&|E+0#0000000&|l|e|m|e|n|t|s|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|)|
 +0#0000000&@49
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|S|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|1+0#e000002&|,+0#0000000&|
 |2+0#e000002&|,+0#0000000&| |3+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|T|o|S|t|r|,| |F|r|o|m|S|t|r|)+0#e000e06&| +0#0000000&@17
+@57|1@1|8|,|5| @8|7|0|%| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_08.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_08.dump
new file mode 100644
index 000000000..9e436a374
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_08.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|S|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|1+0#e000002&|,+0#0000000&|
 |2+0#e000002&|,+0#0000000&| |3+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|T|o|S|t|r|,| |F|r|o|m|S|t|r|)+0#e000e06&| +0#0000000&@17
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3|.+0#af5f00255&|I+0#0000000&|n|t|e|r|s|e|c|t|i|o|n|(+0#e000e06&|S+0#0000000&|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|2+0#e000002&|,+0#0000000&|
 |3+0#e000002&|,+0#0000000&| |4+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|T|o|S|t|r|,| |F|r|o|m|S|t|r|)+0#e000e06&@1| +0#0000000&@3
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3|.+0#af5f00255&|E+0#0000000&|l|e|m|e|n|t|s|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|)|
 +0#0000000&@49
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|S|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|2+0#e000002&|,+0#0000000&|
 |3+0#e000002&|,+0#0000000&| |4+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|T|o|S|t|r|,| |F|r|o|m|S|t|r|)+0#e000e06&| +0#0000000&@17
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3|.+0#af5f00255&|I+0#0000000&|n|t|e|r|s|e|c|t|i|o|n|(+0#e000e06&|S+0#0000000&|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|1+0#e000002&|,+0#0000000&|
 |2+0#e000002&|,+0#0000000&| |3+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|T|o|S|t|r|,| |F|r|o|m|S|t|r|)+0#e000e06&@1| +0#0000000&@3
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3>.+0#af5f00255&|E+0#0000000&|l|e|m|e|n|t|s|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|)|
 +0#0000000&@49
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|S|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|1+0#e000002&|,+0#0000000&|
 |2+0#e000002&|,+0#0000000&| |3+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|T|o|S|t|r|,| |F|r|o|m|S|t|r|)+0#e000e06&| +0#0000000&@17
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3|.+0#af5f00255&|S+0#0000000&|e|t|D|i|f@1|e|r|e|n|c|e|(+0#e000e06&|S+0#0000000&|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|2+0#e000002&|,+0#0000000&|
 |3+0#e000002&|,+0#0000000&| |4+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|T|o|S|t|r|,| |F|r|o|m|S|t|r|)+0#e000e06&@1| +0#0000000&@2
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3|.+0#af5f00255&|E+0#0000000&|l|e|m|e|n|t|s|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|)|
 +0#0000000&@49
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|S|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|2+0#e000002&|,+0#0000000&|
 |3+0#e000002&|,+0#0000000&| |4+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|T|o|S|t|r|,| |F|r|o|m|S|t|r|)+0#e000e06&| +0#0000000&@17
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3|.+0#af5f00255&|S+0#0000000&|e|t|D|i|f@1|e|r|e|n|c|e|(+0#e000e06&|S+0#0000000&|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|1+0#e000002&|,+0#0000000&|
 |2+0#e000002&|,+0#0000000&| |3+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|T|o|S|t|r|,| |F|r|o|m|S|t|r|)+0#e000e06&@1| +0#0000000&@2
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3|.+0#af5f00255&|E+0#0000000&|l|e|m|e|n|t|s|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|)|
 +0#0000000&@49
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|S|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|1+0#e000002&|,+0#0000000&|
 |2+0#e000002&|,+0#0000000&| |3+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|T|o|S|t|r|,| |F|r|o|m|S|t|r|)+0#e000e06&| +0#0000000&@17
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3|.+0#af5f00255&|S+0#0000000&|y|m@1|e|t|r|i|c|D|i|f@1|e|r|e|n|c|e|(+0#e000e06&|S+0#0000000&|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|2+0#e000002&|,+0#0000000&|
 |3+0#e000002&|,+0#0000000&| |4+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|T|o|S|t|r|,| |F|r|o|m|S|t
+| +0#0000e05#a8a8a8255@1|r+0#0000000#ffffff0|)+0#e000e06&@1| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3|.+0#af5f00255&|E+0#0000000&|l|e|m|e|n|t|s|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|)|
 +0#0000000&@49
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|S|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|2+0#e000002&|,+0#0000000&|
 |3+0#e000002&|,+0#0000000&| |4+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|T|o|S|t|r|,| |F|r|o|m|S|t|r|)+0#e000e06&| +0#0000000&@17
+@57|1|3|6|,|5| @8|8|1|%| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_09.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_09.dump
new file mode 100644
index 000000000..eadf090b1
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_09.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|S|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|2+0#e000002&|,+0#0000000&|
 |3+0#e000002&|,+0#0000000&| |4+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|T|o|S|t|r|,| |F|r|o|m|S|t|r|)+0#e000e06&| +0#0000000&@17
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3|.+0#af5f00255&|S+0#0000000&|y|m@1|e|t|r|i|c|D|i|f@1|e|r|e|n|c|e|(+0#e000e06&|S+0#0000000&|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[|1+0#e000002&|,+0#0000000&|
 |2+0#e000002&|,+0#0000000&| |3+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|T|o|S|t|r|,| |F|r|o|m|S|t
+| +0#0000e05#a8a8a8255@1|r+0#0000000#ffffff0|)+0#e000e06&@1| +0#0000000&@69
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3|.+0#af5f00255&|E+0#0000000&|l|e|m|e|n|t|s|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|)|
 +0#0000000&@49
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1>#+0&#ffffff0@59| +0#0000000&@12
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| +0#0000000&|n|o|n|e|:| 
|S|e|t| |=+0#af5f00255&| 
+0#0000000&|S|e|t|.|n+0#00e0e07&|e|w|<+0#e000e06&|a+0#00e0003&|n|y|>+0#e000e06&|(|)|
 +0#0000000&@40
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|n|o|n|e|.|l+0#00e0e07&|e|n|(+0#e000e06&|)| +0#0000000&@57
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|n|o|n|e|.|e+0#00e0e07&|m|p|t|y|(+0#e000e06&|)| +0#0000000&@55
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|n|o|n|e|.|s+0#00e0e07&|t|r|i|n|g|(+0#e000e06&|)| +0#0000000&@54
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|s+0#00e0e07&|t|r|i|n|g|(+0#e000e06&|n+0#0000000&|o|n|e|.|E|l|e|m|e|n|t|s|<+0#e000e06&|a+0#00e0003&|n|y|>+0#e000e06&|(|)@1|
 +0#0000000&@39
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| +0#0000000&|s|e|t|s|:| 
|S|e|t| |=+0#af5f00255&| 
+0#0000000&|S|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|S+0#0000000&|e|t|>+0#e000e06&|(|
 +0#0000000&@33
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3|[+0#e000e06&|S+0#0000000&|e|t|.|n+0#00e0e07&|e|w|<+0#e000e06&|a+0#00e0003&|n|y|>+0#e000e06&|(|)|,+0#0000000&|
 
|S|e|t|.|n+0#00e0e07&|e|w|<+0#e000e06&|a+0#00e0003&|n|y|>+0#e000e06&|(|)|,+0#0000000&|
 
|S|e|t|.|n+0#00e0e07&|e|w|<+0#e000e06&|a+0#00e0003&|n|y|>+0#e000e06&|(|)|,+0#0000000&|
 
|S|e|t|.|n+0#00e0e07&|e|w|<+0#e000e06&|a+0#00e0003&|n|y|>+0#e000e06&|(|)|]|,+0#0000000&|
 @3
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|(+0#e000e06&|o+0#0000000&|:| 
|S|e|t|)+0#e000e06&|:+0#0000000&| |s+0#00e0003&|t|r|i|n|g| 
+0#0000000&|=+0#af5f00255&|>| 
+0#0000000&|s+0#00e0e07&|t|r|i|n|g|(+0#e000e06&|o+0#0000000&|)+0#e000e06&|,+0#0000000&|
 @38
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|(+0#e000e06&|_+0#0000000&|:| 
|s+0#00e0003&|t|r|i|n|g|)+0#e000e06&|:+0#0000000&| |S|e|t| |=+0#af5f00255&|>| 
+0#0000000&|S|e|t|.|n+0#00e0e07&|e|w|<+0#e000e06&|a+0#00e0003&|n|y|>+0#e000e06&|(|)@1|
 +0#0000000&@33
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|s|e|t|s|.|l+0#00e0e07&|e|n|(+0#e000e06&|)| +0#0000000&@57
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|s|e|t|s|.|e+0#00e0e07&|m|p|t|y|(+0#e000e06&|)| +0#0000000&@55
+@57|1|5|2|,|1| @8|9|2|%| 
diff --git 
a/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_10.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_10.dump
new file mode 100644
index 000000000..b5c825be2
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_function_example_set_10.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|s|e|t|s|.|e+0#00e0e07&|m|p|t|y|(+0#e000e06&|)| +0#0000000&@55
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|s|e|t|s|.|s+0#00e0e07&|t|r|i|n|g|(+0#e000e06&|)| +0#0000000&@54
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|s+0#00e0e07&|t|r|i|n|g|(+0#e000e06&|s+0#0000000&|e|t|s|.|E|l|e|m|e|n|t|s|<+0#e000e06&|S+0#0000000&|e|t|>+0#e000e06&|(|)@1|
 +0#0000000&@39
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|o|n|s|t| 
+0#0000000&|l|i|s|t|s|:| |S|e|t| |=+0#af5f00255&| 
+0#0000000&|S|e|t|.|n+0#00e0e07&|e|w|F|r|o|m|L|i|s|t|<+0#e000e06&|l+0#00e0003&|i|s|t|<|a|n|y|>|>+0#e000e06&|(|
 +0#0000000&@26
+| +0#0000e05#a8a8a8255@1| 
+0#0000000#ffffff0@3>[+0#e000e06&@4|]@4|,+0#0000000&| @57
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|(+0#e000e06&|o+0#0000000&|:| 
|l+0#00e0003&|i|s|t|<|a|n|y|>|)+0#e000e06&|:+0#0000000&| 
|s+0#00e0003&|t|r|i|n|g| +0#0000000&|=+0#af5f00255&|>| 
+0#0000000&|s+0#00e0e07&|t|r|i|n|g|(+0#e000e06&|o+0#0000000&|)+0#e000e06&|,+0#0000000&|
 @32
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|(+0#e000e06&|s+0#0000000&|:| 
|s+0#00e0003&|t|r|i|n|g|)+0#e000e06&|:+0#0000000&| 
|l+0#00e0003&|i|s|t|<|a|n|y|>| +0#0000000&|=+0#af5f00255&|>| 
+0#0000000&|e+0#00e0e07&|v|a|l|(+0#e000e06&|s+0#0000000&|)+0#e000e06&@1| 
+0#0000000&@34
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|l|i|s|t|s|.|l+0#00e0e07&|e|n|(+0#e000e06&|)| +0#0000000&@56
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|l|i|s|t|s|.|e+0#00e0e07&|m|p|t|y|(+0#e000e06&|)| +0#0000000&@54
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|l|i|s|t|s|.|s+0#00e0e07&|t|r|i|n|g|(+0#e000e06&|)| +0#0000000&@53
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|s+0#00e0e07&|t|r|i|n|g|(+0#e000e06&|l+0#0000000&|i|s|t|s|.|E|l|e|m|e|n|t|s|<+0#e000e06&|l+0#00e0003&|i|s|t|<|a|n|y|>|>+0#e000e06&|(|)@1|
 +0#0000000&@32
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|1|7|0|,|5| @8|B|o|t| 
diff --git a/runtime/syntax/testdir/dumps/vim9_generic_functions_00.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_functions_00.dump
new file mode 100644
index 000000000..54a81b44f
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_functions_00.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1>v+0#af5f00255#ffffff0|i|m|9|s|c|r|i|p|t| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|i|m|9| |g|e|n|e|r|i|c| 
|f|u|n|c|t|i|o|n|s| +0#0000000&@48
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| 
|h|i|g|h|l|i|g|h|t| |l|i|n|k| |v|i|m|9|D|e|f|T|y|p|e|P|a|r|a|m| |T|o|d|o| 
+0#0000000&@19
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |l|e|t| 
|g|:|v|i|m|s|y|n|_|f|o|l|d|i|n|g| |=| |"+0#e000002&|f|"| +0#0000000&@29
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |V|I|M|_|T|E|S|T|_|S|E|T|U|P| |s|e|t|l| 
|f|d|c|=|2| |f|d|l|=|9@1| |f|d|m|=|s|y|n|t|a|x| +0#0000000&@27
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |:|h|e|l|p| 
|g|e|n|e|r|i|c|-|f|u|n|c|t|i|o|n|s| +0#0000000&@47
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |d+0#af5f00255#ffffff0|e|f| 
+0#0000000&|M|y|F|u|n|c|<+0#e000e06&|T+0#0000001#ffff4012|,+0#0000000#ffffff0| 
|A+0#0000001#ffff4012|,+0#0000000#ffffff0| 
|B+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|p+0#0000000&|a|r|a|m|1|:| 
|T|)+0#e000e06&|:+0#0000000&| |T| @39
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|v+0#af5f00255&|a|r| 
+0#0000000&|f|:| |A| @60
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|v+0#af5f00255&|a|r| 
+0#0000000&|x| |=+0#af5f00255&| +0#0000000&|p|a|r|a|m|1| @54
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|x| @60
+||+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|n|d@1|e|f| +0#0000000&@66
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| 
+0#0000e05#a8a8a8255@1|M+0#0000000#ffffff0|y|F|u|n|c|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|,+0#0000000&|
 |s+0#00e0003&|t|r|i|n|g|,+0#0000000&| 
|l+0#00e0003&|i|s|t|<|n|u|m|b|e|r|>|>+0#e000e06&|(|)| +0#0000000&@34
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |d+0#af5f00255#ffffff0|e|f| 
+0#0000000&|F|l|a|t@1|e|n|<+0#e000e06&|T+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|x+0#0000000&|:|
 
|l+0#00e0003&|i|s|t|<|l|i|s|t|<|T+0#0000000&|>+0#00e0003&@1|)+0#e000e06&|:+0#0000000&|
 |l+0#00e0003&|i|s|t|<|T+0#0000000&|>+0#00e0003&| +0#0000000&@31
+@57|1|,|1| @10|T|o|p| 
diff --git a/runtime/syntax/testdir/dumps/vim9_generic_functions_01.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_functions_01.dump
new file mode 100644
index 000000000..c45db4e3e
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_functions_01.dump
@@ -0,0 +1,20 @@
+||+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|n|d@1|e|f| +0#0000000&@66
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| 
+0#0000e05#a8a8a8255@1|M+0#0000000#ffffff0|y|F|u|n|c|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|,+0#0000000&|
 |s+0#00e0003&|t|r|i|n|g|,+0#0000000&| 
|l+0#00e0003&|i|s|t|<|n|u|m|b|e|r|>|>+0#e000e06&|(|)| +0#0000000&@34
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| >d+0#af5f00255#ffffff0|e|f| 
+0#0000000&|F|l|a|t@1|e|n|<+0#e000e06&|T+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|x+0#0000000&|:|
 
|l+0#00e0003&|i|s|t|<|l|i|s|t|<|T+0#0000000&|>+0#00e0003&@1|)+0#e000e06&|:+0#0000000&|
 |l+0#00e0003&|i|s|t|<|T+0#0000000&|>+0#00e0003&| +0#0000000&@31
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|v+0#af5f00255&|a|r| 
+0#0000000&|r|e|s|u|l|t|:| |l+0#00e0003&|i|s|t|<|T+0#0000000&|>+0#00e0003&| 
+0#0000000&|=+0#af5f00255&| +0#0000000&|[+0#e000e06&|]| +0#0000000&@44
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|f+0#af5f00255&|o|r| 
+0#0000000&|i|n@1|e|r| |i+0#af5f00255&|n| +0#0000000&|x| @54
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@7|r|e|s|u|l|t| |++0#af5f00255&|=| 
+0#0000000&|i|n@1|e|r| @49
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d|f|o|r| 
+0#0000000&@62
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|r|e|s|u|l|t| @55
+||+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|n|d@1|e|f| +0#0000000&@66
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|F|l|a|t@1|e|n|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|[@1|1+0#e000002&|,+0#0000000&|
 |2+0#e000002&|]+0#e000e06&|,+0#0000000&| 
|[+0#e000e06&|3+0#e000002&|]+0#e000e06&@1|)| +0#0000000&@37
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|l|a|s@1| +0#0000000&|A| @65
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|d+0#af5f00255&|e|f| 
+0#0000000&|F|o@1|<+0#e000e06&|X+0#0000001#ffff4012|,+0#0000000#ffffff0| 
|Y+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|)| +0#0000000&@53
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+@57|1|9|,|1| @9|1|6|%| 
diff --git a/runtime/syntax/testdir/dumps/vim9_generic_functions_02.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_functions_02.dump
new file mode 100644
index 000000000..187c8f35e
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_functions_02.dump
@@ -0,0 +1,20 @@
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@62
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|n|d|c|l|a|s@1| +0#0000000&@64
+| +0#0000e05#a8a8a8255@1|v+0#af5f00255#ffffff0|a|r| +0#0000000&|a| 
|=+0#af5f00255&| +0#0000000&|A|.|n+0#00e0e07&|e|w|(+0#e000e06&|)| +0#0000000&@57
+| 
+0#0000e05#a8a8a8255@1|a+0#0000000#ffffff0|.|F|o@1|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|,+0#0000000&|
 |s+0#00e0003&|t|r|i|n|g|>+0#e000e06&|(|)| +0#0000000&@49
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1> +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |d+0#af5f00255#ffffff0|e|f| 
+0#0000000&|M|a|k|e|E|c|h|o|<+0#e000e06&|T+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|)|:+0#0000000&|
 |f+0#00e0003&|u|n|c|(|T+0#0000000&|)+0#00e0003&|:+0#0000000&| |T| @43
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|(+0#e000e06&|x+0#0000000&|:| |T|)+0#e000e06&|:+0#0000000&| |T| 
|=+0#af5f00255&|>| +0#0000000&|x| @47
+||+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|n|d@1|e|f| +0#0000000&@66
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|v+0#af5f00255#ffffff0|a|r| 
+0#0000000&|E|c|h|o|N|u|m|b|e|r| |=+0#af5f00255&| 
+0#0000000&|M|a|k|e|E|c|h|o|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|)|
 +0#0000000&@37
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|E|c|h|o|N|u|m|b|e|r|(+0#e000e06&|1+0#e000002&|2|3|)+0#e000e06&| 
+0#0000000&@52
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|v+0#af5f00255#ffffff0|a|r| 
+0#0000000&|E|c|h|o|S|t|r|i|n|g| |=+0#af5f00255&| 
+0#0000000&|M|a|k|e|E|c|h|o|<+0#e000e06&|s+0#00e0003&|t|r|i|n|g|>+0#e000e06&|(|)|
 +0#0000000&@37
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|E|c|h|o|S|t|r|i|n|g|(+0#e000e06&|'+0#e000002&|a|b|c|'|)+0#e000e06&| 
+0#0000000&@50
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| 
+0#0000000&|F+0#0000001#ffff4012|I|X|M|E|:+0#e000e06#ffffff0| 
+0#0000e05&|a|d@1| |s|p|e|c|i|f|i|c| |c|o|m@1|a|n|d| |h|a|n|d|l|i|n|g| 
+0#0000000&@34
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |d|e|f|c|o|m|p|i|l|e| 
|M|y|F|u|n|c|<|n|u|m|b|e|r|,| |l|i|s|t|<|n|u|m|b|e|r|>|,| 
|d|i|c|t|<|s|t|r|i|n|g|>@1| +0#0000000&@17
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+@57|3|7|,|0|-|1| @7|3|9|%| 
diff --git a/runtime/syntax/testdir/dumps/vim9_generic_functions_03.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_functions_03.dump
new file mode 100644
index 000000000..77bdec7d3
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_functions_03.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |d|i|s|a|s@1|e|m|b|l|e| 
|M|y|F|u|n|c|<|s|t|r|i|n|g|,| |d|i|c|t|<|s|t|r|i|n|g|>@1| +0#0000000&@30
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| |d|i|s|a|s@1|e|m|b|l|e| 
|M|y|F|u|n|c|<|n|u|m|b|e|r|,| |l|i|s|t|<|b|l|o|b|>@1| +0#0000000&@32
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1>#+0&#ffffff0| |f|u|n|c|r|e|f|s| +0#0000000&@62
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|v+0#af5f00255#ffffff0|a|r| +0#0000000&|F|o@1| 
|=+0#af5f00255&| 
+0#0000000&|B|a|r|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&| 
+0#0000000&@51
+| 
+0#0000e05#a8a8a8255@1|E+0#0000000#ffffff0|x|e|c|u|t|e|(+0#e000e06&|B+0#0000000&|a|r|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|)|
 +0#0000000&@52
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|v+0#af5f00255#ffffff0|a|r| +0#0000000&|F|o@1| 
|=+0#af5f00255&| 
+0#0000000&|b|a|r|.+0#af5f00255&|B+0#0000000&|a|z|<+0#e000e06&|s+0#00e0003&|t|r|i|n|g|>+0#e000e06&|
 +0#0000000&@47
+| 
+0#0000e05#a8a8a8255@1|E+0#0000000#ffffff0|x|e|c|u|t|e|(+0#e000e06&|b+0#0000000&|a|r|.+0#af5f00255&|B+0#0000000&|a|z|<+0#e000e06&|s+0#00e0003&|t|r|i|n|g|>+0#e000e06&|)|
 +0#0000000&@48
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|c+0#af5f00255#ffffff0|l|a|s@1| +0#0000000&|F|o@1| @63
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|d+0#af5f00255&|e|f| 
+0#0000000&|_|M|e|t|h|o|d|A|<+0#e000e06&|T+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|a+0#0000000&|r|g|:|
 |T|)+0#e000e06&| +0#0000000&@47
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|e+0#af5f00255&|c|h|o| 
+0#0000000&|a|r|g| @60
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@64
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|d+0#af5f00255&|e|f| 
+0#0000000&|M|e|t|h|o|d|B|(+0#e000e06&|)| +0#0000000&@57
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|v+0#af5f00255&|a|r| 
+0#0000000&|F| |=+0#af5f00255&| 
+0#0000000&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|M|e|t|h|o|d|A|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|
 +0#0000000&@39
+@57|5@1|,|1| @9|6|2|%| 
diff --git a/runtime/syntax/testdir/dumps/vim9_generic_functions_04.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_functions_04.dump
new file mode 100644
index 000000000..e58e3bf35
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_functions_04.dump
@@ -0,0 +1,20 @@
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|v+0#af5f00255&|a|r| 
+0#0000000&|F| |=+0#af5f00255&| 
+0#0000000&|t+0#00e0e07&|h|i|s|.+0#af5f00255&|_+0#0000000&|M|e|t|h|o|d|A|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|
 +0#0000000&@39
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@3|F|(+0#e000e06&|"+0#e000002&|t|e|x|t|"|)+0#e000e06&| 
+0#0000000&@59
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@64
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|n|d|c|l|a|s@1| +0#0000000&@64
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1>c+0#af5f00255#ffffff0|l|a|s@1| +0#0000000&|B|a|r| 
|e+0#af5f00255&|x|t|e|n|d|s| +0#0000000&|F|o@1| @51
+|-+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|d+0#af5f00255&|e|f| 
+0#0000000&|M|e|t|h|o|d|C|(+0#e000e06&|)| +0#0000000&@57
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|v+0#af5f00255&|a|r| 
+0#0000000&|F| |=+0#af5f00255&| 
+0#0000000&|s+0#00e0e07&|u|p|e|r|.+0#af5f00255&|_+0#0000000&|M|e|t|h|o|d|A|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|
 +0#0000000&@38
+||+0#0000e05#a8a8a8255| | 
+0#0000000#ffffff0@3|F|(+0#e000e06&|"+0#e000002&|t|e|x|t|"|)+0#e000e06&| 
+0#0000000&@59
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@1|e+0#af5f00255&|n|d@1|e|f| 
+0#0000000&@64
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|n|d|c|l|a|s@1| +0#0000000&@64
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|#+0&#ffffff0| +0#0000000&|I+0#e000e06&|s@1|u|e|:| 
+0#0000e05&|h|t@1|p|s|:|/@1|g|i|t|h|u|b|.|c|o|m|/|v|i|m|/|v|i|m|/|p|u|l@1|/|1|7@1|2@1|#|i|s@1|u|e|c|o|m@1|e|n|t|-|3|0|7|5@1|3|1|0|5|2|
 +0#0000000&@2
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|x|p|o|r|t| 
+0#0000000&|d+0#af5f00255&|e|f| 
+0#0000000&|I|d|<+0#e000e06&|U+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|)|:+0#0000000&|
 |f+0#00e0003&|u|n|c|(|U+0#0000000&|)+0#00e0003&|:+0#0000000&| |U| @42
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|(+0#e000e06&|X+0#0000000&|_|:| |U|)+0#e000e06&| 
+0#0000000&|=+0#af5f00255&|>| +0#0000000&|X|_| @48
+||+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|n|d@1|e|f| +0#0000000&@66
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+@57|7|3|,|1| @9|8|5|%| 
diff --git a/runtime/syntax/testdir/dumps/vim9_generic_functions_05.dump 
b/runtime/syntax/testdir/dumps/vim9_generic_functions_05.dump
new file mode 100644
index 000000000..a804b2f19
--- /dev/null
+++ b/runtime/syntax/testdir/dumps/vim9_generic_functions_05.dump
@@ -0,0 +1,20 @@
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|x|p|o|r|t| 
+0#0000000&|d+0#af5f00255&|e|f| 
+0#0000000&|C|o|n|s|t|<+0#e000e06&|U+0#0000001#ffff4012|,+0#0000000#ffffff0| 
|V+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|)|:+0#0000000&| 
|f+0#00e0003&|u|n|c|(|U+0#0000000&|)+0#00e0003&|:+0#0000000&| 
|f+0#00e0003&|u|n|c|(|V+0#0000000&|)+0#00e0003&|:+0#0000000&| |U| @27
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|(+0#e000e06&|X+0#0000000&|_|:| |U|)+0#e000e06&| 
+0#0000000&|=+0#af5f00255&|>| +0#0000000&|(+0#e000e06&|_+0#0000000&|:| 
|V|)+0#e000e06&| +0#0000000&|=+0#af5f00255&|>| +0#0000000&|X|_| @38
+||+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|n|d@1|e|f| +0#0000000&@66
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|-+0#0000e05#a8a8a8255| >e+0#af5f00255#ffffff0|x|p|o|r|t| 
+0#0000000&|d+0#af5f00255&|e|f| 
+0#0000000&|F|l|i|p|<+0#e000e06&|U+0#0000001#ffff4012|,+0#0000000#ffffff0| 
|V+0#0000001#ffff4012|,+0#0000000#ffffff0| 
|W+0#0000001#ffff4012|>+0#e000e06#ffffff0|(|)|:+0#0000000&| 
|f+0#00e0003&|u|n|c|(|f|u|n|c|(|U+0#0000000&|)+0#00e0003&|:+0#0000000&| 
|f+0#00e0003&|u|n|c|(|V+0#0000000&|)+0#00e0003&|:+0#0000000&| 
|W|)+0#00e0003&|:+0#0000000&| 
|f+0#00e0003&|u|n|c|(|V+0#0000000&|)+0#00e0003&|:+0#0000000&| 
|f+0#00e0003&|u|n|c|(|U+0#0000000&|)+0#00e0003&|:+0#0000000&| 
+|-+0#0000e05#a8a8a8255| |W+0#0000000#ffffff0| @71
+||+0#0000e05#a8a8a8255| | +0#0000000#ffffff0@3|r+0#af5f00255&|e|t|u|r|n| 
+0#0000000&|(+0#e000e06&|F+0#0000000&|_|:| 
|f+0#00e0003&|u|n|c|(|U+0#0000000&|)+0#00e0003&|:+0#0000000&| 
|f+0#00e0003&|u|n|c|(|V+0#0000000&|)+0#00e0003&|:+0#0000000&| |W|)+0#e000e06&| 
+0#0000000&|=+0#af5f00255&|>| +0#0000000&|(+0#e000e06&|Y+0#0000000&|_|:| 
|V|)+0#e000e06&| +0#0000000&|=+0#af5f00255&|>| 
+0#0000000&|(+0#e000e06&|X+0#0000000&|_|:| |U|)+0#e000e06&| 
+0#0000000&|=+0#af5f00255&|>| 
+0#0000000&|F|_|(+0#e000e06&|X+0#0000000&|_|)+0#e000e06&|(|Y+0#0000000&|_|)+0#e000e06&|
 +0#0000000&
+||+0#0000e05#a8a8a8255| |e+0#af5f00255#ffffff0|n|d@1|e|f| +0#0000000&@66
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+| +0#0000e05#a8a8a8255@1|e+0#af5f00255#ffffff0|c|h|o| 
+0#0000000&|C|o|n|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|,+0#0000000&| 
|a+0#00e0003&|n|y|>+0#e000e06&|(|)|(|2+0#e000002&|)+0#e000e06&|(|n+0#e000002&|u|l@1|)+0#e000e06&|
 +0#0000000&@38
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@3|=+0#af5f00255&@1| 
+0#0000000&|F|l|i|p|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|,+0#0000000&| 
|a+0#00e0003&|n|y|,+0#0000000&| 
|n+0#00e0003&|u|m|b|e|r|>+0#e000e06&|(|)|(|C+0#0000000&|o|n|s|t|<+0#e000e06&|n+0#00e0003&|u|m|b|e|r|,+0#0000000&|
 
|a+0#00e0003&|n|y|>+0#e000e06&|(|)@1|(|n+0#e000002&|u|l@1|)+0#e000e06&|(|2+0#e000002&|)+0#e000e06&|
 +0#0000000&@7
+| +0#0000e05#a8a8a8255@1| +0#0000000#ffffff0@72
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+| +0#0000000&@56|9|1|,|1| @9|B|o|t| 
diff --git 
a/runtime/syntax/testdir/input/vim9_generic_function_example_list.vim 
b/runtime/syntax/testdir/input/vim9_generic_function_example_list.vim
new file mode 100644
index 000000000..597c02774
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim9_generic_function_example_list.vim
@@ -0,0 +1,215 @@
+vim9script
+# VIM_TEST_SETUP highlight link vim9DefTypeParam Todo
+# VIM_TEST_SETUP let g:vimsyn_folding = "f"
+# VIM_TEST_SETUP setl fdc=2 fdl=99 fdm=syntax
+# See: https://github.com/vim/vim/pull/17313#issuecomment-3046696820 (Aliaksei 
Budavei)
+
+
+# See https://github.com/vim/vim/pull/16604#issuecomment-265202845 .
+export interface Listable
+    def Cons<E>(_: E): Listable
+    def Reverse<E>(): Listable
+    def Rest(): Listable
+    def First<E>(): E
+    def empty(): bool
+    def len(): number
+    def string(): string
+endinterface
+
+enum EmptyList implements Listable
+    INSTANCE
+
+    def Cons<E>(value: E): Listable
+       return List.new<E>(value)
+    enddef
+
+    def Reverse<E>(): Listable
+       return this
+    enddef
+
+    def Rest(): Listable
+       return this
+    enddef
+
+    def First<E>(): E
+       return null
+    enddef
+
+    def empty(): bool
+       return true
+    enddef
+
+    def len(): number
+       return 0
+    enddef
+
+    def string(): string
+       return '[]'
+    enddef
+endenum
+
+class List implements Listable
+    const _value: any
+    const _size: number
+    var _next: Listable
+
+    def new<E>(value: E)
+       this._value = value
+       this._size = 1
+       this._next = EmptyList.INSTANCE
+    enddef
+
+    def _newCons<E>(value: E, size: number)
+       this._value = value
+       this._size = size
+    enddef
+
+    def Cons<E>(value: E): Listable
+       const list: List = List._newCons<E>(value, (this._size + 1))
+       list._next = this
+       return list
+    enddef
+
+    def Reverse<E>(): Listable
+       var result: Listable = List.new<E>(this.First<E>())
+       var list: Listable = this.Rest()
+
+       while !list.empty()
+           result = result.Cons<E>(list.First<E>())
+           list = list.Rest()
+       endwhile
+
+       return result
+    enddef
+
+    def Rest(): Listable
+       return this._next
+    enddef
+
+    def First<E>(): E
+       return this._value
+    enddef
+
+    def empty(): bool
+       return (this._size == 0)
+    enddef
+
+    def len(): number
+       return this._size
+    enddef
+
+    def string(): string
+       if this.empty()
+           return '[]'
+       endif
+
+       var text: string = '[' .. string(this.First<any>()) .. ', '
+       var list: Listable = this.Rest()
+
+       while !list.empty()
+           text ..= string(list.First<any>()) .. ', '
+           list = list.Rest()
+       endwhile
+
+       return strpart(text, 0, (strlen(text) - 2)) .. ']'
+    enddef
+endclass
+
+export def MakeEmptyList(): Listable
+    return EmptyList.INSTANCE
+enddef
+
+export def MakeList<E>(value: E): Listable
+    return List.new<E>(value)
+enddef
+
+export def Map<T, U>(listable: Listable, Mapper: func(T): U): Listable
+    var result: Listable = EmptyList.INSTANCE
+    var list: Listable = listable
+
+    while !list.empty()
+       result = result.Cons<U>(Mapper(list.First<T>()))
+       list = list.Rest()
+    endwhile
+
+    return result.Reverse<U>()
+enddef
+
+export def Filter<T>(listable: Listable, Predicate: func(T): bool): Listable
+    var result: Listable = EmptyList.INSTANCE
+    var list: Listable = listable
+
+    while !list.empty()
+       if Predicate(list.First<T>())
+           result = result.Cons<T>(list.First<T>())
+       endif
+
+       list = list.Rest()
+    endwhile
+
+    return result.Reverse<T>()
+enddef
+
+############################################################
+
+echo MakeEmptyList()
+
+const listX: Listable = MakeEmptyList()
+    .Cons<number>(0).Cons<number>(1).Cons<number>(2).Cons<number>(3)
+const listY: Listable = MakeList<number>(0)
+    .Cons<number>(1).Cons<number>(2).Cons<number>(3)
+echo listX == listY
+echo listX
+echo listX.Reverse<number>()
+echo MakeEmptyList().Reverse<any>()
+echo Filter<number>(listX, (value: number) => value % 2 != 0)
+echo Map<number, string>(listX, (value: number) => nr2char((value + 60), 1))
+
+echo 4 listX.len() listY.len()
+echo listX
+echo listY
+
+const list3X: Listable = listX.Rest()
+const list3Y: Listable = listY.Rest()
+echo 3 list3X.len() list3Y.len()
+echo list3X
+echo list3Y
+
+const list2X: Listable = list3X.Rest()
+const list2Y: Listable = list3Y.Rest()
+echo 2 list2X.len() list2Y.len()
+echo list2X
+echo list2Y
+
+const list1X: Listable = list2X.Rest()
+const list1Y: Listable = list2Y.Rest()
+echo 1 list1X.len() list1Y.len()
+echo list1X
+echo list1Y
+
+const list0X: Listable = list1X.Rest()
+const list0Y: Listable = list1Y.Rest()
+echo 0 list0X.len() list0Y.len()
+echo list0X
+echo list0Y
+
+const list0X_: Listable = list0X.Rest()
+const list0Y_: Listable = list0Y.Rest()
+echo 0 list0X_.len() list0Y_.len()
+echo list0X_
+echo list0Y_
+
+const list0X__: Listable = list0X_.Rest()
+const list0Y__: Listable = list0Y_.Rest()
+echo 0 list0X__.len() list0Y__.len()
+echo list0X__
+echo list0Y__
+
+
+const listZ: Listable = MakeList<Listable>(MakeList<number>(-1))
+const listZZ: Listable = listZ.Cons<Listable>(MakeList<number>(0))
+    .Cons<Listable>(MakeList<number>(1))
+    .Cons<Listable>(MakeList<number>(2))
+    .Cons<Listable>(MakeList<number>(3))
+echo listZZ
+
diff --git a/runtime/syntax/testdir/input/vim9_generic_function_example_set.vim 
b/runtime/syntax/testdir/input/vim9_generic_function_example_set.vim
new file mode 100644
index 000000000..a4b11fadf
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim9_generic_function_example_set.vim
@@ -0,0 +1,177 @@
+vim9script
+# VIM_TEST_SETUP highlight link vim9DefTypeParam Todo
+# VIM_TEST_SETUP let g:vimsyn_folding = "f"
+# VIM_TEST_SETUP setl fdc=2 fdl=99 fdm=syntax
+# See: https://github.com/vim/vim/pull/17313#issuecomment-3046696820 (Aliaksei 
Budavei)
+
+# See https://github.com/vim/vim/issues/14330#issuecomment-2028938515 .
+export class Set
+    final _elements: dict<number>
+    const _Mapper: func(number, string): any
+    const ToStringer: func(any): string
+    const FromStringer: func(string): any
+
+    static def _Mapper<E>(F: func(string): E): func(number, string): E
+       return ((G: func(string): E) => (_: number, v: string): E => G(v))(F)
+    enddef
+
+    def new<E>()
+       this._elements = {}
+       this._Mapper = _Mapper<E>((s: string): E => eval(s))
+       this.ToStringer = (a: E): string => string(a)
+       this.FromStringer = (s: string): E => eval(s)
+    enddef
+
+    def newFromList<E>(elements: list<E>, ToStringer: func(E): string,
+                                       FromStringer: func(string): E)
+       this._elements = elements
+           ->reduce(((F: func(E): string) => (d: dict<number>, v: E) =>
+               extend({[F(v)]: 1}, d))(ToStringer),
+               {})
+       this._Mapper = _Mapper<E>(FromStringer)
+       this.ToStringer = ToStringer
+       this.FromStringer = FromStringer
+    enddef
+
+    def _FromList<E>(elements: list<E>): Set
+       return Set.newFromList<E>(elements, this.ToStringer, this.FromStringer)
+    enddef
+
+    def Contains<E>(element: E): bool
+       return has_key(this._elements, this.ToStringer(element))
+    enddef
+
+    def Elements<E>(): list<E>
+       return keys(this._elements)->mapnew(this._Mapper)
+    enddef
+
+    def empty(): bool
+       return empty(this._elements)
+    enddef
+
+    def len(): number
+       return len(this._elements)
+    enddef
+
+    def string(): string
+       return string(keys(this._elements))
+    enddef
+
+    # {1, 2, 3} ⊇ {1, 2}.
+    def Superset(that: Set): bool
+       return (len(this._elements) >= len(that._elements)) && that._elements
+           ->keys()
+           ->indexof(((set: Set) => (_: number, v: string) => !set._elements
+               ->has_key(v))(this)) < 0
+    enddef
+
+    # {1, 2} ⊆ {1, 2, 3}.
+    def Subset(that: Set): bool
+       return (len(this._elements) <= len(that._elements)) && this._elements
+           ->keys()
+           ->indexof(((set: Set) => (_: number, v: string) => !set._elements
+               ->has_key(v))(that)) < 0
+    enddef
+
+    # {1, 2, 3} ∪ {2, 3, 4} = {1, 2, 3, 4}.
+    def Union(that: Set): Set
+       return this._FromList<any>({}
+           ->extend(that._elements)
+           ->extend(this._elements)
+           ->keys()
+           ->map(this._Mapper))
+    enddef
+
+    # {1, 2, 3} ∩ {2, 3, 4} = {2, 3}.
+    def Intersection(that: Set): Set
+       return this._FromList<any>(this._elements
+           ->keys()
+           ->filter(((set: Set) => (_: number, v: string) => set._elements
+               ->has_key(v))(that))
+           ->map(this._Mapper))
+    enddef
+
+    # {1, 2, 3} \ {2, 3, 4} = {1}.
+    # {2, 3, 4} \ {1, 2, 3} = {4}.
+    def SetDifference(that: Set): Set
+       return this._FromList<any>(this._elements
+           ->keys()
+           ->filter(((set: Set) => (_: number, v: string) => !set._elements
+               ->has_key(v))(that))
+           ->map(this._Mapper))
+    enddef
+
+    # {1, 2, 3} △ {2, 3, 4} = {1, 4}.
+    def SymmetricDifference(that: Set): Set
+       return this.Union(that).SetDifference(this.Intersection(that))
+    enddef
+endclass
+
+############################################################
+
+const ToStr: func(number): string = (s: number) => string(s)
+const FromStr: func(string): number = (s: string) => str2nr(s)
+
+echo Set.newFromList<number>([1, 2, 3], ToStr, FromStr)
+    .Subset(Set.newFromList<number>([1, 2], ToStr, FromStr))
+echo Set.newFromList<number>([1, 2], ToStr, FromStr)
+    .Subset(Set.newFromList<number>([1, 2, 3], ToStr, FromStr))
+echo Set.newFromList<number>([1, 2], ToStr, FromStr)
+    .Superset(Set.newFromList<number>([1, 2, 3], ToStr, FromStr))
+echo Set.newFromList<number>([1, 2, 3], ToStr, FromStr)
+    .Superset(Set.newFromList<number>([1, 2], ToStr, FromStr))
+
+echo Set.newFromList<number>([1, 2, 3], ToStr, FromStr)
+    .Union(Set.newFromList<number>([2, 3, 4], ToStr, FromStr))
+    .Elements<number>()
+echo Set.newFromList<number>([2, 3, 4], ToStr, FromStr)
+    .Union(Set.newFromList<number>([1, 2, 3], ToStr, FromStr))
+    .Elements<number>()
+
+echo Set.newFromList<number>([1, 2, 3], ToStr, FromStr)
+    .Intersection(Set.newFromList<number>([2, 3, 4], ToStr, FromStr))
+    .Elements<number>()
+echo Set.newFromList<number>([2, 3, 4], ToStr, FromStr)
+    .Intersection(Set.newFromList<number>([1, 2, 3], ToStr, FromStr))
+    .Elements<number>()
+
+echo Set.newFromList<number>([1, 2, 3], ToStr, FromStr)
+    .SetDifference(Set.newFromList<number>([2, 3, 4], ToStr, FromStr))
+    .Elements<number>()
+echo Set.newFromList<number>([2, 3, 4], ToStr, FromStr)
+    .SetDifference(Set.newFromList<number>([1, 2, 3], ToStr, FromStr))
+    .Elements<number>()
+
+echo Set.newFromList<number>([1, 2, 3], ToStr, FromStr)
+    .SymmetricDifference(Set.newFromList<number>([2, 3, 4], ToStr, FromStr))
+    .Elements<number>()
+echo Set.newFromList<number>([2, 3, 4], ToStr, FromStr)
+    .SymmetricDifference(Set.newFromList<number>([1, 2, 3], ToStr, FromStr))
+    .Elements<number>()
+
+############################################################
+
+const none: Set = Set.new<any>()
+echo none.len()
+echo none.empty()
+echo none.string()
+echo string(none.Elements<any>())
+
+const sets: Set = Set.newFromList<Set>(
+    [Set.new<any>(), Set.new<any>(), Set.new<any>(), Set.new<any>()],
+    (o: Set): string => string(o),
+    (_: string): Set => Set.new<any>())
+echo sets.len()
+echo sets.empty()
+echo sets.string()
+echo string(sets.Elements<Set>())
+
+const lists: Set = Set.newFromList<list<any>>(
+    [[[[[]]]]],
+    (o: list<any>): string => string(o),
+    (s: string): list<any> => eval(s))
+echo lists.len()
+echo lists.empty()
+echo lists.string()
+echo string(lists.Elements<list<any>>())
+
diff --git a/runtime/syntax/testdir/input/vim9_generic_functions.vim 
b/runtime/syntax/testdir/input/vim9_generic_functions.vim
new file mode 100644
index 000000000..010532483
--- /dev/null
+++ b/runtime/syntax/testdir/input/vim9_generic_functions.vim
@@ -0,0 +1,97 @@
+vim9script
+# Vim9 generic functions
+# VIM_TEST_SETUP highlight link vim9DefTypeParam Todo
+# VIM_TEST_SETUP let g:vimsyn_folding = "f"
+# VIM_TEST_SETUP setl fdc=2 fdl=99 fdm=syntax
+
+
+# :help generic-functions
+
+def MyFunc<T, A, B>(param1: T): T
+    var f: A
+    var x = param1
+    return x
+enddef
+
+MyFunc<number, string, list<number>>()
+
+
+def Flatten<T>(x: list<list<T>>): list<T>
+    var result: list<T> = []
+    for inner in x
+       result += inner
+    endfor
+    return result
+enddef
+
+echo Flatten<number>([[1, 2], [3]])
+
+
+class A
+    def Foo<X, Y>()
+    enddef
+endclass
+var a = A.new()
+a.Foo<number, string>()
+
+
+def MakeEcho<T>(): func(T): T
+    return (x: T): T => x
+enddef
+
+var EchoNumber = MakeEcho<number>()
+echo EchoNumber(123)
+
+var EchoString = MakeEcho<string>()
+echo EchoString('abc')
+
+# FIXME: add specific command handling
+# defcompile MyFunc<number, list<number>, dict<string>>
+
+# disassemble MyFunc<string, dict<string>>
+# disassemble MyFunc<number, list<blob>>
+
+
+# funcrefs
+
+var Foo = Bar<number>
+Execute(Bar<number>)
+
+var Foo = bar.Baz<string>
+Execute(bar.Baz<string>)
+
+class Foo
+  def _MethodA<T>(arg: T)
+    echo arg
+  enddef
+  def MethodB()
+    var F = this._MethodA<number>
+    F("text")
+  enddef
+endclass
+
+class Bar extends Foo
+  def MethodC()
+    var F = super._MethodA<number>
+    F("text")
+  enddef
+endclass
+
+
+# Issue: https://github.com/vim/vim/pull/17722#issuecomment-3075531052
+
+export def Id<U>(): func(U): U
+    return (X_: U) => X_
+enddef
+
+export def Const<U, V>(): func(U): func(V): U
+    return (X_: U) => (_: V) => X_
+enddef
+
+export def Flip<U, V, W>(): func(func(U): func(V): W): func(V): func(U): W
+    return (F_: func(U): func(V): W) => (Y_: V) => (X_: U) => F_(X_)(Y_)
+enddef
+
+echo Const<number, any>()(2)(null)
+    == Flip<number, any, number>()(Const<number, any>())(null)(2)
+
diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim
index 4e394d35a..ec7d4784d 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 <dougkea...@gmail.com>
-" Last Change:    2025 Jul 21
+" Last Change:    2025 Jul 23
 " Former Maintainer: Charles E. Campbell
 
 " DO NOT CHANGE DIRECTLY.
@@ -321,6 +321,8 @@ syn match vimVimVar "\<v:"          
nextgroup=vimSubscript,vimVimVarName,vimVarNameError
 syn match vimOptionVar "&\%([lg]:\)\="         
nextgroup=vimSubscript,vimOptionVarName,vimVarNameError
 syn cluster vimSpecialVar      
contains=vimEnvvar,vimLetRegister,vimOptionVar,vimVimVar
 
+Vim9 syn match vimVar  contained        "\<\h\w*\ze<"          
nextgroup=vim9TypeArgs
+
 Vim9 syn match vim9LhsVariable "\s\=\h[a-zA-Z0-9#_]*\ze\s\+[-+/*%]\=="
 Vim9 syn match vim9LhsVariable "\s\=\h[a-zA-Z0-9#_]*\ze\s\+\.\.="
 Vim9 syn match vim9LhsVariable "\s\=\%([bwgt]:\)\=\h[a-zA-Z0-9#_]*\ze\s\+=<<"  
skipwhite nextgroup=vimLetHeredoc       contains=vimVarScope
@@ -522,7 +524,7 @@ syn match   vimFunctionName contained
       \ contains=vimFunctionError,vimFunctionScope,vimFunctionSID,Tag
 syn match      vimDefName      contained
       \ "\%(<[sS][iI][dD]>\|[bwglstav]:\)\=\%([[:alnum:]_#.]\+\|{.\{-1,}}\)\+"
-      \ nextgroup=vimDefParams,vimCmdSep,vimComment,vim9Comment
+      \ 
nextgroup=vimDefTypeParams,vimDefParams,vimCmdSep,vimComment,vim9Comment
       \ contains=vimFunctionError,vimFunctionScope,vimFunctionSID,Tag
 
 syn match      vimFunction     "\<fu\%[nction]\>"      skipwhite 
nextgroup=vimFunctionBang,vimFunctionName,vimFunctionPattern,vimCmdSep,vimComment
@@ -552,8 +554,15 @@ syn region vimDefParams    contained
       \ end=")"
       \ skipwhite skipempty 
nextgroup=vimDefBody,vimDefComment,vimEnddef,vimReturnType,vimCommentError
       \ contains=vimDefParam,vim9Comment,vimFunctionParamEquals,vimOperParen
+syn region     vimDefTypeParams        contained
+      \ matchgroup=Delimiter
+      \ start="<"
+      \ end=">"
+      \ nextgroup=vimDefParams
+      \ contains=vim9DefTypeParam
 syn match      vimFunctionParam        contained       "\<\h\w*\>\|\.\.\."     
skipwhite nextgroup=vimFunctionParamEquals
 syn match      vimDefParam     contained       "\<\h\w*\>"             
skipwhite nextgroup=vimParamType,vimFunctionParamEquals
+syn match      vim9DefTypeParam        contained       "\<\u\w*\>"
 
 syn match      vimFunctionParamEquals contained        "="                     
skipwhite         nextgroup=@vimExprList
 syn match      vimFunctionMod       contained  
"\<\%(abort\|closure\|dict\|range\)\>"  skipwhite skipempty 
nextgroup=vimFunctionBody,vimFunctionComment,vimEndfunction,vimFunctionMod,vim9CommentError
@@ -585,7 +594,7 @@ if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'f'
   syn region   vimDefFold
         \ start="\<def!"
         "\ assume no dict literal in curly-brace name expressions
-        \ start="\<def\>\s*\%([[:alnum:]_:<>.#]\+\|{.\{-1,}}\)\+("
+        \ start="\<def\>\s*\%([[:alnum:]_:<>.#]\+\|{.\{-1,}}\)\+[<(]"
         \ end="^\s*:\=\s*enddef\>"
         \ contains=vimDef
         \ extend fold keepend transparent
@@ -627,14 +636,20 @@ if s:vim9script
 
   " Methods {{{3
   syn match    vim9MethodDef           contained       "\<def\>"       
skipwhite nextgroup=vim9MethodDefName,vim9ConstructorDefName
-  syn match    vim9MethodDefName               contained       "\<\h\w*\>"     
nextgroup=vim9MethodDefParams contains=@vim9MethodName
+  syn match    vim9MethodDefName               contained       "\<\h\w*\>"     
nextgroup=vim9MethodDefParams,vim9MethodDefTypeParams contains=@vim9MethodName
   syn region   vim9MethodDefParams     contained
         \ matchgroup=Delimiter start="(" end=")"
         \ skipwhite skipnl 
nextgroup=vim9MethodDefBody,vim9MethodDefComment,vimEnddef,vim9MethodDefReturnType,vimCommentError
         \ contains=vimDefParam,vim9Comment,vimFunctionParamEquals
+  syn region   vim9MethodDefTypeParams contained
+        \ matchgroup=Delimiter
+        \ start="<"
+        \ end=">"
+        \ nextgroup=vim9MethodDefParams
+        \ contains=vim9DefTypeParam
 
   syn match    vim9ConstructorDefName  contained       "\<_\=new\w*\>"
-        \ nextgroup=vim9ConstructorDefParams
+        \ nextgroup=vim9ConstructorDefParams,vim9ConstuctorDefTypeParams
         \ contains=@vim9MethodName
   syn match    vim9ConstructorDefParam contained       "\<\%(this\.\)\=\h\w*\>"
         \ skipwhite nextgroup=vimParamType,vimFunctionParamEquals
@@ -643,6 +658,12 @@ if s:vim9script
         \ matchgroup=Delimiter start="(" end=")"
         \ skipwhite skipnl 
nextgroup=vim9MethodDefBody,vim9MethodDefComment,vimEnddef,vimCommentError
         \ contains=vim9ConstructorDefParam,vim9Comment,vimFunctionParamEquals
+  syn region   vim9ConstuctorDefTypeParams     contained
+        \ matchgroup=Delimiter
+        \ start="<"
+        \ end=">"
+        \ nextgroup=vim9ConstructorDefParams
+        \ contains=vim9DefTypeParam
 
   syn region   vim9MethodDefReturnType contained
         \ start=":\%(\s\|
\)\@="
@@ -676,8 +697,11 @@ if s:vim9script
   syn cluster  vim9MethodName  contains=vim9MethodName,vim9MethodNameError
 
   if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'f'
-    syn region vim9MethodDefFold       contained       
start="\%(^\s*\%(:\=static\s\+\)\=\)\@16<=:\=def\s\+\h\i*(" 
end="^\s*:\=enddef\>" contains=vim9MethodDef fold keepend extend transparent
-    syn region vim9MethodDefFold       contained       
start="^\s*:\=def\s\+_\=new\i*("                      end="^\s*:\=enddef\>" 
contains=vim9MethodDef fold keepend extend transparent
+    syn region vim9MethodDefFold       contained
+          \ start="\%(^\s*\%(:\=static\s\+\)\=\)\@16<=:\=def\s\+\h\w*[<(]"
+          \ end="^\s*:\=enddef\>"
+          \ contains=vim9MethodDef
+          \ fold keepend extend transparent
   endif
 
   syn cluster vim9MethodDef contains=vim9MethodDef,vim9MethodDefFold
@@ -757,7 +781,7 @@ if s:vim9script
   syn match    vim9InterfaceName               contained       "\<\u\w*\>"     
skipwhite skipnl nextgroup=vim9Extends
 
   syn keyword  vim9AbstractDef         contained       def     skipwhite 
nextgroup=vim9AbstractDefName
-  syn match    vim9AbstractDefName     contained       "\<\h\w*\>"     
skipwhite nextgroup=vim9AbstractDefParams contains=@vim9MethodName
+  syn match    vim9AbstractDefName     contained       "\<\h\w*\>"     
skipwhite nextgroup=vim9AbstractDefParams,vim9AbstractDefTypeParams 
contains=@vim9MethodName
   syn region   vim9AbstractDefParams   contained
         \ matchgroup=Delimiter start="(" end=")"
         \ skipwhite skipnl 
nextgroup=vimDefComment,vim9AbstractDefReturnType,vimCommentError
@@ -767,6 +791,12 @@ if s:vim9script
         \ skipwhite skipnl nextgroup=vimDefComment,vimCommentError
         \ contains=vimTypeSep
         \ transparent
+  syn region   vim9AbstractDefTypeParams       contained
+        \ matchgroup=Delimiter
+        \ start="<"
+        \ end=">"
+        \ nextgroup=vim9AbstractDefParams
+        \ contains=vim9DefTypeParam
 
   VimFoldi syn region  vim9InterfaceBody       start="\<interface\>" 
matchgroup=vimCommand end="\<endinterface\>" contains=@vim9InterfaceBodyList 
transparent
 
@@ -1493,7 +1523,7 @@ syn match vimBracket contained    "[\<>]"
 syn case match
 
 " User Command Highlighting: {{{2
-syn match vimUsrCmd    
'^\s*\zs\u\%(\w*\)\@>\%([.(#[]\|\s\+\%([-+*/%]\=\|\.\.\)=\)\@!'
+syn match vimUsrCmd    
'^\s*\zs\u\%(\w*\)\@>\%([<.(#[]\|\s\+\%([-+*/%]\=\|\.\.\)=\)\@!'
 
 " Vim user commands
 
@@ -2150,18 +2180,26 @@ unlet s:interfaces
 " Function Call Highlighting: {{{2
 " (following Gautam Iyer's suggestion)
 " ==========================
-syn match      vimFunc contained       "\<\l\w*\ze\s*("                        
        skipwhite nextgroup=vimOperParen contains=vimFuncName
-syn match      vimUserFunc     contained       "\.\@1<=\l\w*\ze\s*("           
        skipwhite nextgroup=vimOperParen
-syn match      vimUserFunc     contained       
"\<\%([[:upper:]_]\|\%(\h\w*\.\)\+\h\)\w*\ze\s*("               skipwhite 
nextgroup=vimOperParen contains=vim9MethodName,vim9Super,vim9This
-syn match      vimUserFunc     contained       
"\<\%(g:\)\=\%(\h\w*#\)\+\h\w*\ze\s*("          skipwhite 
nextgroup=vimOperParen contains=vimVarScope
-syn match      vimUserFunc     contained       
"\%(\<[sgbwtlav]:\|<[sS][iI][dD]>\)\%(\h\w*\.\)*\h\w*\ze\s*("   skipwhite 
nextgroup=vimOperParen contains=vimVarScope,vimNotation
+syn match      vimFunc contained       "\<\l\w*\ze\s*("                        
                skipwhite nextgroup=vimOperParen                
contains=vimFuncName
+syn match      vimUserFunc     contained       
"\.\@1<=\l\w*\ze\%(\s*(\|<.*>(\)"                               skipwhite 
nextgroup=vimOperParen,vim9TypeArgs
+syn match      vimUserFunc     contained       
"\<\%([[:upper:]_]\|\%(\h\w*\.\)\+\h\)\w*\ze\%(\s*(\|<.*>(\)"           
skipwhite nextgroup=vimOperParen,vim9TypeArgs   
contains=vim9MethodName,vim9Super,vim9This
+syn match      vimUserFunc     contained       
"\<\%(g:\)\=\%(\h\w*#\)\+\h\w*\ze\%(\s*(\|<.*>(\)"                      
skipwhite nextgroup=vimOperParen                contains=vimVarScope
+syn match      vimUserFunc     contained       
"\%(\<[sgbwtlav]:\|<[sS][iI][dD]>\)\%(\h\w*\.\)*\h\w*\ze\%(\s*(\|<.*>(\)"       
skipwhite nextgroup=vimOperParen,vim9TypeArgs   contains=vimVarScope,vimNotation
 
-Vim9 syn match vim9UserFunc    
"^\s*\zs\%([sgbwtv]:\|<[sS][iI][dD]>\)\=\%(\h\w*[.#]\)*\h\w*\ze("               
skipwhite nextgroup=vimOperParen 
contains=vimVarScope,vimNotation,vim9MethodName,vim9Super,vim9This
-Vim9 syn match vim9Func        "^\s*\zs\l\w*\ze("                              
skipwhite nextgroup=vimOperParen contains=vimFuncName
+Vim9 syn match vim9UserFunc    
"^\s*\zs\%([sgbwtv]:\|<[sS][iI][dD]>\)\=\%(\h\w*[.#]\)*\h\w*\ze[<(]"            
        skipwhite nextgroup=vimOperParen,vim9TypeArgs   
contains=vimVarScope,vimNotation,vim9MethodName,vim9Super,vim9This
+Vim9 syn match vim9Func        "^\s*\zs\l\w*\ze("                              
        skipwhite nextgroup=vimOperParen                contains=vimFuncName
 
 syn cluster    vimFunc contains=vimFunc,vimUserFunc
 syn cluster    vim9Func        contains=vim9Func,vim9UserFunc
 
+syn region     vim9TypeArgs    contained
+      \ matchgroup=Delimiter
+      \ start="<\ze "
+      \ end=">"
+      \ nextgroup=vimOperParen
+      \ contains=@vimType
+      \ oneline
+
 " Beginners - Patterns that involve ^ {{{2
 " =========
 Vim9 syn region        vim9LineComment start=+^[       :]*\zs#.*$+ skip=+
\s*\\|
\s*#\ + end="$" contains=@vimCommentGroup,vimCommentString,vim9CommentTitle 
extend

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1uefAE-006BVp-20%40256bit.org.

Raspunde prin e-mail lui