[#83107] Alias Enumerable#include? to Enumerable#includes? — Alberto Almagro <albertoalmagro@...>

Hello,

9 messages 2017/10/04

[ruby-core:83318] [Ruby trunk Bug#13872] Duplicate assignment no longer silences "assigned but unused variable" warning

From: ronnie@...
Date: 2017-10-17 00:16:26 UTC
List: ruby-core #83318
Issue #13872 has been updated by matsuda (Akira Matsuda).


Yes, in my understanding that is exactly the case we use this idiom for, usually when the contents of ERB is user-given and so it's uncertain if the local variable 'foo' will be used there or not.

```diff
 require 'erb'
-foo = :bar
+foo = :bar; foo = foo
 puts ERB.new('<%= foo %>').result(binding)
```


----------------------------------------
Bug #13872: Duplicate assignment no longer silences "assigned but unused variable" warning
https://bugs.ruby-lang.org/issues/13872#change-67274

* Author: segiddins (Samuel Giddins)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.5.0dev (2017-09-04 trunk 59742) [x86_64-darwin16]
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
On ruby 2.4.1:

`ruby -W -e 'def a; var = var = "foo"; end'`

prints no warning

On ruby 2.5.0dev (2017-09-04 trunk 59742) [x86_64-darwin16]

`ruby -W -e 'def a; var = var = "foo"; end'`

prints warning `-e:1: warning: assigned but unused variable - var`

This feature was useful when the local binding would be passed to another scope (like to ERB), and those variables were only accessed via the binding



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next