Problem: Vim9: can use an autoload name in normal script.
Solution: Disallow using an autoload name.
INIT(= N_("E1261: Cannot import .vim without using \"as\""));
EXTERN char e_cannot_import_same_script_twice_str[]
INIT(= N_("E1262: Cannot import the same script twice: %s"));
-// E1263 unused
+EXTERN char e_using_autoload_name_in_non_autoload_script_str[]
+ INIT(= N_("E1263: Using autoload name in a non-autoload script: %s"));
EXTERN char e_autoload_import_cannot_use_absolute_or_relative_path[]
INIT(= N_("E1264: Autoload import cannot use absolute or relative path: %s"));
EXTERN char e_cannot_use_partial_here[]
delete('Xdir', 'rf')
enddef
+def Test_autoload_name_wring()
+ var lines =<< trim END
+ vim9script
+ def Xscriptname#Func()
+ enddef
+ END
+ writefile(lines, 'Xscriptname.vim')
+ CheckScriptFailure(lines, 'E1263:')
+
+ delete('Xscriptname')
+enddef
+
def Test_import_autoload_postponed()
mkdir('Xdir/autoload', 'p')
var save_rtp = &rtp
}
}
}
+ else if (vim9script && vim_strchr(name, AUTOLOAD_CHAR) != NULL)
+ {
+ semsg(_(e_using_autoload_name_in_non_autoload_script_str),
+ name);
+ goto erret;
+ }
}
if (var_conflict)
{
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 4174,
/**/
4173,
/**/