Issue #22007 has been updated by kddnewton (Kevin Newton). We can't change this without breaking user code. Things like ``` irb(main):003> def resolve; SyntaxError; end => :resolve irb(main):004> begin; raise SyntaxError, 'lol'; rescue resolve; end => nil irb(main):005> begin; raise ArgumentError, 'lol'; rescue resolve; end (irb):5:in '<main>': lol (ArgumentError) ``` exist. Most expression can potentially resolve to a value, so eliminating the ones that don't doesn't really help. You'd really only be getting rid of things like while loops and that'd be about it. ---------------------------------------- Bug #22007: Inconsistent type checking on rescue https://bugs.ruby-lang.org/issues/22007#change-117072 * Author: zenspider (Ryan Davis) * Status: Open * ruby -v: 4.0.2 * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- this works fine (but I don't think it should): ```ruby begin raise "nope" rescue RuntimeError, /why am I allowed?/, "or me?" => e # yay end ``` whereas this version shows a type error, which seems right: ```ruby begin begin raise "nope" rescue /why am I NOT allowed/, "if I was allowed before?" => e p e end rescue TypeError => te p te end ``` I think all the args on rescue should be checked to be `Module` -- https://bugs.ruby-lang.org/