enddef
defcompile
END
- v9.CheckSourceFailure(lines, 'E1010: Type not recognized: x in range(10)', 1)
+ v9.CheckSourceFailure(lines, 'E1010: Type not recognized: x', 1)
enddef
" Test for using a line break between the variable name and the type in a for
v9.CheckSourceDefAndScriptSuccess(lines)
enddef
+" Test for using an unknown type in a typecast
+def Test_unknown_type_in_typecast()
+ var lines =<< trim END
+ vim9script
+ var a = <MyType>b
+ END
+ v9.CheckSourceFailure(lines, 'E1010: Type not recognized: MyType', 2)
+
+ lines =<< trim END
+ vim9script
+ var Fn = <funcx(number, number): number>b
+ END
+ v9.CheckSourceFailure(lines, 'E1010: Type not recognized: funcx(number, number): number', 2)
+enddef
+
" Keep this last, it messes up highlighting.
def Test_substitute_cmd()
new
var myNum: A.SomeType = 10
END
- v9.CheckScriptFailure(lines, 'E1010: Type not recognized: A.SomeType = 10', 4)
+ v9.CheckScriptFailure(lines, 'E1010: Type not recognized: A.SomeType', 4)
# Use a type alias that is not exported
lines =<< trim END
}
if (give_error && (did_emsg == did_emsg_before))
+ {
+ char_u *p = skip_type(*arg, FALSE);
+ char cc = *p;
+
+ *p = NUL;
semsg(_(e_type_not_recognized_str), *arg);
+ *p = cc;
+ }
return NULL;
}