Project

General

Profile

Actions

Bug #18966

open

Strange behavior when numbered parameters and method definition are both used in a block

Added by tompng (tomoya ishida) about 2 years ago. Updated 11 months ago.

Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 3.2.0dev (2022-08-19T04:20:20Z :detached: 17d0e5bee7) [x86_64-linux]
[ruby-core:109569]

Description

'a'.tap { p _1; def f()=42 } #=> "a"
'a'.tap { p _1; def f(a)=42 } #=> nil
'a'.tap { def f()=42; p _1 } #=> "a"
'a'.tap { def f(a)=42; p _1 } # Syntax Error -:1: ordinary parameter is defined

Related issues 1 (0 open1 closed)

Has duplicate Ruby master - Bug #20062: Numbered parameters are broken in Ruby 3.3-devClosednobu (Nobuyoshi Nakada)Actions

Updated by fcheung (Frederick Cheung) 12 months ago

Ruby 3.2.2 exhibits the same behaviour as above but on master ( as of b1f345b1 ) all of these now evaluate to 'a'

Actions #2

Updated by nobu (Nobuyoshi Nakada) 11 months ago

  • Backport changed from 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN to 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED
Actions #3

Updated by nobu (Nobuyoshi Nakada) 11 months ago

  • Has duplicate Bug #20062: Numbered parameters are broken in Ruby 3.3-dev added
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0