patch 8.2.4602: Vim9: not enough test coverage for executing :def function

Problem:    Vim9: not enough test coverage for executing :def function.
Solution:   Add a few more tests.  Fix uncovered problem.  Remove dead code.
diff --git a/src/proto/vim9instr.pro b/src/proto/vim9instr.pro
index be41d7c..8da5597 100644
--- a/src/proto/vim9instr.pro
+++ b/src/proto/vim9instr.pro
@@ -19,8 +19,8 @@
 int generate_PUSHSPEC(cctx_T *cctx, varnumber_T number);
 int generate_PUSHF(cctx_T *cctx, float_T fnumber);
 int generate_PUSHS(cctx_T *cctx, char_u **str);
-int generate_PUSHCHANNEL(cctx_T *cctx, channel_T *channel);
-int generate_PUSHJOB(cctx_T *cctx, job_T *job);
+int generate_PUSHCHANNEL(cctx_T *cctx);
+int generate_PUSHJOB(cctx_T *cctx);
 int generate_PUSHBLOB(cctx_T *cctx, blob_T *blob);
 int generate_PUSHFUNC(cctx_T *cctx, char_u *name, type_T *type);
 int generate_AUTOLOAD(cctx_T *cctx, char_u *name, type_T *type);
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim
index 02ea54a..dcce616 100644
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -3312,6 +3312,29 @@
   v9.CheckDefAndScriptFailure(lines, 'E117: Unknown function: ExistingGlobal')
 enddef
 
+def Test_expr8_autoload_var()
+  var auto_lines =<< trim END
+      let autofile#var = 'found'
+  END
+  mkdir('Xruntime/autoload', 'p')
+  writefile(auto_lines, 'Xruntime/autoload/autofile.vim')
+  var save_rtp = &rtp
+  &rtp = getcwd() .. '/Xruntime,' .. &rtp
+
+  var lines =<< trim END
+      assert_equal('found', autofile#var)
+  END
+  v9.CheckDefAndScriptSuccess(lines)
+
+  lines =<< trim END
+      echo autofile#other
+  END
+  v9.CheckDefExecAndScriptFailure(lines, 'E121: Undefined variable: autofile#other')
+
+  &rtp = save_rtp
+  delete('Xruntime', 'rf')
+enddef
+
 def Test_expr8_call_autoload()
   var auto_lines =<< trim END
       def g:some#func(): string
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index 3e4e9a4..b1b63d2 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -1246,6 +1246,37 @@
       assert_equal(19, getqflist()[0].lnum)
   END
   v9.CheckScriptSuccess(lines)
+
+  lines =<< trim END
+      vim9script
+      def CexprFail()
+        au QuickfixCmdPre * echo g:doesnotexist
+        cexpr 'File otherFile line 99'
+        g:didContinue = 'yes'
+      enddef
+      CexprFail()
+      g:didContinue = 'also'
+  END
+  g:didContinue = 'no'
+  v9.CheckScriptFailure(lines, 'E121: Undefined variable: g:doesnotexist')
+  assert_equal('no', g:didContinue)
+  au! QuickfixCmdPre
+
+  lines =<< trim END
+      vim9script
+      def CexprFail()
+        cexpr g:aNumber
+        g:didContinue = 'yes'
+      enddef
+      CexprFail()
+      g:didContinue = 'also'
+  END
+  g:aNumber = 123
+  g:didContinue = 'no'
+  v9.CheckScriptFailure(lines, 'E777: String or List expected')
+  assert_equal('no', g:didContinue)
+  unlet g:didContinue
+
   set errorformat&
 enddef
 
@@ -1813,6 +1844,10 @@
   echo str1 str2
   assert_match('^some more$', g:Screenline(&lines))
 
+  echo "one\ntwo"
+  assert_match('^one$', g:Screenline(&lines - 1))
+  assert_match('^two$', g:Screenline(&lines))
+
   v9.CheckDefFailure(['echo "xxx"# comment'], 'E488:')
 enddef
 
diff --git a/src/version.c b/src/version.c
index 285b391..e262953 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4602,
+/**/
     4601,
 /**/
     4600,
diff --git a/src/vim9.h b/src/vim9.h
index 5fd8526..ed5f676 100644
--- a/src/vim9.h
+++ b/src/vim9.h
@@ -87,8 +87,8 @@
     ISN_PUSHS,		// push string isn_arg.string
     ISN_PUSHBLOB,	// push blob isn_arg.blob
     ISN_PUSHFUNC,	// push func isn_arg.string
-    ISN_PUSHCHANNEL,	// push channel isn_arg.channel
-    ISN_PUSHJOB,	// push channel isn_arg.job
+    ISN_PUSHCHANNEL,	// push NULL channel
+    ISN_PUSHJOB,	// push NULL job
     ISN_NEWLIST,	// push list from stack items, size is isn_arg.number
     ISN_NEWDICT,	// push dict from stack items, size is isn_arg.number
     ISN_NEWPARTIAL,	// push NULL partial
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 06b6c79..fde8188 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2238,10 +2238,10 @@
 			generate_NEWDICT(cctx, 0);
 			break;
 		    case VAR_JOB:
-			generate_PUSHJOB(cctx, NULL);
+			generate_PUSHJOB(cctx);
 			break;
 		    case VAR_CHANNEL:
-			generate_PUSHCHANNEL(cctx, NULL);
+			generate_PUSHCHANNEL(cctx);
 			break;
 		    case VAR_NUMBER:
 		    case VAR_UNKNOWN:
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 312c5fa..2d6a3fe 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -2611,8 +2611,10 @@
 
 	    case ISN_CEXPR_AUCMD:
 #ifdef FEAT_QUICKFIX
+		force_abort = TRUE;
 		if (trigger_cexpr_autocmd(iptr->isn_arg.number) == FAIL)
 		    goto on_error;
+		force_abort = FALSE;
 #endif
 		break;
 
@@ -3040,7 +3042,9 @@
 			s = tv2string(tv, &tofree, numbuf, 0);
 			if (s == NULL || *s == NUL)
 			{
+			    // cannot happen?
 			    clear_tv(tv);
+			    vim_free(tofree);
 			    goto on_error;
 			}
 		    }
@@ -3270,17 +3274,13 @@
 		    case ISN_PUSHCHANNEL:
 #ifdef FEAT_JOB_CHANNEL
 			tv->v_type = VAR_CHANNEL;
-			tv->vval.v_channel = iptr->isn_arg.channel;
-			if (tv->vval.v_channel != NULL)
-			    ++tv->vval.v_channel->ch_refcount;
+			tv->vval.v_channel = NULL;
 #endif
 			break;
 		    case ISN_PUSHJOB:
 #ifdef FEAT_JOB_CHANNEL
 			tv->v_type = VAR_JOB;
-			tv->vval.v_job = iptr->isn_arg.job;
-			if (tv->vval.v_job != NULL)
-			    ++tv->vval.v_job->jv_refcount;
+			tv->vval.v_job = NULL;
 #endif
 			break;
 		    default:
@@ -5644,26 +5644,12 @@
 		break;
 	    case ISN_PUSHCHANNEL:
 #ifdef FEAT_JOB_CHANNEL
-		{
-		    channel_T *channel = iptr->isn_arg.channel;
-
-		    smsg("%s%4d PUSHCHANNEL %d", pfx, current,
-					 channel == NULL ? 0 : channel->ch_id);
-		}
+		smsg("%s%4d PUSHCHANNEL 0", pfx, current);
 #endif
 		break;
 	    case ISN_PUSHJOB:
 #ifdef FEAT_JOB_CHANNEL
-		{
-		    typval_T	tv;
-		    char_u	*name;
-		    char_u	buf[NUMBUFLEN];
-
-		    tv.v_type = VAR_JOB;
-		    tv.vval.v_job = iptr->isn_arg.job;
-		    name = job_to_string_buf(&tv, buf);
-		    smsg("%s%4d PUSHJOB \"%s\"", pfx, current, name);
-		}
+		smsg("%s%4d PUSHJOB \"no process\"", pfx, current);
 #endif
 		break;
 	    case ISN_PUSHEXC:
diff --git a/src/vim9instr.c b/src/vim9instr.c
index 48e7edf..7f23884 100644
--- a/src/vim9instr.c
+++ b/src/vim9instr.c
@@ -592,12 +592,12 @@
 	    case VAR_JOB:
 		if (tv->vval.v_job != NULL)
 		    iemsg("non-null job constant not supported");
-		generate_PUSHJOB(cctx, NULL);
+		generate_PUSHJOB(cctx);
 		break;
 	    case VAR_CHANNEL:
 		if (tv->vval.v_channel != NULL)
 		    iemsg("non-null channel constant not supported");
-		generate_PUSHCHANNEL(cctx, NULL);
+		generate_PUSHCHANNEL(cctx);
 		break;
 #endif
 	    case VAR_FUNC:
@@ -723,36 +723,30 @@
 }
 
 /*
- * Generate an ISN_PUSHCHANNEL instruction.
- * Consumes "channel".
+ * Generate an ISN_PUSHCHANNEL instruction.  Channel is always NULL.
  */
     int
-generate_PUSHCHANNEL(cctx_T *cctx, channel_T *channel)
+generate_PUSHCHANNEL(cctx_T *cctx)
 {
     isn_T	*isn;
 
     RETURN_OK_IF_SKIP(cctx);
     if ((isn = generate_instr_type(cctx, ISN_PUSHCHANNEL, &t_channel)) == NULL)
 	return FAIL;
-    isn->isn_arg.channel = channel;
-
     return OK;
 }
 
 /*
- * Generate an ISN_PUSHJOB instruction.
- * Consumes "job".
+ * Generate an ISN_PUSHJOB instruction.  Job is always NULL.
  */
     int
-generate_PUSHJOB(cctx_T *cctx, job_T *job)
+generate_PUSHJOB(cctx_T *cctx)
 {
     isn_T	*isn;
 
     RETURN_OK_IF_SKIP(cctx);
     if ((isn = generate_instr_type(cctx, ISN_PUSHJOB, &t_job)) == NULL)
 	return FAIL;
-    isn->isn_arg.job = job;
-
     return OK;
 }
 
@@ -2081,18 +2075,6 @@
 	    blob_unref(isn->isn_arg.blob);
 	    break;
 
-	case ISN_PUSHJOB:
-#ifdef FEAT_JOB_CHANNEL
-	    job_unref(isn->isn_arg.job);
-#endif
-	    break;
-
-	case ISN_PUSHCHANNEL:
-#ifdef FEAT_JOB_CHANNEL
-	    channel_unref(isn->isn_arg.channel);
-#endif
-	    break;
-
 	case ISN_UCALL:
 	    vim_free(isn->isn_arg.ufunc.cuf_name);
 	    break;
@@ -2241,7 +2223,9 @@
 	case ISN_PROF_END:
 	case ISN_PROF_START:
 	case ISN_PUSHBOOL:
+	case ISN_PUSHCHANNEL:
 	case ISN_PUSHF:
+	case ISN_PUSHJOB:
 	case ISN_PUSHNR:
 	case ISN_PUSHSPEC:
 	case ISN_PUT: