vim icon indicating copy to clipboard operation
vim copied to clipboard

`typealias` usage errors need better error messages

Open errael opened this issue 1 year ago • 1 comments

Steps to reproduce

These indicated error messages give incomplete or inaccurate error messages.

vim9script
type T = list<string>
def F()
    abs(T)
enddef
F()

Outputs the error

E1407: Cannot use a Typealias as a variable or value

And

vim9script
class C
endclass
type T = C
def F()
    abs(T)
enddef
F()

outputs the error

E1405: Class "C" cannot be used as a value

Expected behaviour

The name of the :type should be in the message.

See check_type_is_value() in vim9type.c. There some discussion of what a fix would look like at https://github.com/vim/vim/pull/13688#discussion_r1428316748

Version of Vim

9.0.2167 with #13688

Environment

ubuntu

Logs and stack traces

No response

errael avatar Dec 15 '23 19:12 errael

May be related to #13433

errael avatar Dec 24 '23 18:12 errael