summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_vim9_class.vim
AgeCommit message (Collapse)Author
2024-04-04patch 9.1.0263: Vim9: Problem with lambda blocks in enums and classesv9.1.0263Yegappan Lakshmanan
Problem: Vim9: Problem with lambda blocks in enums and classes (Aliaksei Budavei) Solution: Support evaluating lambda blocks from a string, skip over comments (Yegappan Lakshmanan) fixes: #14350 closes: #14405 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-04patch 9.1.0261: Vim9: protected class and funcrefs accessible outside the classv9.1.0261Yegappan Lakshmanan
Problem: Vim9: protected class and funcrefs accessible outside the class (Aliaksei Budavei) Solution: Check if class and object funcrefs are protected (Yegappan) closes: #14407 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-02patch 9.1.0257: Vim9: :call may not find imported class membersv9.1.0257Yegappan Lakshmanan
Problem: Vim9: :call may not find imported class members (mityu) Solution: Set the typval of an imported lval variable correctly (Yegappan Lakshmanan) fixes: #14334 closes: #14386 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-02patch 9.1.0255: Vim9: no indication of script nr in stack trace of classesv9.1.0255Ernie Rael
Problem: Vim9: no indication of script nr in stack trace of classes Solution: Prefix the class name with the script name in the stack trace. (Ernie Rael) fixes: #14376 closes: #14390 Signed-off-by: Ernie Rael <errael@raelity.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-01patch 9.1.0252: Vim9: segfault with static in super classv9.1.0252Yegappan Lakshmanan
Problem: Vim9: segfault with static in super class (Ernie Rael) Solution: When initializing lhs, use the correct class where a class variable is defined (Yegappan Lakshmanan) fixes: #14352 closes: #14372 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
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>
2024-03-22patch 9.1.0198: Vim9: compound operators broken for lambdas in an objectv9.1.0198Yegappan Lakshmanan
Problem: Vim9: compound operators broken for lambdas in an object (girishji) Solution: When using an object from the outer scope, use the LOADOUTER instruction to load the object (Yegappan Lakshmanan). fixes: #14236 closes: #14266 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-09patch 9.1.0160: Vim9: Add support for using a class type of itself in an ↵v9.1.0160Yegappan Lakshmanan
object method Problem: Add support for using a class type of itself in an object method (thinca) Solution: Vim9: Add support for using a class type of itself in an object method (Yegappan Lakshmanan) fixes: #12369 closes: #14165 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-03patch 9.1.0148: Vim9: can't call internal methods with objectsv9.1.0148Yegappan Lakshmanan
Problem: Vim9: can't call internal methods with objects Solution: Add support for empty(), len() and string() function calls for objects (Yegappan Lakshmanan) closes: #14129 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-13patch 9.1.0105: Style: typos foundv9.1.0105zeertzjq
Problem: Style: typos found Solution: correct them (zeertzjq) closes: #14023 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-12patch 9.1.0020: Vim9: cannot compile all methods in a classv9.1.0020Yegappan Lakshmanan
Problem: Vim9: cannot compile all methods in a class Solution: Support compiling all the methods in a class using :defcompile (Yegappan Lakshmanan) closes: #13844 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-21patch 9.0.2182: Vim9: need a way to reserve future extensionv9.0.2182Yegappan Lakshmanan
Problem: Vim9: need a way to reserve future extension Solution: reserve double underscore prefix for future use (Yegappan Lakshmanan) related: #13238 closes: #13742 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-16patch 9.0.2170: Vim9: no support for const/final class/objects varsv9.0.2170Yegappan Lakshmanan
Problem: Vim9: no support for const/final class/objects vars Solution: Support final and const object and class variables closes: #13655 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-14patch 9.0.2167: Vim9: not consistently using :var for declarationsv9.0.2167Doug Kearns
Problem: Vim9-script object/class variable declarations use syntax that is inconsistent with the rest of the language. Solution: Use :var to declare object and class variables. closes: #13670 Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-14patch 9.0.2164: Vim9: can use type a func arg/return valuev9.0.2164Ernie Rael
Problem: Vim9: can use type a func arg/return value Solution: Check if using type as function argument or return value closes: #13675 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-14patch 9.0.2161: Vim9: not able to use imported interfaces and classesv9.0.2161Yegappan Lakshmanan
Problem: Vim9: not able to use imported interfaces and classes Solution: Detect imported class/interfaces names correclty fixes: #13661 closes: #13685 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-12patch 9.0.2160: instanceof() should use varargs as second argv9.0.2160Ernie Rael
Problem: instanceof() should use varargs as second arg Solution: Modify `instanceof()` to use varargs instead of list Modify `instanceof()` to use varargs instead of list Valid `instanceof()` arguments are `type`s. A `type` is not a value; it cannot be added to a list. This change is non-compatible with the current usage of instanceof; but instanceof is relatively new and it's a trivial change. fixes: #13421 closes: #13644 Signed-off-by: Ernie Rael <errael@raelity.com> 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-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-11-25patch 9.0.2129: [security]: use-after-free in call_dfunc()v9.0.2129mityu
Problem: [security]: use-after-free in call_dfunc() Solution: Refresh dfunc pointer closes: #13571 This Commit fixes a SEGV caused by a use-after-free bug in call_dfunc(). When calling check_ufunc_arg_types() from the call_dfunc() it may cause def functions to be re-compiled and if there are too many def functions, the def_functions array will be re-allocated. Which means, that the dfunc pointer in call_dfunc() now starts pointing to freed memory. So we need to reset the dfunc pointer after calling check_ufunc_arg_types(). Let's also add a test, to ensure we do not regress. Signed-off-by: mityu <mityu.mail@gmail.com> Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-11-11patch 9.0.2096: Vim9: confusing usage of privatev9.0.2096Ernie Rael
Problem: Vim9: confusing usage of private Solution: clarify and use protected keyword instead [vim9class] document `_` as protected instead of private fixes #13504 closes: #13520 Signed-off-by: Ernie Rael <errael@raelity.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-11-04patch 9.0.2088: Vim9: still allows abstract static methodsv9.0.2088Yegappan Lakshmanan
Problem: Vim9: still allows abstract static methods (after v9.0.2084, v9.0.2085 and v9.0.2087) Solution: Disallow abstract static methods closes: #13479 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-11-02patch 9.0.2087: build-failure in vim9classv9.0.2087Christian Brabandt
Problem: build-failure in vim9class Solution: reference correct error message, disable non-failing test closes: #13476 closes: #13477 Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-11-02patch 9.0.2085: Vim9: abstract can be used in interfacev9.0.2085Yegappan Lakshmanan
Problem: Vim9: abstract can be used in interface Solution: Disallow the use of abstract in an interface fixes: #13456 closes: #13464 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-11-02patch 9.0.2084: Vim9: abstract static methods are possiblev9.0.2084Yegappan Lakshmanan
Problem: Vim9: abstract static methods are possible Solution: Disallow abstract static methods fixes: #13462 closes: #13466 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-26patch 9.0.2072: Vim9: no nr2str conversion in list-unpackv9.0.2072Yegappan Lakshmanan
Problem: Vim9: no nr2str conversion in list-unpack Solution: Generate 2STRING instruction to convert dict index to string Generate instruction to convert dict index to a string fixes: #13417 closes: #13424 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-21patch 9.0.2059: outstanding exceptions may be skippedv9.0.2059Yegappan Lakshmanan
Problem: outstanding exceptions may be skipped Solution: When restoring exception state, process remaining outstanding exceptions closes: #13386 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-20patch 9.0.2055: Vim9: non-consistent error messagesv9.0.2055Ernie Rael
Problem: Vim9: non-consistent error messages Solution: make error messages more consistent with common structure Adjust vim9class messages to follow common pattern. [Variable|Method] "var-or-meth-name" ... class "class-name" closes: #13391 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ernie Rael <errael@raelity.com>
2023-10-19patch 9.0.2051: Vim9: wrong error for non-existing object varv9.0.2051Yegappan Lakshmanan
Problem: Vim9: wrong error for non-existing object var Solution: mention object or class depending on whether the var is an object or class variable. closes: #13384 closes: #13387 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-19patch 9.0.2049: Vim9: not recognizing qualified class vars for infix opsv9.0.2049Yegappan Lakshmanan
Problem: Vim9: not recognizing qualified class vars for infix ops Solution: Drop the class type from the stack before generating the CLASSMEMBER instruction closes: #13378 closes: #13379 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.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-17patch 9.0.2038: Vim9: object method funcref not cleaned up after usev9.0.2038Yegappan Lakshmanan
Problem: Vim9: object method funcref not cleaned up after use Solution: Clean up type stack after using object method funcref, remove now longer used ISN_DEFEROBJ instrunction closes: #13360 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-15patch 9.0.2029: Vim9: no support for partials using call()v9.0.2029Yegappan Lakshmanan
Problem: Vim9: no support for partials using call() Solution: Add support closes: #13341 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.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-11patch 9.0.2016: Vim9: assignment operators don't work for class varsv9.0.2016Yegappan Lakshmanan
Problem: Vim9: assignment operators don't work for class vars Solution: implement it closes: #13306 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-11patch 9.0.2015: Vim9: does not handle islocked() from a method correctlyv9.0.2015Ernie Rael
Problem: Vim9: does not handle islocked() from a method correctly Solution: Handle islocked() builtin from a method. - Setup `lval_root` from `f_islocked()`. - Add function `fill_exec_lval_root()` to get info about executing method. - `sync_root` added in get_lval to handle method member access. - Conservative approach to reference counting. closes: #13309 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ernie Rael <errael@raelity.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-08patch 9.0.2002: Vim9: need cleanup of class related interface codev9.0.2002Yegappan Lakshmanan
Problem: Vim9: need cleanup of class related interface code Solution: Remove the unused class variable and class method related code for interfaces. Remove unused class variable and class method related code for interfaces. Refactor the code. Optimize the object/class member double lookup in compile_lhs(). Change unused global functions to static functions. closes: #13302 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-07patch 9.0.2001: Vim9: segfault with islocked()v9.0.2001Ernie Rael
Problem: Vim9: segfault with islocked() Solution: Check that the lval pointer is not null for objects and class variables closes: #13295 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ernie Rael <errael@raelity.com>
2023-10-07patch 9.0.2000: Vim9: use-after-free in deep call stackv9.0.2000Yegappan Lakshmanan
Problem: Vim9: use-after-free in deep call stack Solution: Get the objct pointer from execution stack closes: #13296 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-06patch 9.0.1999: Vim9: some error messages can be improvedv9.0.1999Ernie Rael
Problem: Vim9: some error messages can be improved Solution: Mention the defining class for variable access error message closes: #13272 Signed-off-by: Christian Brabandt <cb@256bit.org> Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Co-authored-by: Ernie Rael <errael@raelity.com>
2023-10-05patch 9.0.1988: Vim9: potential use-after-free for class membersv9.0.1988Yegappan Lakshmanan
Problem: Vim9: potential use-after-free for class members Solution: Use the class-related grow array for storing the member type instead of using a temporary type list grow array Use the type list grow array associated with the class than using a temporary type list grow array to allocate the class member type. For simple types, a predefined type is used. For complex types, the type is dynamically allocated from a grow array. For class variables, the type grow array in the class should be used. So that the lifetime of the type is same as the lifetime of the class. closes: #13279 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-10-04patch 9.0.1982: vim9: clean up from v9.0.1955v9.0.1982Ernie Rael
Problem: vim9: clean up from v9.0.1955 Solution: Fix a few remaining issues, improve error message - Use `cl_exec`, the executing class, to check permissions in `get_lval()`. - Handle lockvar of script variable from class. - Add 'in class "Xxx"' to e_cannot_access_private_variable_str. closes: #13222 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ernie Rael <errael@raelity.com>
2023-10-04patch 9.0.1977: Vim9: object members can change typev9.0.1977Yegappan Lakshmanan
Problem: Vim9: object members can change type Solution: Check type during assignment to object/class var closes: #13127 closes: #13262 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-29patch 9.0.1955: Vim9: lockvar issues with objects/classesv9.0.1955Ernie Rael
Problem: Vim9: lockvar issues with objects/classes Solution: fix `get_lhs()` object/class access and avoid `SEGV`, make error messages more accurate. - `get_lval()` detects/returns object/class access - `compile_lock_unlock()` generate code for bare static and obj_arg access - `do_lock_var()` check lval for `ll_object`/`ll_class` and fail if so. Details: - Add `ll_object`/`ll_class`/`ll_oi` to `lval_T`. - Add `lockunlock_T` to `isn_T` for `is_arg` to specify handling of `lval_root` in `get_lval()`. - In `get_lval()`, fill in `ll_object`/`ll_class`/`ll_oi` as needed; when no `[idx] or .key`, check lval_root on the way out. - In `do_lock_var()` check for `ll_object`/`ll_class`; also bullet proof ll_dict case and give `Dictionay required` if problem. (not needed to avoid lockvar crash anymore) - In `compile_lock_unlock()` compile for the class variable and func arg cases. closes: #13174 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ernie Rael <errael@raelity.com>