patch 8.2.3376: Vim9: no warning that "@r" does not do anything

Problem:    Vim9: no warning that "@r" does not do anything.
Solution:   Give a "no effect" error. (closes #8779)
diff --git a/src/ex_eval.c b/src/ex_eval.c
index 207defa..259cf67 100644
--- a/src/ex_eval.c
+++ b/src/ex_eval.c
@@ -887,6 +887,26 @@
     }
 }
 
+    int
+cmd_is_name_only(char_u *arg)
+{
+    char_u  *p = arg;
+    char_u  *alias;
+    int	    name_only = FALSE;
+
+    if (*p == '&')
+    {
+	++p;
+	if (STRNCMP("l:", p, 2) == 0 || STRNCMP("g:", p, 2) == 0)
+	    p += 2;
+    }
+    else if (*p == '@')
+	++p;
+    get_name_len(&p, &alias, FALSE, FALSE);
+    name_only = ends_excmd2(arg, skipwhite(p));
+    vim_free(alias);
+    return name_only;
+}
 
 /*
  * ":eval".
@@ -897,18 +917,10 @@
     typval_T	tv;
     evalarg_T	evalarg;
     int		name_only = FALSE;
-    char_u	*p;
     long	lnum = SOURCING_LNUM;
 
     if (in_vim9script())
-    {
-	char_u	*alias;
-
-	p = eap->arg;
-	get_name_len(&p, &alias, FALSE, FALSE);
-	name_only = ends_excmd2(eap->arg, skipwhite(p));
-	vim_free(alias);
-    }
+	name_only = cmd_is_name_only(eap->arg);
 
     fill_evalarg_from_eap(&evalarg, eap, eap->skip);
 
diff --git a/src/proto/ex_eval.pro b/src/proto/ex_eval.pro
index f5037c9..a3be429 100644
--- a/src/proto/ex_eval.pro
+++ b/src/proto/ex_eval.pro
@@ -12,6 +12,7 @@
 void discard_current_exception(void);
 void catch_exception(except_T *excp);
 void report_make_pending(int pending, void *value);
+int cmd_is_name_only(char_u *arg);
 void ex_eval(exarg_T *eap);
 void ex_if(exarg_T *eap);
 void ex_endif(exarg_T *eap);
diff --git a/src/testdir/test_vim9_cmd.vim b/src/testdir/test_vim9_cmd.vim
index 128575b..93b1295 100644
--- a/src/testdir/test_vim9_cmd.vim
+++ b/src/testdir/test_vim9_cmd.vim
@@ -537,7 +537,7 @@
   CheckDefAndScriptSuccess(lines)
 enddef
 
-def Test_register_use_linebreak()
+def Test_use_register()
   var lines =<< trim END
       new
       @a = 'one'
@@ -551,6 +551,12 @@
       bwipe!
   END
   CheckDefAndScriptSuccess(lines)
+
+  lines =<< trim END
+      @a = 'echo "text"'
+      @a
+  END
+  CheckDefAndScriptFailure(lines, 'E1207:')
 enddef
 
 def Test_environment_use_linebreak()
diff --git a/src/version.c b/src/version.c
index 5211f8f..22dc440 100644
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    3376,
+/**/
     3375,
 /**/
     3374,
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 97bd292..a4d8423 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -8828,17 +8828,13 @@
 {
     char_u	*p = arg;
     int		name_only;
-    char_u	*alias;
     long	lnum = SOURCING_LNUM;
 
     // find_ex_command() will consider a variable name an expression, assuming
     // that something follows on the next line.  Check that something actually
     // follows, otherwise it's probably a misplaced command.
-    get_name_len(&p, &alias, FALSE, FALSE);
-    name_only = ends_excmd2(arg, skipwhite(p));
-    vim_free(alias);
+    name_only = cmd_is_name_only(arg);
 
-    p = arg;
     if (compile_expr0(&p, cctx) == FAIL)
 	return NULL;