comparison src/testdir/test_vim9_class.vim @ 32270:d542423ef5c9 v9.0.1466

patch 9.0.1466: cannot use an object member name as a method argument Commit: https://github.com/vim/vim/commit/61378a15425553cec1ec15f590e70ca50c7c34a8 Author: h-east <h.east.727@gmail.com> Date: Tue Apr 18 19:07:29 2023 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Tue, 18 Apr 2023 20:15:04 +0200
parents 64e8cd965e79
children 71c5920fb43e
comparison
equal deleted inserted replaced
32269:2ecf1b612ae7 32270:d542423ef5c9
993 interface Some 993 interface Some
994 static count: number 994 static count: number
995 def Method(count: number) 995 def Method(count: number)
996 endinterface 996 endinterface
997 END 997 END
998 v9.CheckScriptFailure(lines, 'E1340: Argument already declared in the class: count') 998 v9.CheckScriptFailure(lines, 'E1340: Argument already declared in the class: count', 5)
999 999
1000 lines =<< trim END 1000 lines =<< trim END
1001 vim9script 1001 vim9script
1002 1002
1003 interface Some 1003 interface Some
1004 this.value: number 1004 this.value: number
1005 def Method(value: number) 1005 def Method(value: number)
1006 endinterface 1006 endinterface
1007 END 1007 END
1008 v9.CheckScriptFailure(lines, 'E1340: Argument already declared in the class: value') 1008 # The argument name and the object member name are the same, but this is not a
1009 # problem because object members are always accessed with the "this." prefix.
1010 v9.CheckScriptSuccess(lines)
1009 1011
1010 lines =<< trim END 1012 lines =<< trim END
1011 vim9script 1013 vim9script
1012 interface somethingWrong 1014 interface somethingWrong
1013 static count = 7 1015 static count = 7