Ruby Issue Tracking System: Issueshttps://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112016-01-14T13:41:44ZRuby Issue Tracking System
Redmine Ruby master - Bug #11990 (Closed): Dedenting heredoc interacts poorly with string concatenationhttps://bugs.ruby-lang.org/issues/119902016-01-14T13:41:44Zwhitequark (whitequark *)whitequark@whitequark.org
<p>The following code reproduces the problem:</p>
<pre><code>p <<~E " y"
x
E
</code></pre>
<p>It prints <code>"x\ny"</code>, but the second string is not dedenting. It should print <code>"x\n y"</code>.</p> Ruby master - Bug #11989 (Closed): Dedenting interpolating heredoc can interpret escapes incorrectlyhttps://bugs.ruby-lang.org/issues/119892016-01-14T12:45:56Zwhitequark (whitequark *)whitequark@whitequark.org
<p>It is clear that the dedenting <<~HEREDOC feature was intended to only consider actual whitespace in the source file as indentation, not any escaped whitespace. E.g.:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">p</span> <span class="o"><<~</span><span class="no">"E"</span><span class="sh">
</span><span class="se">\ </span><span class="sh">x
y
</span><span class="no">E</span>
</code></pre>
<p>It prints <code>" x\n y\n"</code>. So <code>"\ "</code> does not count as whitespace. There is even an MRI test for this.</p>
<p>However, this case is handled differently:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="nb">p</span> <span class="o"><<~</span><span class="no">"E"</span><span class="sh">
x</span><span class="se">\n</span><span class="sh"> y
</span><span class="no">E</span>
</code></pre>
<p>It prints <code>"x\n y\n"</code>. So <code>"\n"</code> is counted as whitespace, like an actual newline would be. I think it should print <code>"x\n y\n"</code>.</p> Ruby master - Bug #11849 (Closed): Heredoc regression in 2.2.4https://bugs.ruby-lang.org/issues/118492015-12-19T23:59:41Zwhitequark (whitequark *)whitequark@whitequark.org
<p>The following code gets rejected by 2.2.4:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="p">{</span>
<span class="n">label</span><span class="ss">:<<</span><span class="o">-</span><span class="no">DOC</span>
<span class="no">Some</span> <span class="n">text</span> <span class="k">for</span> <span class="n">a</span> <span class="n">heredoc</span> <span class="n">goes</span> <span class="n">here</span>
<span class="no">DOC</span>
<span class="p">}</span>
</code></pre>
<p>However, it was valid in 2.2.3.</p>
<p>I think this might have been introduced in r51617 (<a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: do-end block in ternary operator is syntax error (Closed)" href="https://bugs.ruby-lang.org/issues/10653">#10653</a>).</p> Ruby master - Bug #10578 (Closed): Allow undefining methods in refinementshttps://bugs.ruby-lang.org/issues/105782014-12-08T10:09:28Zwhitequark (whitequark *)whitequark@whitequark.org
<p>Since refinements are locally scoped monkey patches, and it is possible and useful to undef a method globally, I think refinements should allow to undef methods as well as def them.</p>
<p>For example:</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="k">module</span> <span class="nn">NoPlus</span>
<span class="n">refine</span> <span class="no">String</span> <span class="k">do</span>
<span class="k">undef</span> <span class="o">+</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="n">using</span> <span class="no">NoPlus</span>
<span class="s2">"a"</span> <span class="o">+</span> <span class="s2">"b"</span>
</code></pre>
<p>Expected behavior: undefined method `+' for "a":String<br>
Actual behavior: undef ignored</p> Ruby master - Bug #8670 (Rejected): "100do" should be a syntax errorhttps://bugs.ruby-lang.org/issues/86702013-07-23T18:18:24Zwhitequark (whitequark *)whitequark@whitequark.org
<p>=begin<br>
In certain contexts, `do' adjacent to a number can be parsed as a distinct token instead of syntax error.</p>
<p>For example:</p>
<p>(({Shoes.app width: 330do end}))<br>
=end</p>