diff options
author | Jeremy Evans <code@jeremyevans.net> | 2019-05-04 21:33:58 -0700 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-05-05 14:46:39 +0900 |
commit | b8f3be295b694964e88960c0228459b8aadd114a (patch) | |
tree | 4c4488f45e9ccfb2711e00d0289fb74ebffe42ee /test | |
parent | 374c8f4ebab1a740990330c732b9de965c5e8d10 (diff) | |
download | ruby-b8f3be295b694964e88960c0228459b8aadd114a.tar.gz |
Fix a case where numbered parameters should not be allowed
Because `proc{|| @1}` is a syntax error, the following should
also be syntax errors:
```ruby
proc { |
| @1}
```
```ruby
proc { |; a| @1 }
```
This fixes both cases.
[Bug #15825]
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_syntax.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index ff8c62f6a1..f2df65fb6c 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -1313,6 +1313,8 @@ eom assert_equal("12", eval('[1,2].then {"#@1#@2"}')) assert_equal(3, eval('->{@1+@2}.call(1,2)')) assert_syntax_error('proc {|| @1}', /ordinary parameter is defined/) + assert_syntax_error('proc {|;a| @1}', /ordinary parameter is defined/) + assert_syntax_error("proc {|\n| @1}", /ordinary parameter is defined/) assert_syntax_error('proc {|x| @1}', /ordinary parameter is defined/) assert_syntax_error('->(){@1}', /ordinary parameter is defined/) assert_syntax_error('->(x){@1}', /ordinary parameter is defined/) |