patch 9.0.1466: cannot use an object member name as a method argument
Problem: Cannot use an object member name as a method argument.
Solution: Do not give an error for using an object member name for a method
argument. (Hirohito Higashi, closes #12241, closes #12225)
Fix line number for other argument error.
diff --git a/src/testdir/test_vim9_class.vim b/src/testdir/test_vim9_class.vim
index 4b6a730..a8f161d 100644
--- a/src/testdir/test_vim9_class.vim
+++ b/src/testdir/test_vim9_class.vim
@@ -995,7 +995,7 @@
def Method(count: number)
endinterface
END
- v9.CheckScriptFailure(lines, 'E1340: Argument already declared in the class: count')
+ v9.CheckScriptFailure(lines, 'E1340: Argument already declared in the class: count', 5)
lines =<< trim END
vim9script
@@ -1005,7 +1005,9 @@
def Method(value: number)
endinterface
END
- v9.CheckScriptFailure(lines, 'E1340: Argument already declared in the class: value')
+ # The argument name and the object member name are the same, but this is not a
+ # problem because object members are always accessed with the "this." prefix.
+ v9.CheckScriptSuccess(lines)
lines =<< trim END
vim9script