patch 9.0.2162: Vim9: type documentation out-dated

Commit: 
https://github.com/vim/vim/commit/2a71b54d35361f3f0c24db88c672b426f8acc7b7
Author: Yegappan Lakshmanan <[email protected]>
Date:   Thu Dec 14 20:03:03 2023 +0100

    patch 9.0.2162: Vim9: type documentation out-dated
    
    Problem:  Vim9: type documentation out-dated
    Solution: Update documentation, fix typo in type alias
              definition
    
    closes: #13684
    
    Signed-off-by: Yegappan Lakshmanan <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index c9b9938dd..657fe8dbd 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -10181,6 +10181,7 @@ type({expr})    The result is a Number representing the 
type of {expr}.
                        Blob:      10  |v:t_blob|
                        Class:     12  |v:t_class|
                        Object:    13  |v:t_object|
+                       Typealias: 14  |v:t_typealias|
                For backward compatibility, this method can be used: >
                        :if type(myvar) == type(0)
                        :if type(myvar) == type("")
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 5d61035f5..2a4bd4c7d 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2558,6 +2558,8 @@ v:t_blob  Value of |Blob| type.  Read-only.  See: |type()|
 v:t_class      Value of |class| type.  Read-only.  See: |type()|
                                        *v:t_object* *t_object-variable*
 v:t_object     Value of |object| type.  Read-only.  See: |type()|
+                                       *v:t_typealias* *t_typealias-variable*
+v:t_typealias  Value of |typealias| type.  Read-only.  See: |type()|
 
                                *v:termresponse* *termresponse-variable*
 v:termresponse The escape sequence returned by the terminal for the |t_RV|
diff --git a/runtime/doc/tags b/runtime/doc/tags
index 9c641f52d..fdda06b7e 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -4491,7 +4491,19 @@ E139     message.txt     /*E139*
 E1390  vim9class.txt   /*E1390*
 E1391  eval.txt        /*E1391*
 E1392  eval.txt        /*E1392*
+E1393  vim9class.txt   /*E1393*
+E1394  vim9class.txt   /*E1394*
+E1395  vim9class.txt   /*E1395*
+E1396  vim9class.txt   /*E1396*
+E1397  vim9class.txt   /*E1397*
+E1398  vim9class.txt   /*E1398*
+E1399  vim9class.txt   /*E1399*
 E140   message.txt     /*E140*
+E1400  vim9class.txt   /*E1400*
+E1401  vim9class.txt   /*E1401*
+E1402  vim9class.txt   /*E1402*
+E1403  vim9class.txt   /*E1403*
+E1407  vim9class.txt   /*E1407*
 E141   message.txt     /*E141*
 E142   message.txt     /*E142*
 E143   autocmd.txt     /*E143*
@@ -10285,6 +10297,7 @@ t_ti    term.txt        /*t_ti*
 t_tp   version4.txt    /*t_tp*
 t_ts   term.txt        /*t_ts*
 t_ts_old       version4.txt    /*t_ts_old*
+t_typealias-variable   eval.txt        /*t_typealias-variable*
 t_u7   term.txt        /*t_u7*
 t_ue   term.txt        /*t_ue*
 t_undo version4.txt    /*t_undo*
@@ -10785,6 +10798,7 @@ v:t_none        eval.txt        /*v:t_none*
 v:t_number     eval.txt        /*v:t_number*
 v:t_object     eval.txt        /*v:t_object*
 v:t_string     eval.txt        /*v:t_string*
+v:t_typealias  eval.txt        /*v:t_typealias*
 v:termblinkresp        eval.txt        /*v:termblinkresp*
 v:termrbgresp  eval.txt        /*v:termrbgresp*
 v:termresponse eval.txt        /*v:termresponse*
diff --git a/runtime/doc/vim9class.txt b/runtime/doc/vim9class.txt
index f7ce91462..c0fc7cb03 100644
--- a/runtime/doc/vim9class.txt
+++ b/runtime/doc/vim9class.txt
@@ -752,16 +752,38 @@ constructor methods.
 
 7.  Type definition                                    *Vim9-type* *:type*
 
-A type definition is giving a name to a type specification.  This also known
-type alias.  For Example: >
+                                       *E1393* *E1395* *E1396* *E1397* *E1398*
+A type definition is giving a name to a type specification.  This is also
+known as a "type alias".  The type alias can be used wherever a built-in type
+can be used.  Example: >
+
+    type ListOfStrings = list<string>
+    var s: ListOfStrings = ['a', 'b']
+
+    def ProcessStr(str: ListOfStrings): ListOfStrings
+       return str
+    enddef
+    echo ProcessStr(s)
+<
+                                                       *E1394*
+A type alias name must start with an upper case character.  Only existing
+types can be aliased.
+
+                                                       *E1399*
+A type alias can be created only at the script level and not inside a
+function.  A type alias can be exported and used across scripts.
 
-       :type ListOfStrings = list<string>
+                                       *E1400* *E1401* *E1402* *E1403* *E1407*
+A type alias cannot be used as an expression.  A type alias cannot be used in
+the left-hand-side of an assignment.
 
-The type alias can be used wherever a built-in type can be used.  The type
-alias name must start with an upper case character.  A type alias can be
-created only at the script level and not inside a function.  A type alias can
-be exported and used across scripts.
+For a type alias name, the |typename()| function returns the type that is
+aliased: >
 
+    type ListOfStudents = list<dict<any>>
+    echo typename(ListOfStudents)
+    typealias<list<dict<any>>>
+<
 ==============================================================================
 
 8.  Enum                                       *Vim9-enum* *:enum* *:endenum*
diff --git a/src/version.c b/src/version.c
index a6a54f227..6813d5411 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2162,
 /**/
     2161,
 /**/
diff --git a/src/vim.h b/src/vim.h
index 2d5ae99cb..3aa04f554 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -2181,7 +2181,7 @@ typedef int sock_T;
 #define VAR_TYPE_INSTR     11
 #define VAR_TYPE_CLASS     12
 #define VAR_TYPE_OBJECT            13
-#define VAR_TYPE_TYPEALIAS  15
+#define VAR_TYPE_TYPEALIAS  14
 
 #define DICT_MAXNEST 100       // maximum nesting of lists and dicts
 

-- 
-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1rDrAo-0027YS-Mu%40256bit.org.

Raspunde prin e-mail lui