diff --git a/lib/key_tree/tree.rb b/lib/key_tree/tree.rb
index <HASH>..<HASH> 100644
--- a/lib/key_tree/tree.rb
+++ b/lib/key_tree/tree.rb
@@ -30,16 +30,16 @@ module KeyTree
       super(keys.map { |key_or_path| Path[key_or_path] })
     end
 
-    def []=(key_or_path, value)
+    def []=(key_or_path, new_value)
       path = Path[key_or_path]
 
       each_key { |key| delete(key) if path.prefix?(key) || key.prefix?(path) }
 
-      case value
+      case new_value
       when KeyTree
-        each_value { |suffix, value| super(path + suffix, value) }
+        new_value.each { |suffix, value| super(path + suffix, value) }
       else
-        super(path, value)
+        super(path, new_value)
       end
     end
Fix variable name shadowing

Rename `value` to `new_value` in the outer scope of Tree#[]= to remove name shadowing in inner iteration over subkeys in the case of assigning a KeyTree value.