patch 8.2.3872: Vim9: finddir() and uniq() return types can be more specific

Problem:    Vim9: finddir() and uniq() return types can be more specific.
Solution:   Adjust the return type.
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim
index 58194ba..298a3be 100644
--- a/src/testdir/test_vim9_builtin.vim
+++ b/src/testdir/test_vim9_builtin.vim
@@ -1110,6 +1110,11 @@
   CheckDefAndScriptFailure(['finddir("a", [])'], ['E1013: Argument 2: type mismatch, expected string but got list<unknown>', 'E1174: String required for argument 2'])
   CheckDefAndScriptFailure(['finddir("a", "b", "c")'], ['E1013: Argument 3: type mismatch, expected number but got string', 'E1210: Number required for argument 3'])
   finddir('abc', '')->assert_equal('')
+
+  CheckDefFailure(['var s: list<string> = finddir("foo")'], 'E1012: Type mismatch; expected list<string> but got string')
+  CheckDefFailure(['var s: list<string> = finddir("foo", "path")'], 'E1012: Type mismatch; expected list<string> but got string')
+  # with third argument only runtime type checking
+  CheckDefCompileSuccess(['var s: list<string> = finddir("foo", "path", 1)'])
 enddef
 
 def Test_findfile()
@@ -4036,6 +4041,8 @@
 def Test_uniq()
   CheckDefAndScriptFailure(['uniq("a")'], ['E1013: Argument 1: type mismatch, expected list<any> but got string', 'E1211: List required for argument 1'])
   CheckDefAndScriptFailure(['uniq([1], "", [1])'], ['E1013: Argument 3: type mismatch, expected dict<any> but got list<number>', 'E1206: Dictionary required for argument 3'])
+
+  CheckDefFailure(['var l: list<number> = uniq(["a", "b"])'], 'E1012: Type mismatch; expected list<number> but got list<string>')
 enddef
 
 def Test_values()
diff --git a/src/testdir/vim9.vim b/src/testdir/vim9.vim
index a6e1e67..89f3c79 100644
--- a/src/testdir/vim9.vim
+++ b/src/testdir/vim9.vim
@@ -3,7 +3,7 @@
 " Use a different file name for each run.
 let s:sequence = 1
 
-" Check that "lines" inside a ":def" function has no error.
+" Check that "lines" inside a ":def" function has no error when called.
 func CheckDefSuccess(lines)
   let cwd = getcwd()
   let fname = 'XdefSuccess' .. s:sequence
@@ -19,6 +19,19 @@
   endtry
 endfunc
 
+" Check that "lines" inside a ":def" function has no error when compiled.
+func CheckDefCompileSuccess(lines)
+  let fname = 'XdefSuccess' .. s:sequence
+  let s:sequence += 1
+  call writefile(['def Func()'] + a:lines + ['enddef', 'defcompile'], fname)
+  try
+    exe 'so ' .. fname
+  finally
+    call delete(fname)
+    delfunc! Func
+  endtry
+endfunc
+
 " Check that "lines" inside ":def" results in an "error" message.
 " If "lnum" is given check that the error is reported for this line.
 " Add a line before and after to make it less likely that the line number is