https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112019-12-20T02:00:13ZRuby Issue Tracking SystemRuby master - Bug #16438: Check warning messages for Ruby 2.7https://bugs.ruby-lang.org/issues/16438?journal_id=832692019-12-20T02:00:13Zosyo (manga osyo)
<ul></ul><blockquote>
</blockquote>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="k">def</span> <span class="nf">_1</span><span class="p">;</span> <span class="k">end</span>
<span class="c1">#=> test.rb:1: warning: `_1' is used as numbered parameter</span>
</code></pre>
<p><del>Warn by parameter name instead of method name.</del></p>
<p>Became warning.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="c1"># warning: `_1' is used as numbered parameter</span>
<span class="k">def</span> <span class="nf">_1</span><span class="p">;</span> <span class="k">end</span>
<span class="c1"># warning: `_1' is used as numbered parameter</span>
<span class="k">def</span> <span class="nf">hoge</span><span class="p">(</span><span class="n">_1</span><span class="p">);</span> <span class="k">end</span>
</code></pre> Ruby master - Bug #16438: Check warning messages for Ruby 2.7https://bugs.ruby-lang.org/issues/16438?journal_id=832722019-12-20T02:50:53Zko1 (Koichi Sasada)
<ul></ul><pre><code class="ruby syntaxhl" data-language="ruby"><span class="vg">$SAFE</span> <span class="o">=</span> <span class="mi">1</span>
<span class="c1">#=> t.rb:1: warning: $SAFE will become a normal global variable in Ruby 3.0</span>
</code></pre>
<blockquote>
<a name="no-warning"></a>
<h1 >no warning<a href="#no-warning" class="wiki-anchor">¶</a></h1>
</blockquote>
<p>pls check current master.</p> Ruby master - Bug #16438: Check warning messages for Ruby 2.7https://bugs.ruby-lang.org/issues/16438?journal_id=832732019-12-20T02:56:05Zosyo (manga osyo)
<ul></ul><blockquote>
<p>pls check current master.</p>
</blockquote>
<p>Sorry, became warning.</p> Ruby master - Bug #16438: Check warning messages for Ruby 2.7https://bugs.ruby-lang.org/issues/16438?journal_id=832782019-12-20T05:38:56Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>Applied in changeset <a class="changeset" title="Refined the warning message for numbered-parameter like variables [Bug #16438]" href="https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/a8bddb3a189545a2bef8ee7cffdb328d8de7974c">git|a8bddb3a189545a2bef8ee7cffdb328d8de7974c</a>.</p>
<hr>
<p>Refined the warning message for numbered-parameter like variables</p>
<p>[Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Check warning messages for Ruby 2.7 (Closed)" href="https://bugs.ruby-lang.org/issues/16438">#16438</a>]</p> Ruby master - Bug #16438: Check warning messages for Ruby 2.7https://bugs.ruby-lang.org/issues/16438?journal_id=832812019-12-20T06:00:06Zko1 (Koichi Sasada)
<ul></ul><p>At developer's meeting, the followings are proposed. They will be merged into Ruby 2.7 RC2.</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="k">def</span> <span class="nf">foo</span><span class="p">(</span><span class="o">**</span><span class="n">kw</span><span class="p">)</span>
<span class="k">end</span>
<span class="n">foo</span><span class="p">({})</span>
<span class="c1"># current:</span>
<span class="c1">#=> test.rb:4: warning: The last argument is used as the keyword parameter</span>
<span class="c1"># test.rb:1: warning: for `foo' defined here; maybe ** should be added to the call?</span>
<span class="c1"># modified (conclusion):</span>
<span class="c1">#=> test.rb:4: warning: The last argument is used as keyword parameters; maybe ** should be added to the call</span>
<span class="c1"># test.rb:1: warning: The called method `foo' is defined here</span>
</code></pre>
<pre><code># t.rb:1: warning: `_1' is used as numbered parameter
->
# t.rb:1: warning: `_1' is reserved for numbered parameter; consider another name
</code></pre>
<pre><code>#=> t.rb:1: warning: non-nil $; will be deprecated
=>
#=> t.rb:1: warning: `$;' is deprecated
</code></pre> Ruby master - Bug #16438: Check warning messages for Ruby 2.7https://bugs.ruby-lang.org/issues/16438?journal_id=835962020-01-02T15:30:50Zpuchuu (Andrew Aladjev)aladjev.andrew@gmail.com
<ul></ul><p>Hello. I can't understand why setting OFS to not nil value was deprecated. I want to simulate print method behaviour and I am using <code>$OUTPUT_FIELD_SEPARATOR</code> between objects. Than I want to test this method, so I am settings OFS to not nil value in tests. Ruby 2.7.0 throws deprecated warning.</p> Ruby master - Bug #16438: Check warning messages for Ruby 2.7https://bugs.ruby-lang.org/issues/16438?journal_id=836002020-01-02T17:23:29Zpuchuu (Andrew Aladjev)aladjev.andrew@gmail.com
<ul></ul><p>I see the only one way to fix this deprecation. Change <code>write(*objects)</code> signature to <code>print(*objects, field_separator: $OUTPUT_FIELD_SEPARATOR, record_separator: $OUTPUT_RECORD_SEPARATOR)</code> and test print by passing separators directly. Will ruby change print signature in the same way?</p>