patch 8.2.1270: Vim9: not skipping over function type declaration

Problem:    Vim9: not skipping over function type declaration with only a
            return type.
Solution:   Skip over the return type. (issue #6507)
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim
index 6d83ddc..3fa5d6a 100644
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -260,6 +260,16 @@
   assert_equal(3, g:SomeFunc('abc'))
   assert_fails('NotAFunc()', 'E117:')
   assert_fails('g:NotAFunc()', 'E117:')
+
+  let lines =<< trim END
+    vim9script
+    def RetNumber(): number
+      return 123
+    enddef
+    let Funcref: func: number = function('RetNumber')
+    assert_equal(123, Funcref())
+  END
+  CheckScriptSuccess(lines)
 enddef
 
 let SomeFunc = function('len')
diff --git a/src/version.c b/src/version.c
index cf64327..9ac0340 100644
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1270,
+/**/
     1269,
 /**/
     1268,
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 0e3e01a..55f08a7 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -1881,26 +1881,35 @@
 	if (*p == '>')
 	    ++p;
     }
-    else if (*p == '(' && STRNCMP("func", start, 4) == 0)
+    else if ((*p == '(' || (*p == ':' && VIM_ISWHITE(p[1])))
+					     && STRNCMP("func", start, 4) == 0)
     {
-	// handle func(args): type
-	++p;
-	while (*p != ')' && *p != NUL)
+	if (*p == '(')
 	{
-	    char_u *sp = p;
+	    // handle func(args): type
+	    ++p;
+	    while (*p != ')' && *p != NUL)
+	    {
+		char_u *sp = p;
 
-	    p = skip_type(p);
-	    if (p == sp)
-		return p;  // syntax error
-	    if (*p == ',')
-		p = skipwhite(p + 1);
+		p = skip_type(p);
+		if (p == sp)
+		    return p;  // syntax error
+		if (*p == ',')
+		    p = skipwhite(p + 1);
+	    }
+	    if (*p == ')')
+	    {
+		if (p[1] == ':')
+		    p = skip_type(skipwhite(p + 2));
+		else
+		    p = skipwhite(p + 1);
+	    }
 	}
-	if (*p == ')')
+	else
 	{
-	    if (p[1] == ':')
-		p = skip_type(skipwhite(p + 2));
-	    else
-		p = skipwhite(p + 1);
+	    // handle func: return_type
+	    p = skip_type(skipwhite(p + 1));
 	}
     }