https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112018-10-10T11:04:38ZRuby Issue Tracking SystemRuby master - Bug #15188: Incorrect warning "assigned but unused variable" when using ripper with $VERBOSE = truehttps://bugs.ruby-lang.org/issues/15188?journal_id=743972018-10-10T11:04:38Znagachika (Tomoyuki Chikanaga)nagachika00@gmail.com
<ul><li><strong>Backport</strong> changed from <i>2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN</i> to <i>2.3: DONTNEED, 2.4: DONTNEED, 2.5: REQUIRED</i></li></ul> Ruby master - Bug #15188: Incorrect warning "assigned but unused variable" when using ripper with $VERBOSE = truehttps://bugs.ruby-lang.org/issues/15188?journal_id=812022019-08-27T19:02:27Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>File</strong> <a href="/attachments/8026">ripper-assign-unused-15188.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/8026/ripper-assign-unused-15188.patch">ripper-assign-unused-15188.patch</a> added</li></ul><p>Ripper doesn't track usage of local variables as far as I can see. In <code>parse.y</code>, <code>LVAR_USED</code> is used to mark local variables as being used. In normal compilation mode, this is set by <code>mark_lvar_used</code>, called by <code>value_expr_check</code>, called by <code>value_expr_gen</code> (aliased to <code>value_expr</code>). In ripper mode, <code>#define value_expr(node) ((void)(node))</code>. It seems best to just not attempt to print unused variable warnings in ripper, which the attached patch does.</p> Ruby master - Bug #15188: Incorrect warning "assigned but unused variable" when using ripper with $VERBOSE = truehttps://bugs.ruby-lang.org/issues/15188?journal_id=829542019-12-04T01:04:50Zjeremyevans (Jeremy Evans)code@jeremyevans.net
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>Applied in changeset <a class="changeset" title="Silence incorrect assigned but unused variable warnings in ripper To only emit the warnings in c..." href="https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/447d583536274a2489efc8792653ad35d6f7128a">git|447d583536274a2489efc8792653ad35d6f7128a</a>.</p>
<hr>
<p>Silence incorrect assigned but unused variable warnings in ripper</p>
<p>To only emit the warnings in correct cases would require tracking<br>
local variable usage in ripper, which ripper currently does not do.</p>
<p>Fixes [Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Incorrect warning "assigned but unused variable" when using ripper with $VERBOSE = true (Closed)" href="https://bugs.ruby-lang.org/issues/15188">#15188</a>]</p>