1
0
forked from aniani/vim

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>
This commit is contained in:
Yegappan Lakshmanan
2023-10-28 15:53:55 +02:00
committed by Christian Brabandt
parent 87ca5e86fa
commit feaccd2395
12 changed files with 261 additions and 55 deletions

View File

@@ -1811,7 +1811,13 @@ f_typename(typval_T *argvars, typval_T *rettv)
rettv->v_type = VAR_STRING;
ga_init2(&type_list, sizeof(type_T *), 10);
if (argvars[0].v_type == VAR_TYPEALIAS)
type = argvars[0].vval.v_typealias->ta_type;
{
type = copy_type(argvars[0].vval.v_typealias->ta_type, &type_list);
// A type alias for a class has the type set to VAR_OBJECT. Change it
// to VAR_CLASS, so that the name is "typealias<class<xxx>>"
if (type->tt_type == VAR_OBJECT)
type->tt_type = VAR_CLASS;
}
else
type = typval2type(argvars, get_copyID(), &type_list, TVTT_DO_MEMBER);
name = type_name(type, &tofree);