Issue #16453 has been reported by jnchito (Junichi Ito).

----------------------------------------
Bug #16453: irb crashes when using array literal and heredoc
https://bugs.ruby-lang.org/issues/16453

* Author: jnchito (Junichi Ito)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
I wanted to type like this:

``` ruby
[<<FOO]
hello
FOO
```


But IRB crashed after input "hello" (and return):

``` 
irb(main):001:-" [<<FOO]
irb(main):002:-" helloTraceback (most recent call last):
	32: from /Users/jnito/.rbenv/versions/2.7.0/bin/irb:23:in `<main>'
	31: from /Users/jnito/.rbenv/versions/2.7.0/bin/irb:23:in `load'
	30: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/irb-1.2.1/exe/irb:11:in `<top (required)>'
	29: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/irb.rb:398:in `start'
	28: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/irb.rb:469:in `run'
	27: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/irb.rb:469:in `catch'
	26: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/irb.rb:470:in `block in run'
	25: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/irb.rb:535:in `eval_input'
	24: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/irb/ruby-lex.rb:134:in `each_top_level_statement'
	23: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/irb/ruby-lex.rb:134:in `catch'
	22: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/irb/ruby-lex.rb:135:in `block in each_top_level_statement'
	21: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/irb/ruby-lex.rb:135:in `loop'
	20: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/irb/ruby-lex.rb:138:in `block (2 levels) in each_top_level_statement'
	19: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/irb/ruby-lex.rb:166:in `lex'
	18: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/irb.rb:516:in `block in eval_input'
	17: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/irb.rb:693:in `signal_status'
	16: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/irb.rb:517:in `block (2 levels) in eval_input'
	15: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/irb/input-method.rb:258:in `gets'
	14: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/forwardable.rb:235:in `readmultiline'
	13: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/forwardable.rb:235:in `readmultiline'
	12: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/reline.rb:170:in `readmultiline'
	11: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/reline.rb:232:in `inner_readline'
	10: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/reline.rb:232:in `loop'
	 9: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/reline.rb:233:in `block in inner_readline'
	 8: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/reline.rb:262:in `read_io'
	 7: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/reline.rb:262:in `loop'
	 6: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/reline.rb:303:in `block in read_io'
	 5: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/reline.rb:234:in `block (2 levels) in inner_readline'
	 4: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/reline.rb:234:in `each'
	 3: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/reline.rb:235:in `block (3 levels) in inner_readline'
	 2: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/reline/line_editor.rb:835:in `input_key'
	 1: from /Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/reline/line_editor.rb:855:in `process_auto_indent'
/Users/jnito/.rbenv/versions/2.7.0/lib/ruby/2.7.0/reline/line_editor.rb:855:in `*': negative argument (ArgumentError)
```





-- 
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>