Project

General

Profile

Bug #18080

Updated by ko1 (Koichi Sasada) over 3 years ago

One line pattern matching with a method Method return value with parameters which are not surrounded    by parenthesis without perenties raises syntax error.  
 I think it is not intentional, but nobu said it's hard to support because of parse.y limitation. 

 ```ruby 
 p do 
 end => a 
 p a #=> nil 

 p(1) do 
 end => a 
 p a #=> 1 

 p 1 do 
 end => a 
 #=>  
 # syntax error, unexpected =>, expecting end-of-input 
 # end => a 
 #      ^~ 

 p 1 do 
 end in a 
 #=>  
 # syntax error, unexpected `in', expecting end-of-input 
 # end in a 
 #       ^~ 
 ``` 

Back