summaryrefslogtreecommitdiffstats
path: root/src/vim9type.c
AgeCommit message (Collapse)Author
2024-03-28patch 9.1.0219: Vim9: No enum supportv9.1.0219Yegappan Lakshmanan
Problem: No enum support Solution: Implement enums for Vim9 script (Yegappan Lakshmanan) closes: #14224 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-21patch 9.0.2184: Vim9: inconsistent :type/:class messagesv9.0.2184Ernie Rael
Problem: Vim9: inconsistent :type/:class messages Solution: Update the Messages (Ernie Rael) closes: #13706 Signed-off-by: Ernie Rael <errael@raelity.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-16patch 9.0.2169: Vim9: builtin funcs may accept a non-valuev9.0.2169Ernie Rael
Problem: Vim9: builtin funcs may accept a non-value Solution: Restrict builtin functions that accept `type` This PR finishes off detection and prevention of using a type as a value. It takes care of builtin functions. However there are some builtin functions, that need to be able to handle types as well as non-args: instanceof(), type(), typename(), string(). A "bit", FE_X, is added to funcentry_T; when set, the builtin function can handle a type (class or type-alias) in addition to a value. Noteworthy change: Discovered that in compile_call() the builtin add() is compiled inline instead of calling the builtin. Had to add a check there. closes: #13688 Signed-off-by: Ernie Rael <errael@raelity.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-14patch 9.0.2163: Vim9: type can be assigned to list/dictv9.0.2163Ernie Rael
Problem: Vim9: type can be assigned to list/dict Solution: Prevent assigning a `type` to a `list` or `dict` closes: #13683 Signed-off-by: Ernie Rael <errael@raelity.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-11patch 9.0.2158: [security]: use-after-free in check_argument_typev9.0.2158Christian Brabandt
Problem: [security]: use-after-free in check_argument_type Solution: Reset function type pointer when freeing the function type list function pointer fp->uf_func_type may point to the same memory, that was allocated for fp->uf_type_list. However, when cleaning up a function definition (e.g. because it was invalid), fp->uf_type_list will be freed, but fp->uf_func_type may still point to the same (now) invalid memory address. So when freeing the fp->uf_type_list, check if fp->func_type points to any of those types and if it does, reset the fp->uf_func_type pointer to the t_func_any (default) type pointer closes: #13652 Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-11patch 9.0.2156: Vim9: can use typealias in assignmentv9.0.2156Ernie Rael
Problem: Vim9: can use typealias in an assignment Solution: Generate errors when class/typealias involved in the rhs of an assignment closes: #13637 Signed-off-by: Ernie Rael <errael@raelity.com> Signed-off-by: Christian Brabandt <cb@256bit.org> Generate errors when class/typealias involved in assignment.
2023-12-08patch 9.0.2155: Vim9: type not kept when assigning varsv9.0.2155Yegappan Lakshmanan
Problem: Vim9: type not kept when assigning vars Solution: When assigning a List or a Dict value to a variable of type 'any', keep the type closes: #13639 closes: #13646 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-05patch 9.0.2152: Using type unknown for List/Dict containersv9.0.2152Yegappan Lakshmanan
Problem: Using type unknown for List/Dict containers Solution: Use 'any' instead fixes: #13582 closes: #13625 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-10-28patch 9.0.2078: several problems with type aliasesv9.0.2078Yegappan Lakshmanan
Problem: several problems with type aliases Solution: Check for more error conditions, add tests, fix issues Check for more error conditions and add additional tests fixes #13434 fixes #13437 fixes #13438 closes #13441 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-10-27patch 9.0.2076: Vim9: No support for type aliasesv9.0.2076Yegappan Lakshmanan
Problem: Vim9: No support for type aliases Solution: Implement :type command A type definition is giving a name to a type specification. This also known type alias. :type ListOfStrings = list<string> 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. closes: #13407 Signed-off-by: Christian Brabandt <cb@256bit.org> Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-21patch 9.0.2057: Vim9: no strict type checks for funcrefs varargsv9.0.2057Ernie Rael
Problem: Vim9: no strict type checks for funcrefs varargs Solution: Perform strict type checking when declaring funcrefs with vararg declaration, add tests closes: #13397 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ernie Rael <errael@raelity.com>
2023-10-17patch 9.0.2043: Vim9: issue with funcref assignmentand varargsv9.0.2043Ernie Rael
Problem: Vim9: issue with funcref assignmentand varargs Solution: Fix funcref type checking closes: #13351 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ernie Rael <errael@raelity.com>
2023-10-14patch 9.0.2019: Vim9: no support for funcrefsv9.0.2019Yegappan Lakshmanan
Problem: Vim9: no support for funcrefs Solution: Add support for object/class funcref members closes: #11981 #12417 #12960 #12324 #13333 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-09patch 9.0.2007: Vim9: covariant parameter types allowedv9.0.2007Yegappan Lakshmanan
Problem: Vim9: covariant parameter types allowed when assigning functions Solution: Enforce invariant type check for arguments and return value when assigning a funcref closes: #13299 closes: #13305 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-02patch 9.0.1974: vim9: using contra-variant type-checksv9.0.1974Yegappan Lakshmanan
Problem: vim9: using contra-variant type-checks (after v9.0.1959) Solution: Use invariant type checking instead closes: #13248 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-09-29patch 9.0.1959: Vim9: methods parameters and types are covariantv9.0.1959Yegappan Lakshmanan
Problem: Vim9: methods parameters and types are covariant Solution: Support contra-variant type check for object method arguments (similar to Dart). closes: #12965 closes: #13221 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-09-24patch 9.0.1935: Vim9: not consistent error messagesv9.0.1935RestorerZ
Problem: Vim9: not consistent error messages Solution: Make error messages more consistent. Use "variable" for (object/class) member closes: #13155 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: RestorerZ <restorer@mail2k.ru>
2023-09-09patch 9.0.1886: Various Typosv9.0.1886Christian Brabandt
Problem: Various Typos Solution: Fix Typos This is a collection of typo related commits. closes: #12753 closes: #13016 Co-authored-by: Adri Verhoef <a3@a3.xs4all.nl> Co-authored-by: zeertzjq <zeertzjq@outlook.com> Co-authored-by: Viktor Szépe <viktor@szepe.net> Co-authored-by: nuid64 <lvkuzvesov@proton.me> Co-authored-by: Meng Xiangzhuo <aumo@foxmail.com> Co-authored-by: Dominique Pellé <dominique.pelle@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-08-27patch 9.0.1796: Vim9 problems with null_objectsv9.0.1796Ernie Rael
Problem: Vim9 problems with null_objects Solution: Vim9 improve null_object usage Fix "xvar == null", where xvar might have been assigned null_object. Fix compilation failure: "var o2: C = null_object". closes: #12890 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ernie Rael <errael@raelity.com>
2023-08-23patch 9.0.1786: Vim9: need instanceof() functionv9.0.1786LemonBoy
Problem: Vim9: need instanceof() function Solution: Implement instanceof() builtin Implemented in the same form as Python's isinstance because it allows for checking multiple class types at the same time. closes: #12867 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: LemonBoy <thatlemon@gmail.com>
2023-08-20patch 9.0.1775: Wrong comparison in vim9type.cv9.0.1775Johan Mattsson
Problem: Wrong comparison in vim9type.c Solution: Change condition to false closes: #12047 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Johan Mattsson <39247600+mjunix@users.noreply.github.com>
2023-08-19patch 9.0.1754: still Ci breakage (after 9.0.1741)v9.0.1754LemonBoy
Problem: still ci breakage (after 9.0.1741) Solution: fix remaining issue Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: LemonBoy <thatlemon@gmail.com>
2023-08-19patch 9.0.1741: No type checking in interfacesv9.0.1741LemonBoy
Problem: No type checking in interfaces Solution: Implement member type check in vim9 interfaces Most of the code is a small refactoring to allow the use of a where_T for signaling the type mismatch, the type checking itself is pretty simple. Improve where_T error reports Let the caller explicitly define the kind of location it's referring to and free the WT_ARGUMENT enum from its catch-all role. Implement type checking for interface methods Follows closely the logic used for type-checking the members. closes: #12844 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: LemonBoy <thatlemon@gmail.com>
2023-05-15patch 9.0.1559: function argument types not always checkedv9.0.1559Bram Moolenaar
Problem: Function argument types not always checked and using v:none may cause an error. Solution: Check argument types once the function type is known. Do not give an error for using v:none as an argument. (closes #12200)
2023-03-07patch 9.0.1390: FOR_ALL_ macros are defined in an unexpected filev9.0.1390Yegappan Lakshmanan
Problem: FOR_ALL_ macros are defined in an unexpected file. Solution: Move FOR_ALL_ macros to macros.h. Add FOR_ALL_HASHTAB_ITEMS. (Yegappan Lakshmanan, closes #12109)
2023-02-21patch 9.0.1334: using tt_member for the class leads to mistakesv9.0.1334Bram Moolenaar
Problem: Using tt_member for the class leads to mistakes. Solution: Add a separate tt_class field.
2023-02-18patch 9.0.1320: checking the type of a null object causes a crashv9.0.1320Bram Moolenaar
Problem: Checking the type of a null object causes a crash. Solution: Don't try to get the class of a null object. (closes #12005) Handle error from calling a user function better.
2023-01-26patch 9.0.1246: code is indented more than necessaryv9.0.1246Yegappan Lakshmanan
Problem: Code is indented more than necessary. Solution: Use an early return where it makes sense. (Yegappan Lakshmanan, closes #11887)
2023-01-20patch 9.0.1224: cannot call a :def function with a number for float argumentv9.0.1224Bram Moolenaar
Problem: Cannot call a :def function with a number for a float argument. Solution: Accept a number as well, convert it to a float.
2023-01-16patch 9.0.1207: error when object type is expected but getting "any"v9.0.1207Bram Moolenaar
Problem: Error when object type is expected but getting "any". Solution: When actual type is "any" use a runtime type check. (closes #11826)
2023-01-15patch 9.0.1203: return type of values() is always list<any>v9.0.1203Bram Moolenaar
Problem: Return type of values() is always list<any>. Solution: Use the member type if possible. (issue #11822)
2023-01-15patch 9.0.1202: crash when iterating over list of objectsv9.0.1202Bram Moolenaar
Problem: Crash when iterating over list of objects. Solution: Do not make a copy of tt_member for object or class. (closes #11823)
2023-01-12patch 9.0.1187: test for using imported class failsv9.0.1187Bram Moolenaar
Problem: Test for using imported class fails. Solution: Skip over rest of type.
2023-01-12patch 9.0.1185: using class from imported script not testedv9.0.1185Bram Moolenaar
Problem: Using class from imported script not tested. Solution: Add tests. Implement what is missing.
2023-01-12patch 9.0.1184: interface of an object is not recognized when checking typev9.0.1184Bram Moolenaar
Problem: Interface of an object is not recognized when checking type. Solution: Use the interface implemented by an object.
2023-01-11patch 9.0.1181: class inheritance and typing insufficiently testedv9.0.1181Bram Moolenaar
Problem: Class inheritance and typing insufficiently tested. Solution: Add more tests. Implement missing behavior.
2023-01-09patch 9.0.1163: compiler warning for implicit size_t/int conversionv9.0.1163Mike Williams
Problem: Compiler warning for implicit size_t/int conversion. Solution: Add a type cast. (Mike Williams, closes #11795)
2023-01-07patch 9.0.1156: tests fail because of a different error messagev9.0.1156Bram Moolenaar
Problem: Tests fail because of a different error message. Solution: Don't give an error if a type name can't be found.
2023-01-07patch 9.0.1155: cannot use a class as a typev9.0.1155Bram Moolenaar
Problem: Cannot use a class as a type. Solution: Accept a class and interface name as a type.
2023-01-03patch 9.0.1139: cannot create a new object in a compiled functionv9.0.1139Bram Moolenaar
Problem: Cannot create a new object in a compiled function. Solution: Compile the instructins to create a new object.
2023-01-03patch 9.0.1138: crash when expecting varargs but it is something elsev9.0.1138Bram Moolenaar
Problem: Crash when expecting varargs but it is something else. Solution: Only use the member when the type is a list. (closes #11774)
2022-12-29patch 9.0.1108: type error when using "any" type and adding to floatv9.0.1108Bram Moolenaar
Problem: Type error when using "any" type and adding a number to a float. Solution: Accept both a number and a float. (closes #11753)
2022-12-27patch 9.0.1104: invalid memory access when checking function argument typesv9.0.1104Bram Moolenaar
Problem: Invalid memory access when checking function argument types. Solution: Do not check beyond the number of arguments. (closes #11755)
2022-12-13patch 9.0.1054: object member can't get type from initializerv9.0.1054Bram Moolenaar
Problem: Object member can't get type from initializer. Solution: If there is no type specified try to use the type of the initializer. Check for a valid type.
2022-12-13patch 9.0.1052: using freed memory on exit when EXITFREE is definedv9.0.1052Bram Moolenaar
Problem: Using freed memory on exit when EXITFREE is defined. Solution: Make a deep copy of the type. Make sure TTFLAG_STATIC is not set in the copy.
2022-12-12patch 9.0.1050: using freed memory when assigning to variable twicev9.0.1050Bram Moolenaar
Problem: Using freed memory when assigning to variable twice. Solution: Make copy of the list type. (closes #11691)
2022-12-09patch 9.0.1041: cannot define a method in a classv9.0.1041Bram Moolenaar
Problem: Cannot define a method in a class. Solution: Implement defining an object method. Make calling an object method work.
2022-12-08patch 9.0.1031: Vim9 class is not implemented yetv9.0.1031Bram Moolenaar
Problem: Vim9 class is not implemented yet. Solution: Add very basic class support.
2022-10-09patch 9.0.0703: failing check for argument type for const anyv9.0.0703Bram Moolenaar
Problem: Failing check for argument type for const any. Solution: Check for any type properly. (closes #11316)
2022-09-30patch 9.0.0628: Coverity warns for not checking return valuev9.0.0628Bram Moolenaar
Problem: Coverity warns for not checking return value. Solution: Check the return value and simplify the code.