diff src/testdir/test_vim9_class.vim @ 31720:1949c2613b3e v9.0.1192

patch 9.0.1192: no error when class function argument shadows a member Commit: https://github.com/vim/vim/commit/d40f00cb43019fb4d39b89f407f8b52e92f9e16f Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jan 13 17:36:49 2023 +0000 patch 9.0.1192: no error when class function argument shadows a member Problem: No error when class function argument shadows a member. Solution: Check for shadowing.
author Bram Moolenaar <Bram@vim.org>
date Fri, 13 Jan 2023 18:45:03 +0100
parents 2d68375d5ddf
children ef7a9a7eb197
line wrap: on
line diff
--- a/src/testdir/test_vim9_class.vim
+++ b/src/testdir/test_vim9_class.vim
@@ -639,8 +639,17 @@ def Test_interface_basics()
         def Method(count: number)
       endinterface
   END
-  # TODO: this should give an error for "count" shadowing
-  v9.CheckScriptSuccess(lines)
+  v9.CheckScriptFailure(lines, 'E1340: Argument already declared in the class: count')
+
+  lines =<< trim END
+      vim9script
+
+      interface Some
+        this.value: number
+        def Method(value: number)
+      endinterface
+  END
+  v9.CheckScriptFailure(lines, 'E1340: Argument already declared in the class: value')
 
   lines =<< trim END
       vim9script