Project

General

Profile

Actions

Bug #16092

closed

[doc] precedence of modifier-rescue

Added by Dan0042 (Daniel DeLorme) over 4 years ago. Updated over 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:94221]

Description

The docs state that modifier-rescue has higher precedence than assignments which have higher precedence than modifier-if. This is true for
v = expr rescue $! if condition but not for
v = expr if condition rescue $! which is treated as
(v = expr if condition) rescue $! rather than
v = expr if (condition rescue $!)

This goes similarly for
defined? expr rescue $!
not expr rescue $!
expr1 and expr2 rescue $!
expr1 or expr2 rescue $!

So maybe the documentation should state that modifier-rescue has equal precedence to modifier-if & others, with an exception made for assignments? I'm not entirely sure how to describe that exception though.


Files

modifier-statements.patch (3.74 KB) modifier-statements.patch Dan0042 (Daniel DeLorme), 08/09/2019 06:45 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0