LemonBoy
c5d2744c04
patch 9.0.1741: No type checking in interfaces
...
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-08-19 13:04:53 +02:00
Yegappan Lakshmanan
b102728c20
patch 9.0.1737: Calling a base class method through an extended class fails
...
Problem: Calling a base class method through an extended class fails
Solution: Create lookup table for member index in the interface to
to the member class implementing the interface
Create additional tests for Vim9 classes. Fix unconvered memory leaks
and crashes found by the new tests.
closes : #12848
closes : #12089
Signed-off-by: Christian Brabandt <cb@256bit.org >
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com >author
2023-08-19 11:26:42 +02:00
h-east
2261c89a49
patch 9.0.1724: vim9class constructor argument type checking bug
...
Problem: vim9class constructor argument type checking bug
Solution: fix it
closes : #12816
Signed-off-by: Christian Brabandt <cb@256bit.org >
Co-authored-by: h-east <h.east.727@gmail.com >
2023-08-17 22:31:10 +02:00
Yegappan Lakshmanan
a456b12011
patch 9.0.1720: Vim9 class using wrong index for overridden method
...
Problem: Vim9 class using wrong index for overridden method
Solution: Use correct index for overridden method
closes : #12524
closes : #12813
Signed-off-by: Christian Brabandt <cb@256bit.org >
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com >
2023-08-16 20:14:37 +02:00
Yegappan Lakshmanan
74cc13cc40
patch 9.0.1703: Vim9 Calling a method in an extended class fails
...
Problem: Vim9 Calling a method in an extended class fails
Solution: use method index directly
closes : #12778
Signed-off-by: Christian Brabandt <cb@256bit.org >
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com >
2023-08-13 17:41:26 +02:00
Yegappan Lakshmanan
57a02ccf4c
patch 9.0.1701: vim9 crash when class member overridden
...
Problem: vim9 crash when class member overridden
Solution: Use method_count field instead
closes : #12676
closes : #12677
Signed-off-by: Christian Brabandt <cb@256bit.org >
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com >
2023-08-13 10:19:38 +02:00
Bram Moolenaar
4e2406c7a9
patch 9.0.1662: crash when using a class member twice
...
Problem: Crash when using a class member twice. (Christian J. Robinson)
Solution: Make a copy of the value.
2023-06-24 19:22:21 +01:00
Bram Moolenaar
5ca05fa59e
patch 9.0.1624: crash when calling object constructor
...
Problem: Crash when calling object constructor from legacy script. (Israel
Chauca Fuentes)
Solution: Pass a pointer for "ufunc". (closes #12502 )
2023-06-10 16:45:13 +01:00
Bram Moolenaar
f7ca56f719
patch 9.0.1609: crash when an object indirectly references itself
...
Problem: Crash when an object indirectly references itself.
Solution: Avoid clearing an object while it is already being cleared.
(closes #12494 )
2023-06-05 16:53:25 +01:00
Ernie Rael
114ec813b3
patch 9.0.1605: crash when calling method on super in child constructor
...
Problem: Crash when calling method on super in child constructor. (Israel
Chauca Fuentes)
Solution: Clear the type list. (Ernie Rael, closes #12489 , closes #12471 )
2023-06-04 18:11:35 +01:00
h-east
2bd6a09691
patch 9.0.1569: cannot use "this.member" in lambda in class method
...
Problem: Cannot use "this.member" in lambda in class method.
Solution: Adjust check for reserved keyword. (Hirohito Higashi,
closes #12416 , closes #12076 , closes #12336 )
2023-05-19 19:01:17 +01:00
Bram Moolenaar
22363c6994
patch 9.0.1483: += operator does not work on class member
...
Problem: += operator does not work on class member.
Solution: Do not skip as if "this." was used. (Christian Brabandt,
closes #12263 )
2023-04-24 17:15:25 +01:00
h-east
61378a1542
patch 9.0.1466: cannot use an object member name as a method argument
...
Problem: Cannot use an object member name as a method argument.
Solution: Do not give an error for using an object member name for a method
argument. (Hirohito Higashi, closes #12241 , closes #12225 )
Fix line number for other argument error.
2023-04-18 19:07:29 +01:00
Bram Moolenaar
d13dd30240
patch 9.0.1402: crash when using null_class
...
Problem: Crash when using null_class.
Solution: Give an error when trying to use a null class.
2023-03-11 20:56:35 +00:00
Ernie Rael
f77a7f704f
patch 9.0.1375: crash when getting member of obj of unknown class
...
Problem: Crash when getting member of obj of unknown class.
Solution: Check for NULL class and give an error message. (Ernie Rael,
closes #12096 )
2023-03-03 15:05:30 +00:00
Bram Moolenaar
c3f971f289
patch 9.0.1370: crash when using a NULL object
...
Problem: Crash when using a NULL object. (Ernie Rael)
Solution: Check for NULL and give an error message. (closes #12083 )
2023-03-02 17:38:33 +00:00
Bram Moolenaar
c4e1b86cb0
patch 9.0.1357: using null_object results in an internal error
...
Problem: Using null_object results in an internal error. (Ernie Rael)
Solution: Add instructions for pushing an object and class. (closes #12044 )
2023-02-26 18:58:23 +00:00
Bram Moolenaar
83ae6150bf
patch 9.0.1355: no error when declaring a class twice
...
Problem: No error when declaring a class twice. (Ernie Rael)
Solution: Pass different flags when declaring the class. (closes #12057 )
2023-02-25 19:59:31 +00:00
Bram Moolenaar
99a7c0d89c
patch 9.0.1338: :defcompile and :disassemble can't find class method
...
Problem: :defcompile and :disassemble can't find class method. (Ernie Rael)
Solution: Make a class name and class.method name work. (closes #11984 )
2023-02-21 19:55:14 +00:00
Bram Moolenaar
2c1c803c7e
patch 9.0.1322: crash when indexing "any" which is an object
...
Problem: Crash when indexing "any" which is an object.
Solution: Check the index is a number. Do not check the member type of an
object. (closes #12019 )
2023-02-18 18:38:37 +00:00
Bram Moolenaar
0917e86763
patch 9.0.1320: checking the type of a null object causes a crash
...
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-02-18 14:42:44 +00:00
Bram Moolenaar
f2017f255d
patch 9.0.1318: code style test fails
...
Problem: Code style test fails.
Solution: Remove trailing white space.
2023-02-17 21:29:57 +00:00
Bram Moolenaar
552bdca781
patch 9.0.1317: crash when using an unset object variable
...
Problem: Crash when using an unset object variable.
Solution: Give an error instead. (closes #12005 )
2023-02-17 21:08:50 +00:00
Bram Moolenaar
094cf9f4d5
patch 9.0.1296: calling an object method with arguments does not work
...
Problem: Calling an object method with arguments does not work. (Ernie
Rael)
Solution: Take the argument count into account when looking up the object.
(closes #11911 )
2023-02-10 15:52:25 +00:00
Bram Moolenaar
313e4724c3
patch 9.0.1292: :defer may call the wrong method for an object
...
Problem: :defer may call the wrong method for an object. (Ernie Rael)
Solution: When en object is from a class that extends or implements, figure
out the method to call at runtime. (closes #11910 )
2023-02-08 20:55:27 +00:00
Bram Moolenaar
7a1bdaecf2
patch 9.0.1280: inssufficient testing for what 9.0.1265 fixes
...
Problem: Inssufficient testing for what 9.0.1265 fixes.
Solution: Add a couple of test cases. (issue #11885 )
2023-02-04 15:45:27 +00:00
Bram Moolenaar
b8bebd0cd7
patch 9.0.1265: using an interface method may give a compilation error
...
Problem: Using an interface method may give a compilation error.
Solution: Do not try to compile the body of a method of an interface.
(closes #11885 )
2023-01-30 20:24:23 +00:00
Bram Moolenaar
94722c5107
patch 9.0.1257: code style is not check in test scripts
...
Problem: Code style is not check in test scripts.
Solution: Add basic code style check for test files.
2023-01-28 19:19:03 +00:00
Bram Moolenaar
d0200c8631
patch 9.0.1254: calling a method on an interface does not work
...
Problem: Calling a method on an interface does not work.
Solution: At runtime figure out what method to call. (closes #11901 )
2023-01-28 15:19:40 +00:00
Bram Moolenaar
8dbab1d8ce
patch 9.0.1250: cannot use an object method with :defer
...
Problem: Cannot use an object method with :defer. (Ernie Rael)
Solution: Find the object method and generate code to call it.
(closes #11886 )
2023-01-27 20:14:02 +00:00
Bram Moolenaar
657aea7fc4
patch 9.0.1249: cannot export an abstract class
...
Problem: Cannot export an abstract class. (Ernie Rael)
Solution: Add the EX_EXPORT flag to :abstract. (closes #11884 )
2023-01-27 13:16:19 +00:00
Bram Moolenaar
53f54e49b7
patch 9.0.1248: cannot export an interface
...
Problem: Cannot export an interface. (Ernie Rael)
Solution: Add the EX_EXPORT flag to :interface. (closes #11884 )
2023-01-26 20:36:56 +00:00
Bram Moolenaar
62a6923470
patch 9.0.1240: cannot access a private object member in a lambda
...
Problem: Cannot access a private object member in a lambda defined inside
the class.
Solution: Go up the context stack to find the class. (closes #11866 )
2023-01-24 15:07:04 +00:00
Bram Moolenaar
b149d22796
patch 9.0.1239: cannot have a line break before an object member access
...
Problem: Cannot have a line break before an object member access.
Solution: Check for "." in next line. (closes #11864 )
2023-01-24 13:03:37 +00:00
Bram Moolenaar
486fc25a29
patch 9.0.1217: using an object member in a closure doesn't work
...
Problem: Using an object member in a closure doesn't work.
Solution: Initialize lv_loop_depth. (closes #11840 )
2023-01-18 14:51:07 +00:00
Bram Moolenaar
f7d1c6e188
patch 9.0.1211: storing value in interface member does not always work
...
Problem: Storing value in interface member does not always work.
Solution: Convert the index on the interface to the index on the object.
2023-01-16 20:47:57 +00:00
Bram Moolenaar
29ac5df37b
patch 9.0.1209: getting interface member does not always work
...
Problem: Getting interface member does not always work.
Solution: Convert the index on the interface to the index on the object.
(closes #11825 )
2023-01-16 19:43:47 +00:00
Bram Moolenaar
450c7a97d1
patch 9.0.1207: error when object type is expected but getting "any"
...
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-16 16:39:37 +00:00
Bram Moolenaar
ae3205aa55
patch 9.0.1205: crash when handling class that extends another class
...
Problem: Crash when handling class that extends another class with more
than one object members.
Solution: Correct pointer computations. (closes #11824 )
2023-01-15 20:49:00 +00:00
Bram Moolenaar
912bfee710
patch 9.0.1204: expression compiled the wrong way after using an object
...
Problem: Expression compiled the wrong way after using an object.
Solution: Generate constants before getting the type.
2023-01-15 20:18:55 +00:00
Bram Moolenaar
f450804e14
patch 9.0.1202: crash when iterating over list of objects
...
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-15 16:54:57 +00:00
Bram Moolenaar
4cae845ce3
patch 9.0.1201: assignment with operator doesn't work in object method
...
Problem: Assignment with operator doesn't work in object method.
Solution: Handle loading the object member. (closes #11820 ) Add a few more
tests.
2023-01-15 15:51:48 +00:00
Bram Moolenaar
24a8d06d7f
patch 9.0.1198: abstract class not supported yet
...
Problem: Abstract class not supported yet.
Solution: Implement abstract class and add tests.
2023-01-14 13:12:06 +00:00
Bram Moolenaar
d40f00cb43
patch 9.0.1192: no error when class function argument shadows a member
...
Problem: No error when class function argument shadows a member.
Solution: Check for shadowing.
2023-01-13 17:36:49 +00:00
Bram Moolenaar
c0c2c26265
patch 9.0.1188: return value of type() for class and object unclear
...
Problem: Return value of type() for class and object unclear.
Solution: Add v:t_object and v:t_class.
2023-01-12 21:08:53 +00:00
Bram Moolenaar
4059400993
patch 9.0.1186: imported class does not work when used twice in a line
...
Problem: Imported class does not work when used twice in a line.
Solution: Fix the type parsing.
2023-01-12 20:04:51 +00:00
Bram Moolenaar
a86655af84
patch 9.0.1185: using class from imported script not tested
...
Problem: Using class from imported script not tested.
Solution: Add tests. Implement what is missing.
2023-01-12 17:06:27 +00:00
Bram Moolenaar
a94bd9d939
patch 9.0.1184: interface of an object is not recognized when checking type
...
Problem: Interface of an object is not recognized when checking type.
Solution: Use the interface implemented by an object.
2023-01-12 15:01:32 +00:00
Bram Moolenaar
6481accd40
patch 9.0.1181: class inheritance and typing insufficiently tested
...
Problem: Class inheritance and typing insufficiently tested.
Solution: Add more tests. Implement missing behavior.
2023-01-11 21:14:17 +00:00
Bram Moolenaar
6aa0937fb8
patch 9.0.1179: not all errors around inheritance are tested
...
Problem: Not all errors around inheritance are tested.
Solution: Add more tests. Fix uncovered problems.
2023-01-11 17:59:38 +00:00