0
0
mirror of https://github.com/vim/vim.git synced 2025-07-04 23:07:33 -04:00

130 Commits

Author SHA1 Message Date
Ernie Rael
8625714ac1
patch 9.1.0515: Vim9: segfault in object_equal()
Problem:  Vim9: segfault in object_equal()
Solution: test for object pointer being NULL, before dereferencing them
          (Ernie Rael)

closes: #15085

Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-06-23 09:54:45 +02:00
LemonBoy
7b29cc97d6
patch 9.1.0514: Vim9: issue with comparing objects recursively
Problem:  Vim9: issue with comparing objects recursively
          (Yinzuo Jiang)
Solution: only set recursive == TRUE, when called from tv_equal(), not
          from typeval_compare_object(), refactor code into object_equal()
          function (LemonBoy)

The recursive flag in tv_equal should be set only when the caller is
tv_equal, meaning that the comparison depth is > 1. The comparison
predicates for other object types are all following this rule, except
for the object one, and that may cause some weird issues like causing
the max depth limit not to be initialized in some cases.

closes: #15076

Signed-off-by: LemonBoy <thatlemon@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-06-22 17:25:07 +02:00
Yegappan Lakshmanan
22029edb6c
patch 9.1.0422: function echo_string_core() is too long
Problem:  function echo_string_core() is too long
Solution: Refactor into several smaller functions
          (Yegappan Lakshmanan)

closes: #14804

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-05-20 13:57:11 +02:00
Yegappan Lakshmanan
fe55c31752
patch 9.1.0378: Vim9: no comments allowed after class vars
Problem:  Vim9: no comments allowed after class vars
          (Christian Robinson, after 9.1.376)
Solution: Allow trailing comments after class vars
          (Yegappan Lakshmanan)

closes: #14651

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-28 09:54:09 +02:00
Yegappan Lakshmanan
ac7731895c
patch 9.1.0376: Vim9: Trailing commands after class/enum keywords ignored
Problem:  Vim9: Trailing commands after class/enum keywords ignored
Solution: Remove EX_TRLBAR keyword from command definition
          (Yegappan Lakshmanan)

closes: #14649

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-27 11:48:26 +02:00
Yegappan Lakshmanan
c51578fed8
patch 9.1.0314: Vim9: Can define a class in a function
Problem:  Vim9: Can define a class in a function
          (Doug Kearns)
Solution: Give an error for a class defined in a function,
          slightly reword some public error messages
          (Yegappan Lakshmanan)

fixes: #13184
fixes: #13326
closes: #14537

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-13 18:04:53 +02:00
Yegappan Lakshmanan
1af0fbf955
patch 9.1.0286: Vim9: E1027 with defcompile for abstract methods
Problem:  Vim9: E1027 with defcompile for abstract methods with
          non-void return types, but still compiles it
          (zzzyxwvut)
Solution: Don't compile abstract methods
          (Yegappan Lakshmanan)

fixes: #14443
closes: #14447

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-09 21:39:27 +02:00
Yegappan Lakshmanan
3e33650b3a
patch 9.1.0261: Vim9: protected class and funcrefs accessible outside the class
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-04 19:35:59 +02:00
Yegappan Lakshmanan
3cf121ed31
patch 9.1.0233: Vim9: string() output of enum is problematic
Problem:  Vim9: string() output of enum is problematic
Solution: Make string() output for an enum consistent with that of a
          regular object (Yegappan Lakshmanan).

closes: #14343

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-31 18:45:35 +02:00
Yegappan Lakshmanan
abedca96ef
patch 9.1.0226: Not able to assign enum values to an enum static variable
Problem:  Not able to assign enum values to an enum static variable
          (zzzyxwvut)
Solution: Make it work
          (Yegappan Lakshmanan)

related: #14224
closes: #14329

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-29 10:08:23 +01:00
zeertzjq
c029c131ea
patch 9.1.0220: Few typos in source and test files
Problem:  Typos in code and tests.
Solution: Fix typos (zeertzjq).

closes: #14321

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-28 11:37:26 +01:00
Yegappan Lakshmanan
3164cf8f12
patch 9.1.0219: Vim9: No enum support
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-28 10:38:28 +01:00
Yegappan Lakshmanan
35b867b685
patch 9.1.0160: Vim9: Add support for using a class type of itself in an 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-09 15:44:19 +01:00
Yegappan Lakshmanan
d3eae7bc11
patch 9.1.0148: Vim9: can't call internal methods with objects
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-03-03 16:34:51 +01:00
Yegappan Lakshmanan
4f32c83a77
patch 9.1.0020: Vim9: cannot compile all methods in a class
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>
2024-01-12 17:41:09 +01:00
Yegappan Lakshmanan
ff6f0d5c38
patch 9.0.2182: Vim9: need a way to reserve future extension
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-21 16:46:18 +01:00
Zoltan Arpadffy
6fdb628082
patch 9.0.2180: POSIX function name in exarg causes issues
Problem:  POSIX function name in exarg struct causes issues
          on OpenVMS
Solution: Rename getline member in exarg struct to ea_getline,
          remove isinf() workaround for VMS

There are compilers that do not treat well POSIX functions - like
getline - usage in the structs.

Older VMS compilers could digest this... but the newer OpenVMS compilers
( like VSI C x86-64 X7.4-843 (GEM 50XB9) ) cannot deal with these
structs. This could be limited to getline() that is defined via
getdelim() and might not affect all POSIX functions in general - but
avoiding POSIX function names usage in the structs is a "safe side"
practice without compromising the functionality or the code readability.

The previous OpenVMS X86 port used a workaround limiting the compiler
capabilities using __CRTL_VER_OVERRIDE=80400000
In order to make the OpenVMS port future proof, this pull request
proposes a possible solution.

closes: #13704

Signed-off-by: Zoltan Arpadffy <zoltan.arpadffy@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-19 20:53:07 +01:00
Yegappan Lakshmanan
e5437c5427
patch 9.0.2170: Vim9: no support for const/final class/objects vars
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-16 14:11:19 +01:00
Doug Kearns
74da0ee0a2
patch 9.0.2167: Vim9: not consistently using :var for declarations
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-14 20:26:26 +01:00
Ernie Rael
b077b58809
patch 9.0.2164: Vim9: can use type a func arg/return value
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-14 20:14:13 +01:00
Yegappan Lakshmanan
d2e1c83962
patch 9.0.2161: Vim9: not able to use imported interfaces and classes
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-14 19:59:45 +01:00
Ernie Rael
2025af165e
patch 9.0.2160: instanceof() should use varargs as second arg
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-12 16:58:00 +01:00
Christian Brabandt
6b36645f07
patch 9.0.2119: remove dead-condition in ex_class
Problem:  remove dead-condition in ex_class()
Solution: remove the extra condition

The variable is_class must be true once we reach the

,----
| else if (has_static)
`----

in line 1750, because we break out earlier if is_class is false in line
1598 of vim9class.c. And once 'has_static = TRUE', we must be in a
class and there fore is_class is true.

Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-11-21 19:57:05 +01:00
Ernie Rael
03042a2753
patch 9.0.2096: Vim9: confusing usage of private
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-11 08:53:32 +01:00
Yegappan Lakshmanan
5a53925a6e
patch 9.0.2088: Vim9: still allows abstract static methods
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-04 09:42:46 +01:00
Christian Brabandt
33c1da7ff4
patch 9.0.2087: build-failure in vim9class
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-02 22:45:12 +01:00
Yegappan Lakshmanan
2b358adde0
patch 9.0.2085: Vim9: abstract can be used in interface
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-02 20:58:58 +01:00
Yegappan Lakshmanan
ef9e3f8924
patch 9.0.2084: Vim9: abstract static methods are possible
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-11-02 20:43:57 +01:00
Yegappan Lakshmanan
feaccd2395
patch 9.0.2078: several problems with type aliases
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-28 15:53:55 +02:00
Yegappan Lakshmanan
ec3cebbd2b
patch 9.0.2076: Vim9: No support for type aliases
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-27 19:35:26 +02:00
Yegappan Lakshmanan
0ab500dede
patch 9.0.2059: outstanding exceptions may be skipped
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-21 11:59:42 +02:00
Ernie Rael
d4802ec485
patch 9.0.2055: Vim9: non-consistent error messages
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-20 11:59:00 +02:00
Yegappan Lakshmanan
00b55370b3
patch 9.0.2051: Vim9: wrong error for non-existing object var
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-19 17:18:28 +02:00
Yegappan Lakshmanan
29bb67f1be
patch 9.0.2019: Vim9: no support for funcrefs
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-14 11:18:50 +02:00
Yegappan Lakshmanan
1ea428883f
patch 9.0.2016: Vim9: assignment operators don't work for class vars
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-11 21:43:52 +02:00
Yegappan Lakshmanan
b852305dbf
patch 9.0.2002: Vim9: need cleanup of class related interface code
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-08 19:07:39 +02:00
Ernie Rael
e6c9aa5e6a
patch 9.0.1999: Vim9: some error messages can be improved
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-06 19:55:52 +02:00
Ernie Rael
d615a3122a
patch 9.0.1989: Vim9: double error message given
Problem:  Vim9: double error message given
Solution: Only give second error message, if ther
          wasn't one given before

closes: #13278

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Ernie Rael <errael@raelity.com>
2023-10-05 20:28:16 +02:00
Yegappan Lakshmanan
d2f4800099
patch 9.0.1988: Vim9: potential use-after-free for class members
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-05 20:24:18 +02:00
Ernie Rael
64885645e7
patch 9.0.1982: vim9: clean up from v9.0.1955
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-04 20:16:22 +02:00
Yegappan Lakshmanan
fe7b20a1a3
patch 9.0.1977: Vim9: object members can change type
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-04 19:47:52 +02:00
Yegappan Lakshmanan
b32064fedb
patch 9.0.1974: vim9: using contra-variant type-checks
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-10-02 21:43:58 +02:00
Yegappan Lakshmanan
f3b68d4759
patch 9.0.1959: Vim9: methods parameters and types are covariant
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-29 22:50:02 +02:00
Yegappan Lakshmanan
5a05d374d3
patch 9.0.1952: Vim9: unused static field
Problem:  Vim9: unused static field
Solution: remove it and simplify code

closes: #13220

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-09-29 19:44:25 +02:00
Yegappan Lakshmanan
b90e3bc491
patch 9.0.1951: Vim9: hard to debug vim9_class errors from CI
Problem:  Vim9: hard to debug vim9_class errors from CI
Solution: Include the line number in assert_xxx() calls.  Include the
          entire error message in the tests.  Fix the indentation in the
          test file.  Add tags for new error codes.

closes: #13206

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-09-28 23:16:35 +02:00
Yegappan Lakshmanan
f057aca1cc
patch 9.0.1949: Vim9: allows reserved keywords as members
Problem:  Vim9: allows reserved keywords as members
Solution: Disallow reserved keywords, disallow
          duplicate object and class variables

closes: #13209

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-09-28 22:28:15 +02:00
Yegappan Lakshmanan
2dede3dbfa
patch 9.0.1945: Vim9: missing support for ro-vars in interface
Problem:  Vim9: missing support for ro-vars in interface
Solution: Support only read-only object variables in an interface,
          add additional checks when parsing class definitions.

closes: #13183
cloess: #13184
cloess: #13185.
closes: #13188

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-09-27 19:02:01 +02:00
RestorerZ
7fe8f43f49
patch 9.0.1935: Vim9: not consistent error messages
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-24 23:21:24 +02:00
h-east
b895b0fabc
patch 9.0.1928: Vim9: constructor type checking bug
Problem:  Vim9: constructor type checking bug
Solution: Fix class constructor regression

closes: #13102
closes: #13113

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: h-east <h.east.727@gmail.com>
2023-09-24 15:46:31 +02:00
Yegappan Lakshmanan
1db1514365
patch 9.0.1914: Vim9: few issues when accessing object members
Problem:  Vim9: few issues when accessing object members
Solution: When calling an object method, check for null object.
          Accessing a Dict object member doesn't work.

closes: #13119
closes: #13123
closes: #13124

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
2023-09-19 20:36:02 +02:00