From: nobu@... Date: 2017-10-17T09:30:04+00:00 Subject: [ruby-core:83320] [Ruby trunk Bug#13872] Duplicate assignment no longer silences "assigned but unused variable" warning Issue #13872 has been updated by nobu (Nobuyoshi Nakada). There could be: 1. add assignments in user code 2. enable duplicate assignment as a special case 3. add another way to suppress warnings, e.g. magic comment 4. etc ---------------------------------------- Bug #13872: Duplicate assignment no longer silences "assigned but unused variable" warning https://bugs.ruby-lang.org/issues/13872#change-67276 * 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: