From: nagachika00@... Date: 2017-08-05T02:22:53+00:00 Subject: [ruby-core:82251] [Ruby trunk Bug#13540] can't set length of shared string (RuntimeError) when interpolating __FILE__ in a heredoc Issue #13540 has been updated by nagachika (Tomoyuki Chikanaga). Backport changed from 2.2: DONTNEED, 2.3: DONTNEED, 2.4: REQUIRED to 2.2: DONTNEED, 2.3: DONTNEED, 2.4: DONE ruby_2_4 r59513 merged revision(s) 58561. ---------------------------------------- Bug #13540: can't set length of shared string (RuntimeError) when interpolating __FILE__ in a heredoc https://bugs.ruby-lang.org/issues/13540#change-66031 * Author: kylerippey (Kyle Rippey) * Status: Closed * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16] * Backport: 2.2: DONTNEED, 2.3: DONTNEED, 2.4: DONE ---------------------------------------- There appears to be a bug in Ruby 2.4.0 and 2.4.1 when interpolating `__FILE__` inside of a heredoc. In fact, no code in this file executes when this interpolation is present. Almost as if it's a syntax error, but it's reported as a RuntimeError. ~~~ ruby # Works in Ruby 2.3 and 2.4 puts "#{__FILE__}" # Works in Ruby 2.3 and 2.4 x = __FILE__ puts <<~HEREDOC #{x} HEREDOC # Works in Ruby 2.3 # Raises exception in Ruby 2.4: can't set length of shared string (RuntimeError) puts <<~HEREDOC #{__FILE__} HEREDOC ~~~ -- https://bugs.ruby-lang.org/ Unsubscribe: