Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
31719:de70d5c5ef88 | 31720:1949c2613b3e |
---|---|
637 interface Some | 637 interface Some |
638 static count: number | 638 static count: number |
639 def Method(count: number) | 639 def Method(count: number) |
640 endinterface | 640 endinterface |
641 END | 641 END |
642 # TODO: this should give an error for "count" shadowing | 642 v9.CheckScriptFailure(lines, 'E1340: Argument already declared in the class: count') |
643 v9.CheckScriptSuccess(lines) | 643 |
644 lines =<< trim END | |
645 vim9script | |
646 | |
647 interface Some | |
648 this.value: number | |
649 def Method(value: number) | |
650 endinterface | |
651 END | |
652 v9.CheckScriptFailure(lines, 'E1340: Argument already declared in the class: value') | |
644 | 653 |
645 lines =<< trim END | 654 lines =<< trim END |
646 vim9script | 655 vim9script |
647 interface somethingWrong | 656 interface somethingWrong |
648 static count = 7 | 657 static count = 7 |