[vim/vim] Fix error messages for :type/:class used in expressions (PR #13706)

19 views
Skip to first unread message

errael

unread,
Dec 16, 2023, 5:44:38 PM12/16/23
to vim/vim, Subscribed

You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/13706

Commit Summary

  • fd9f88f Fix error messages for :type/:class used in expressions

File Changes

(7 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/13706@github.com>

Yegappan Lakshmanan

unread,
Dec 17, 2023, 12:05:44 PM12/17/23
to vim/vim, Subscribed

@yegappan commented on this pull request.


In src/eval.c:

>  		if (di != NULL && di->di_tv.v_type == VAR_TYPEALIAS)
 		{
-		    semsg(_(e_cannot_modify_typealias),
-					di->di_tv.vval.v_typealias->ta_name);
+		    // TODO: use standard message, note that if a class type
+		    //	     is caught here, it does not have a class object
+		    //	     so no name.

The class name is available in di->di_tv.vval.v_class->class_name.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/13706/review/1785327551@github.com>

Yegappan Lakshmanan

unread,
Dec 17, 2023, 12:24:10 PM12/17/23
to vim/vim, Subscribed

@yegappan commented on this pull request.


In src/evalvars.c:

>  	    if (di->di_tv.v_type == VAR_TYPEALIAS)
 	    {
+		check_typval_is_value(&di->di_tv);
 		semsg(_(e_cannot_modify_typealias),

This semsg() can be removed?


In src/evalvars.c:

> @@ -3974,8 +3974,10 @@ set_var_const(
 		goto failed;
 	    }
 
+	    //if (check_typval_is_value(&di->di_tv) == FAIL) // TODO: class is null

Under what conditions is di->di_tv.vval.v_class NULL?


In src/vim9type.c:

> @@ -1871,7 +1871,11 @@ check_typval_is_value(typval_T *tv)
 	return OK;
     if (tv->v_type == VAR_CLASS)
     {
-        semsg(_(e_using_class_as_value_str), tv->vval.v_class->class_name);
+	if (tv->vval.v_class != NULL)
+	    semsg(_(e_using_class_as_value_str), tv->vval.v_class->class_name);
+	else
+	    //abort(); // How is there a typval without a v_class?

If null_class is used, then v_class will be null.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/13706/review/1785328441@github.com>

errael

unread,
Dec 19, 2023, 12:47:10 AM12/19/23
to vim/vim, Push

@errael pushed 1 commit.

  • 0c7c198 Fix some inconsistent messages for :type/:class usage


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/13706/push/16332556879@github.com>

errael

unread,
Dec 20, 2023, 12:30:55 AM12/20/23
to vim/vim, Subscribed

Turns out after preventing high level use of :type/:class as values. Many expression situations allowed them. This PR takes care of many of the leftovers. There's probably more out there.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/13706/c1863879493@github.com>

errael

unread,
Dec 20, 2023, 1:40:54 PM12/20/23
to vim/vim, Subscribed

@chrisbra @yegappan If it is relevant, when considering if this PR should make it into vim9.1, this PR is all about error messages. It was delayed a few days by discovering/fixing an old bug that interfered.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/13706/c1864962296@github.com>

Yegappan Lakshmanan

unread,
Dec 20, 2023, 1:58:38 PM12/20/23
to vim/vim, Subscribed

@yegappan approved this pull request.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/13706/review/1791493060@github.com>

Yegappan Lakshmanan

unread,
Dec 20, 2023, 1:58:49 PM12/20/23
to vim...@googlegroups.com, reply+ACY5DGAWG6DBIUSCNQ...@reply.github.com, vim/vim, Subscribed
Hi Ernie,

On Wed, Dec 20, 2023 at 10:40 AM errael <vim-dev...@256bit.org> wrote:

@chrisbra @yegappan If it is relevant, when considering if this PR should make it into vim9.1, this PR is all about error messages. It was delayed a few days by discovering/fixing an old bug that interfered.



The changes look good to me.

Regards,
Yegappan 

vim-dev ML

unread,
Dec 20, 2023, 1:59:04 PM12/20/23
to vim/vim, vim-dev ML, Your activity

Hi Ernie,

On Wed, Dec 20, 2023 at 10:40 AM errael ***@***.***> wrote:

> @chrisbra <https://github.com/chrisbra> @yegappan
> <https://github.com/yegappan> If it is relevant, when considering if this
> PR should make it into vim9.1, this PR is all about error messages. It was
> delayed a few days by discovering/fixing an old bug that interfered.
>
>
>
The changes look good to me.

Regards,
Yegappan


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/13706/c1864986723@github.com>

Christian Brabandt

unread,
Dec 21, 2023, 11:24:40 AM12/21/23
to vim/vim, vim-dev ML, Comment

Closed #13706 via e75fde6.


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/13706/issue_event/11317517072@github.com>

Christian Brabandt

unread,
Dec 21, 2023, 11:36:31 AM12/21/23
to vim/vim, vim-dev ML, Comment

thanks, applied


Reply to this email directly, view it on GitHub.

You are receiving this because you commented.Message ID: <vim/vim/pull/13706/c1866616713@github.com>

Reply all
Reply to author
Forward
0 new messages