Issue #7539 has been updated by duerst (Martin Dürst). File patch#7539.txt added Target version changed from 1.9.3 to next minor rosenfeld (Rodrigo Rosenfeld Rosas) wrote: > kosaki (Motohiro KOSAKI) wrote: > > I support "can't append nil to string" error. > > I'd prefer a more descriptive message like: > > "can't append nil to string (object doesn't respond to `to_str`)" Looking at the implementation, a "can't append" would need some special code. A message such as ""can't convert nil into String (using to_str)" would be relatively easy to generate. I have attached a patch (not compiled or tested, sorry). This change would show up in many other places that use the same conversion logic, so let's make sure we really want it. ---------------------------------------- Bug #7539: Misleading error message "can't convert nil into string" https://bugs.ruby-lang.org/issues/7539#change-34598 Author: connec (Chris Connelly) Status: Open Priority: Normal Assignee: Category: core Target version: next minor ruby -v: ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux] When trying to call `String#+` with `nil` as an argument, you get the error "can't convert nil into String", which does not make sense (in fact seeming blatantly false) as `nil.to_s`, `String(nil)` etc. all return `''` without errors. Ideally, this method should use `to_s` to convert the argument, or else report an error along the lines of "can't append nil to string". Minimal test case: Actual: > '' + nil TypeError: can't convert nil into String Expected: > '' + nil '' -- http://bugs.ruby-lang.org/