Age | Commit message (Collapse) | Author |
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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.
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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)
|
|
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)
|
|
Problem: Using tt_member for the class leads to mistakes.
Solution: Add a separate tt_class field.
|
|
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.
|
|
Problem: Code is indented more than necessary.
Solution: Use an early return where it makes sense. (Yegappan Lakshmanan,
closes #11887)
|
|
Problem: Cannot call a :def function with a number for a float argument.
Solution: Accept a number as well, convert it to a float.
|
|
Problem: Error when object type is expected but getting "any".
Solution: When actual type is "any" use a runtime type check.
(closes #11826)
|
|
Problem: Return type of values() is always list<any>.
Solution: Use the member type if possible. (issue #11822)
|
|
Problem: Crash when iterating over list of objects.
Solution: Do not make a copy of tt_member for object or class.
(closes #11823)
|
|
Problem: Test for using imported class fails.
Solution: Skip over rest of type.
|
|
Problem: Using class from imported script not tested.
Solution: Add tests. Implement what is missing.
|
|
Problem: Interface of an object is not recognized when checking type.
Solution: Use the interface implemented by an object.
|
|
Problem: Class inheritance and typing insufficiently tested.
Solution: Add more tests. Implement missing behavior.
|
|
Problem: Compiler warning for implicit size_t/int conversion.
Solution: Add a type cast. (Mike Williams, closes #11795)
|
|
Problem: Tests fail because of a different error message.
Solution: Don't give an error if a type name can't be found.
|
|
Problem: Cannot use a class as a type.
Solution: Accept a class and interface name as a type.
|
|
Problem: Cannot create a new object in a compiled function.
Solution: Compile the instructins to create a new object.
|
|
Problem: Crash when expecting varargs but it is something else.
Solution: Only use the member when the type is a list. (closes #11774)
|
|
Problem: Type error when using "any" type and adding a number to a float.
Solution: Accept both a number and a float. (closes #11753)
|
|
Problem: Invalid memory access when checking function argument types.
Solution: Do not check beyond the number of arguments. (closes #11755)
|
|
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.
|
|
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.
|
|
Problem: Using freed memory when assigning to variable twice.
Solution: Make copy of the list type. (closes #11691)
|
|
Problem: Cannot define a method in a class.
Solution: Implement defining an object method. Make calling an object
method work.
|
|
Problem: Vim9 class is not implemented yet.
Solution: Add very basic class support.
|
|
Problem: Failing check for argument type for const any.
Solution: Check for any type properly. (closes #11316)
|
|
Problem: Coverity warns for not checking return value.
Solution: Check the return value and simplify the code.
|
|
Problem: Leaking argument type array.
Solution: Add allocated memory to type_gap.
|