From: merch-redmine@... Date: 2020-02-02T02:10:59+00:00 Subject: [ruby-core:97041] [Ruby master Bug#16599] did_you_mean is not activated for NameError and KeyError Issue #16599 has been updated by jeremyevans0 (Jeremy Evans). Status changed from Open to Closed As @zverok 's analysis shows, did_you_mean does activate for NameError and KeyError if it can find suggestions. As for not suggesting `for` for `foo` in `NameError` but doing so for `NoMethodError`, I can't tell if that is a bug in did_you_mean. It doesn't seem to be general behavior for keywords, since did_you_mean recommends `while` for `whil` in both cases. If you think it is a bug in did_you_mean, you may want to file it upstream: https://github.com/ruby/did_you_mean/issues ---------------------------------------- Bug #16599: did_you_mean is not activated for NameError and KeyError https://bugs.ruby-lang.org/issues/16599#change-84134 * Author: sawa (Tsuyoshi Sawada) * Status: Closed * Priority: Normal * Assignee: yuki24 (Yuki Nishijima) * ruby -v: 2.6, 2.7, perhaps for earlier versions too * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- [This document](https://www.rubydoc.info/gems/did_you_mean/) claims that the did_you_mean gem responds to NameError, NoMethodError, and KeyError, but it actually seems to only respond to NoMethodError. ```ruby foo() # >> NoMethodError: undefined method `foo' for main:Object # >> Did you mean? for foo # >> NameError: undefined local variable or method `foo' for main:Object Foo # >> NameError: uninitialized constant Foo {foo: 1}.fetch(:bar) # >> KeyError: key not found: :bar ``` -- https://bugs.ruby-lang.org/ Unsubscribe: