Issue #15535 has been reported by waheedi (Waheed Barghouthi).

----------------------------------------
Bug #15535: Optional arguments for definition - Syntax Error is not the correct Error type
https://bugs.ruby-lang.org/issues/15535

* Author: waheedi (Waheed Barghouthi)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.6.0p0
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
The below definition throws a syntax Error, while it there is no syntax error and I'm not sure what is the intention behind the Syntax error

`def hello(foo="bar", bar, yanko="me")`
`p "Hello"`
`end`

The same definition below with a tiny modification in the argument set, give a Syntax OK.

`def hello(foo="bar", bar="foo", yanko="me")`
`p "Hello"`
`end`

It seems when there is a required argument in the definition that happens to be in between optional arguments that is a Syntax Error, I think another Error should be triggered if that intended to be made by design to error!

This has been tested on mostly every ruby version after 1.8.7 and its gave the same result.




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>