patch 8.2.1227: Vim9: allowing both quoted and # comments is confusing

Problem:    Vim9: allowing both quoted and # comments is confusing.
Solution:   Only support # comments in Vim9 script.
diff --git a/src/testdir/test_vim9_disassemble.vim b/src/testdir/test_vim9_disassemble.vim
index f1f943e..186ce6d 100644
--- a/src/testdir/test_vim9_disassemble.vim
+++ b/src/testdir/test_vim9_disassemble.vim
@@ -463,7 +463,7 @@
         '\d RETURN',
         res)
 
-  " Calling the function will change UCALL into the faster DCALL
+  # Calling the function will change UCALL into the faster DCALL
   assert_equal('yes', FuncWithForwardCall())
 
   res = execute('disass s:FuncWithForwardCall')
@@ -1073,7 +1073,7 @@
 
   let nr = 1
   for case in cases
-    " declare local variables to get a non-constant with the right type
+    # declare local variables to get a non-constant with the right type
     writefile(['def TestCase' .. nr .. '()',
              '  let isFalse = false',
              '  let isNull = v:null',
@@ -1121,7 +1121,7 @@
     source Xdisassemble
     let instr = execute('disassemble TestCase' .. nr)
     if case[1]
-      " condition true, "echo 42" executed
+      # condition true, "echo 42" executed
       assert_match('TestCase' .. nr .. '.*' ..
           'if ' .. substitute(case[0], '[[~]', '\\\0', 'g') .. '.*' ..
           '\d PUSHNR 42.*' ..
@@ -1130,7 +1130,7 @@
           '\d RETURN.*',
           instr)
     else
-      " condition false, function just returns
+      # condition false, function just returns
       assert_match('TestCase' .. nr .. '.*' ..
           'if ' .. substitute(case[0], '[[~]', '\\\0', 'g') .. '[ \n]*' ..
           'echo 42[ \n]*' ..
@@ -1245,7 +1245,7 @@
   writefile(lines, 'Xdisassemble')
   source Xdisassemble
 
-  " check that the first function calls the second with DCALL
+  # check that the first function calls the second with DCALL
   assert_match('\<SNR>\d*_FuncOne\_s*' ..
         'return FuncTwo()\_s*' ..
         '\d DCALL <SNR>\d\+_FuncTwo(argc 0)\_s*' ..
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim
index dc95144..4c8e6e1 100644
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -46,7 +46,7 @@
 enddef
 
 def Test_expr1_vimscript()
-  " only checks line continuation
+  # only checks line continuation
   let lines =<< trim END
       vim9script
       let var = 1
@@ -127,7 +127,7 @@
 enddef
 
 def Test_expr2_vimscript()
-  " check line continuation
+  # check line continuation
   let lines =<< trim END
       vim9script
       let var = 0
@@ -154,7 +154,7 @@
   END
   CheckScriptSuccess(lines)
 
-  " check keeping the value
+  # check keeping the value
   lines =<< trim END
       vim9script
       assert_equal(2, 2 || 0)
@@ -231,7 +231,7 @@
 enddef
 
 def Test_expr3_vimscript()
-  " check line continuation
+  # check line continuation
   let lines =<< trim END
       vim9script
       let var = 0
@@ -258,7 +258,7 @@
   END
   CheckScriptSuccess(lines)
 
-  " check keeping the value
+  # check keeping the value
   lines =<< trim END
       vim9script
       assert_equal(0, 2 && 0)
@@ -625,7 +625,7 @@
 enddef
 
 def Test_expr4_vimscript()
-  " check line continuation
+  # check line continuation
   let lines =<< trim END
       vim9script
       let var = 0
@@ -668,7 +668,7 @@
   END
   CheckScriptSuccess(lines)
 
-  " spot check mismatching types
+  # spot check mismatching types
   lines =<< trim END
       vim9script
       echo '' == 0
@@ -791,7 +791,7 @@
 enddef
 
 def Test_expr5_vim9script()
-  " only checks line continuation
+  # only checks line continuation
   let lines =<< trim END
       vim9script
       let var = 11
@@ -902,7 +902,7 @@
 enddef
 
 def Test_expr6_vim9script()
-  " only checks line continuation
+  # only checks line continuation
   let lines =<< trim END
       vim9script
       let var = 11
@@ -1024,7 +1024,7 @@
 
 " test low level expression
 def Test_expr7_number()
-  " number constant
+  # number constant
   assert_equal(0, 0)
   assert_equal(654, 0654)
 
@@ -1034,7 +1034,7 @@
 enddef
 
 def Test_expr7_float()
-  " float constant
+  # float constant
   if !has('float')
     MissingFeature 'float'
   else
@@ -1046,7 +1046,7 @@
 enddef
 
 def Test_expr7_blob()
-  " blob constant
+  # blob constant
   assert_equal(g:blob_empty, 0z)
   assert_equal(g:blob_one, 0z01)
   assert_equal(g:blob_long, 0z0102.0304)
@@ -1055,7 +1055,7 @@
 enddef
 
 def Test_expr7_string()
-  " string constant
+  # string constant
   assert_equal(g:string_empty, '')
   assert_equal(g:string_empty, "")
   assert_equal(g:string_short, 'x')
@@ -1077,7 +1077,7 @@
 enddef
 
 def Test_expr7_special()
-  " special constant
+  # special constant
   assert_equal(g:special_true, true)
   assert_equal(g:special_false, false)
   assert_equal(g:special_true, v:true)
@@ -1106,7 +1106,7 @@
 enddef
 
 def Test_expr7_list()
-  " list
+  # list
   assert_equal(g:list_empty, [])
   assert_equal(g:list_empty, [  ])
   assert_equal(g:list_mixed, [1, 'b', false,])
@@ -1152,7 +1152,7 @@
   assert_equal('result', La())
   assert_equal([1, 3, 5], [1, 2, 3]->map({key, val -> key + val}))
 
-  " line continuation inside lambda with "cond ? expr : expr" works
+  # line continuation inside lambda with "cond ? expr : expr" works
   let ll = range(3)
   map(ll, {k, v -> v % 2 ? {
 	    '111': 111 } : {}
@@ -1189,7 +1189,7 @@
 enddef
 
 def Test_expr7_dict()
-  " dictionary
+  # dictionary
   assert_equal(g:dict_empty, {})
   assert_equal(g:dict_empty, {  })
   assert_equal(g:dict_one, {'one': 1})
@@ -1316,7 +1316,7 @@
 enddef
 
 def Test_expr7_option()
-  " option
+  # option
   set ts=11
   assert_equal(11, &ts)
   &ts = 9
@@ -1330,7 +1330,7 @@
 enddef
 
 def Test_expr7_environment()
-  " environment variable
+  # environment variable
   assert_equal('testvar', $TESTVAR)
   assert_equal('', $ASDF_ASD_XXX)
 
@@ -1343,7 +1343,7 @@
 enddef
 
 def Test_expr7_parens()
-  " (expr)
+  # (expr)
   assert_equal(4, (6 * 4) / 6)
   assert_equal(0, 6 * ( 4 / 6 ))
 
@@ -1474,7 +1474,7 @@
 endfunc
 
 def Test_expr7_trailing()
-  " user function call
+  # user function call
   assert_equal(123, g:CallMe(123))
   assert_equal(123, g:CallMe(  123))
   assert_equal(123, g:CallMe(123  ))
@@ -1482,26 +1482,26 @@
   assert_equal('yesno', g:CallMe2( 'yes', 'no' ))
   assert_equal('nothing', g:CallMe('nothing'))
 
-  " partial call
+  # partial call
   let Part = function('g:CallMe')
   assert_equal('yes', Part('yes'))
 
-  " funcref call, using list index
+  # funcref call, using list index
   let l = []
   g:Funcrefs[0](l, 2)
   assert_equal([2], l)
 
-  " method call
+  # method call
   l = [2, 5, 6]
   l->map({k, v -> k + v})
   assert_equal([2, 6, 8], l)
 
-  " lambda method call
+  # lambda method call
   l = [2, 5]
   l->{l -> add(l, 8)}()
   assert_equal([2, 5, 8], l)
 
-  " dict member
+  # dict member
   let d = #{key: 123}
   assert_equal(123, d.key)
 enddef
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim
index d201181..9b61821 100644
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -80,7 +80,7 @@
   Increment()
   Increment()
   Increment()
-  " works with and without :call
+  # works with and without :call
   assert_equal(4, g:counter)
   call assert_equal(4, g:counter)
   unlet g:counter
@@ -236,7 +236,7 @@
 enddef
 
 def Test_assign_to_argument()
-  " works for dict and list
+  # works for dict and list
   let d: dict<string> = {}
   DictArg(d)
   assert_equal('value', d['key'])
@@ -266,19 +266,19 @@
 let NotAFunc = 'text'
 
 def CombineFuncrefTypes()
-  " same arguments, different return type
+  # same arguments, different return type
   let Ref1: func(bool): string
   let Ref2: func(bool): number
   let Ref3: func(bool): any
   Ref3 = g:cond ? Ref1 : Ref2
 
-  " different number of arguments
+  # different number of arguments
   let Refa1: func(bool): number
   let Refa2: func(bool, number): number
   let Refa3: func: number
   Refa3 = g:cond ? Refa1 : Refa2
 
-  " different argument types
+  # different argument types
   let Refb1: func(bool, string): number
   let Refb2: func(string, number): number
   let Refb3: func(any, any): number
@@ -294,7 +294,7 @@
 enddef
 
 def Test_error_in_nested_function()
-  " Error in called function requires unwinding the call stack.
+  # Error in called function requires unwinding the call stack.
   assert_fails('call FuncWithForwardCall()', 'E1096')
 enddef
 
diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim
index aa0130c..24ce668 100644
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -113,7 +113,7 @@
   let lines =<< trim END
       vim9script
 
-      " single character variable declarations work
+      # single character variable declarations work
       let a: string
       let b: number
       let l: list<any>
@@ -122,7 +122,7 @@
       let v: number
       let w: number
 
-      " script-local variables can be used without s: prefix
+      # script-local variables can be used without s: prefix
       a = 'script-a'
       b = 111
       l = [1, 2, 3]
@@ -175,7 +175,7 @@
   let dict4: dict<any> = #{one: 1, two: '2'}
   let dict5: dict<blob> = #{one: 0z01, two: 0z02}
 
-  " overwrite
+  # overwrite
   dict3['key'] = 'another'
 
   call CheckDefExecFailure(['let dd = {}', 'dd[""] = 6'], 'E713:')
@@ -185,8 +185,8 @@
 enddef
 
 def Test_assignment_local()
-  " Test in a separated file in order not to the current buffer/window/tab is
-  " changed.
+  # Test in a separated file in order not to the current buffer/window/tab is
+  # changed.
   let script_lines: list<string> =<< trim END
     let b:existing = 'yes'
     let w:existing = 'yes'
@@ -259,7 +259,7 @@
     assert_equal(test_null_channel(), thechannel)
 
     if has('unix') && executable('cat')
-      " check with non-null job and channel, types must match
+      # check with non-null job and channel, types must match
       thejob = job_start("cat ", #{})
       thechannel = job_getchannel(thejob)
       job_stop(thejob, 'kill')
@@ -394,7 +394,7 @@
 enddef
 
 def Test_delfunction()
-  " Check function is defined in script namespace
+  # Check function is defined in script namespace
   CheckScriptSuccess([
       'vim9script',
       'func CheckMe()',
@@ -403,7 +403,7 @@
       'assert_equal(123, s:CheckMe())',
       ])
 
-  " Check function in script namespace cannot be deleted
+  # Check function in script namespace cannot be deleted
   CheckScriptFailure([
       'vim9script',
       'func DeleteMe1()',
@@ -586,7 +586,7 @@
 enddef
 
 def Test_throw_vimscript()
-  " only checks line continuation
+  # only checks line continuation
   let lines =<< trim END
       vim9script
       try
@@ -600,7 +600,7 @@
 enddef
 
 def Test_cexpr_vimscript()
-  " only checks line continuation
+  # only checks line continuation
   set errorformat=File\ %f\ line\ %l
   let lines =<< trim END
       vim9script
@@ -727,7 +727,7 @@
   END
   writefile(import_in_def_lines, 'Ximport2.vim')
   source Ximport2.vim
-  " TODO: this should be 9879
+  # TODO: this should be 9879
   assert_equal(9876, g:imported)
   assert_equal(9883, g:imported_added)
   unlet g:imported
@@ -802,7 +802,7 @@
   writefile(import_star_lines, 'Ximport.vim')
   assert_fails('source Ximport.vim', 'E1045:')
 
-  " try to import something that exists but is not exported
+  # try to import something that exists but is not exported
   let import_not_exported_lines =<< trim END
     vim9script
     import name from './Xexport.vim'
@@ -810,7 +810,7 @@
   writefile(import_not_exported_lines, 'Ximport.vim')
   assert_fails('source Ximport.vim', 'E1049:')
 
-  " try to import something that is already defined
+  # try to import something that is already defined
   let import_already_defined =<< trim END
     vim9script
     let exported = 'something'
@@ -819,7 +819,7 @@
   writefile(import_already_defined, 'Ximport.vim')
   assert_fails('source Ximport.vim', 'E1073:')
 
-  " try to import something that is already defined
+  # try to import something that is already defined
   import_already_defined =<< trim END
     vim9script
     let exported = 'something'
@@ -828,7 +828,7 @@
   writefile(import_already_defined, 'Ximport.vim')
   assert_fails('source Ximport.vim', 'E1073:')
 
-  " try to import something that is already defined
+  # try to import something that is already defined
   import_already_defined =<< trim END
     vim9script
     let exported = 'something'
@@ -837,7 +837,7 @@
   writefile(import_already_defined, 'Ximport.vim')
   assert_fails('source Ximport.vim', 'E1073:')
 
-  " import a very long name, requires making a copy
+  # import a very long name, requires making a copy
   let import_long_name_lines =<< trim END
     vim9script
     import name012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 from './Xexport.vim'
@@ -877,7 +877,7 @@
   delete('Ximport3.vim')
   delete('Xexport.vim')
 
-  " Check that in a Vim9 script 'cpo' is set to the Vim default.
+  # Check that in a Vim9 script 'cpo' is set to the Vim default.
   set cpo&vi
   let cpo_before = &cpo
   let lines =<< trim END
@@ -962,12 +962,12 @@
   writefile(testlines, 'Ximport.vim')
   source Ximport.vim
 
-  " Test that when not using "morelines" GetValtwo() and valtwo are still
-  " defined, because import doesn't reload a script.
+  # Test that when not using "morelines" GetValtwo() and valtwo are still
+  # defined, because import doesn't reload a script.
   writefile(lines, 'Xreload.vim')
   source Ximport.vim
 
-  " cannot declare a var twice
+  # cannot declare a var twice
   lines =<< trim END
     vim9script
     let valone = 1234
@@ -1185,7 +1185,7 @@
   try
     source Ximport.vim
   catch /E1001/
-    " Error should be fore the Xexported.vim file.
+    # Error should be fore the Xexported.vim file.
     assert_match('E1001: variable not found: notDefined', v:exception)
     assert_match('function <SNR>\d\+_ImpFunc\[1\]..<SNR>\d\+_ExpFunc, line 1', v:throwpoint)
   endtry
@@ -1195,7 +1195,7 @@
 enddef
 
 def Test_fixed_size_list()
-  " will be allocated as one piece of memory, check that changes work
+  # will be allocated as one piece of memory, check that changes work
   let l = [1, 2, 3, 4]
   l->remove(0)
   l->add(5)
@@ -1357,9 +1357,9 @@
   let x: number = 0
   if i % 2
     if 1
-      " comment
+      # comment
     else
-      " comment
+      # comment
     endif
     x += 1
   else
@@ -1401,7 +1401,7 @@
 enddef
 
 def Test_execute_cmd_vimscript()
-  " only checks line continuation
+  # only checks line continuation
   let lines =<< trim END
       vim9script
       execute 'g:someVar'
@@ -1441,7 +1441,7 @@
 enddef
 
 def Test_echomsg_cmd_vimscript()
-  " only checks line continuation
+  # only checks line continuation
   let lines =<< trim END
       vim9script
       echomsg 'here'
@@ -1461,7 +1461,7 @@
 enddef
 
 def Test_echoerr_cmd_vimscript()
-  " only checks line continuation
+  # only checks line continuation
   let lines =<< trim END
       vim9script
       try
@@ -1569,7 +1569,7 @@
       'one',
       'two',
       'three',
-      ] " comment
+      ] # comment
   assert_equal(['one', 'two', 'three'], mylist)
 
   let mydict = {
@@ -1577,7 +1577,7 @@
       'two': 2,
       'three':
           3,
-      } " comment
+      } # comment
   assert_equal({'one': 1, 'two': 2, 'three': 3}, mydict)
   mydict = #{
       one: 1,  # comment
@@ -1754,8 +1754,8 @@
       'hi clear This # comment',
       'hi clear # comment',
       ])
-  " not tested, because it doesn't give an error but a warning:
-  " hi clear This# comment',
+  # not tested, because it doesn't give an error but a warning:
+  # hi clear This# comment',
   CheckScriptFailure([
       'vim9script',
       'hi clear# comment',
@@ -2091,19 +2091,19 @@
       'bwipe!',
       ])
 
-"  CheckScriptFailure([
-"      'vim9script',
-"      'new'
-"      'call setline(1, ["# define pat", "last"])',
-"      ':$',
-"      'dsearch /pat/#comment',
-"      'bwipe!',
-"      ], 'E488:')
-"
-"  CheckScriptFailure([
-"      'vim9script',
-"      'func! SomeFunc()',
-"      ], 'E477:')
+  CheckScriptFailure([
+      'vim9script',
+      'new'
+      'call setline(1, ["# define pat", "last"])',
+      ':$',
+      'dsearch /pat/#comment',
+      'bwipe!',
+      ], 'E488:')
+
+  CheckScriptFailure([
+      'vim9script',
+      'func! SomeFunc()',
+      ], 'E477:')
 enddef
 
 def Test_finish()
@@ -2135,12 +2135,12 @@
       return 'this'
     endfunc
     let val: string = GetValue() 
-    " env var is always a string
+    # env var is always a string
     let env = $TERM
   END
   writefile(lines, 'Xfinished')
   source Xfinished
-  " GetValue() is not called during discovery phase
+  # GetValue() is not called during discovery phase
   assert_equal(1, g:count)
 
   unlet g:count
@@ -2169,7 +2169,7 @@
     g:var_uninit = var
     var = 'text'
     g:var_test = var
-    " prefixing s: is optional
+    # prefixing s: is optional
     s:var = 'prefixed'
     g:var_prefixed = s:var
 
@@ -2281,7 +2281,7 @@
   source Xlegacy_script.vim
 
   assert_equal('global', g:global)
-"  unlet g:global
+  unlet g:global
 
   delete('Xlegacy_script.vim')
   delete('Xvim9_script.vim')
@@ -2301,7 +2301,7 @@
   assert_equal('otherthing', getline(1))
   bwipe!
 
-  " also when the context is Vim9 script
+  # also when the context is Vim9 script
   let lines =<< trim END
     vim9script
     new