[ruby-core:115912] [Ruby master Bug#20090] Anonymous arguments are now syntax errors in unambiguous cases

Issue #20090 has been reported by willcosgrove (Will Cosgrove). ---------------------------------------- Bug #20090: Anonymous arguments are now syntax errors in unambiguous cases https://bugs.ruby-lang.org/issues/20090 * Author: willcosgrove (Will Cosgrove) * Status: Open * Priority: Normal * ruby -v: ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23] * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- It looks like the changes that were made in #19370 may have gone further than intended. It's also possible I'm misunderstanding what decision was made. But it was my understanding that the goal was to make ambiguous cases a syntax error. The test cases added are all testing the ambiguous cases: ```rb assert_syntax_error("def b(&) ->(&) {c(&)} end", /anonymous block parameter is also used/) # ... assert_syntax_error("def b(*) ->(*) {c(*)} end", /anonymous rest parameter is also used/) assert_syntax_error("def b(a, *) ->(*) {c(1, *)} end", /anonymous rest parameter is also used/) assert_syntax_error("def b(*) ->(a, *) {c(*)} end", /anonymous rest parameter is also used/) # ... assert_syntax_error("def b(**) ->(**) {c(**)} end", /anonymous keyword rest parameter is also used/) assert_syntax_error("def b(k:, **) ->(**) {c(k: 1, **)} end", /anonymous keyword rest parameter is also used/) assert_syntax_error("def b(**) ->(k:, **) {c(**)} end", /anonymous keyword rest parameter is also used/) ``` However it is now also producing syntax errors in all of these cases: ```rb def b(&) -> { c(&) } end def b(*) -> { c(*) } end def b(a, *) -> { c(1, *) } end def b(*) ->(a) { c(a, *) } end def b(**) -> { c(**) } end def b(k:, **) -> { c(k: 1, **) } end def b(**) ->(k:) { c(k:, **) } end ``` Again, it's possible I misunderstood the scope of the previous change. But it would be sad to lose the unambiguous case, as I've used that pattern quite a bit in my own projects. This is my first time opening an issue here, so I apologize in advance if I've done anything non-standard. -- https://bugs.ruby-lang.org/

Issue #20090 has been updated by nobu (Nobuyoshi Nakada). Status changed from Open to Closed Backport changed from 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN to 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: REQUIRED Fixed by commit:596db9c1f486d6609a4e97d82c8c71b54609fb6f ---------------------------------------- Bug #20090: Anonymous arguments are now syntax errors in unambiguous cases https://bugs.ruby-lang.org/issues/20090#change-105869 * Author: willcosgrove (Will Cosgrove) * Status: Closed * Priority: Normal * ruby -v: ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23] * Backport: 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: REQUIRED ---------------------------------------- It looks like the changes that were made in #19370 may have gone further than intended. It's also possible I'm misunderstanding what decision was made. But it was my understanding that the goal was to make ambiguous cases a syntax error. The test cases added are all testing the ambiguous cases: ```rb assert_syntax_error("def b(&) ->(&) {c(&)} end", /anonymous block parameter is also used/) # ... assert_syntax_error("def b(*) ->(*) {c(*)} end", /anonymous rest parameter is also used/) assert_syntax_error("def b(a, *) ->(*) {c(1, *)} end", /anonymous rest parameter is also used/) assert_syntax_error("def b(*) ->(a, *) {c(*)} end", /anonymous rest parameter is also used/) # ... assert_syntax_error("def b(**) ->(**) {c(**)} end", /anonymous keyword rest parameter is also used/) assert_syntax_error("def b(k:, **) ->(**) {c(k: 1, **)} end", /anonymous keyword rest parameter is also used/) assert_syntax_error("def b(**) ->(k:, **) {c(**)} end", /anonymous keyword rest parameter is also used/) ``` However it is now also producing syntax errors in all of these cases: ```rb def b(&) -> { c(&) } end def b(*) -> { c(*) } end def b(a, *) -> { c(1, *) } end def b(*) ->(a) { c(a, *) } end def b(**) -> { c(**) } end def b(k:, **) -> { c(k: 1, **) } end def b(**) ->(k:) { c(k:, **) } end ``` Again, it's possible I misunderstood the scope of the previous change. But it would be sad to lose the unambiguous case, as I've used that pattern quite a bit in my own projects. This is my first time opening an issue here, so I apologize in advance if I've done anything non-standard. -- https://bugs.ruby-lang.org/

Issue #20090 has been updated by matheusrich (Matheus Richard). @nobu should we expect a 3.3.1 release soon? ---------------------------------------- Bug #20090: Anonymous arguments are now syntax errors in unambiguous cases https://bugs.ruby-lang.org/issues/20090#change-106003 * Author: willcosgrove (Will Cosgrove) * Status: Closed * Priority: Normal * ruby -v: ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23] * Backport: 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: REQUIRED ---------------------------------------- It looks like the changes that were made in #19370 may have gone further than intended. It's also possible I'm misunderstanding what decision was made. But it was my understanding that the goal was to make ambiguous cases a syntax error. The test cases added are all testing the ambiguous cases: ```rb assert_syntax_error("def b(&) ->(&) {c(&)} end", /anonymous block parameter is also used/) # ... assert_syntax_error("def b(*) ->(*) {c(*)} end", /anonymous rest parameter is also used/) assert_syntax_error("def b(a, *) ->(*) {c(1, *)} end", /anonymous rest parameter is also used/) assert_syntax_error("def b(*) ->(a, *) {c(*)} end", /anonymous rest parameter is also used/) # ... assert_syntax_error("def b(**) ->(**) {c(**)} end", /anonymous keyword rest parameter is also used/) assert_syntax_error("def b(k:, **) ->(**) {c(k: 1, **)} end", /anonymous keyword rest parameter is also used/) assert_syntax_error("def b(**) ->(k:, **) {c(**)} end", /anonymous keyword rest parameter is also used/) ``` However it is now also producing syntax errors in all of these cases: ```rb def b(&) -> { c(&) } end def b(*) -> { c(*) } end def b(a, *) -> { c(1, *) } end def b(*) ->(a) { c(a, *) } end def b(**) -> { c(**) } end def b(k:, **) -> { c(k: 1, **) } end def b(**) ->(k:) { c(k:, **) } end ``` Again, it's possible I misunderstood the scope of the previous change. But it would be sad to lose the unambiguous case, as I've used that pattern quite a bit in my own projects. This is my first time opening an issue here, so I apologize in advance if I've done anything non-standard. -- https://bugs.ruby-lang.org/

Issue #20090 has been updated by naruse (Yui NARUSE). Backport changed from 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: REQUIRED to 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONE ruby_3_3 f8f0d342e48a38caac6d32b438c145bb581a51e6 merged revision(s) 3d19409637de1462b6790d2a92344bf0a10d8c52. ---------------------------------------- Bug #20090: Anonymous arguments are now syntax errors in unambiguous cases https://bugs.ruby-lang.org/issues/20090#change-106522 * Author: willcosgrove (Will Cosgrove) * Status: Closed * Priority: Normal * ruby -v: ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23] * Backport: 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONE ---------------------------------------- It looks like the changes that were made in #19370 may have gone further than intended. It's also possible I'm misunderstanding what decision was made. But it was my understanding that the goal was to make ambiguous cases a syntax error. The test cases added are all testing the ambiguous cases: ```rb assert_syntax_error("def b(&) ->(&) {c(&)} end", /anonymous block parameter is also used/) # ... assert_syntax_error("def b(*) ->(*) {c(*)} end", /anonymous rest parameter is also used/) assert_syntax_error("def b(a, *) ->(*) {c(1, *)} end", /anonymous rest parameter is also used/) assert_syntax_error("def b(*) ->(a, *) {c(*)} end", /anonymous rest parameter is also used/) # ... assert_syntax_error("def b(**) ->(**) {c(**)} end", /anonymous keyword rest parameter is also used/) assert_syntax_error("def b(k:, **) ->(**) {c(k: 1, **)} end", /anonymous keyword rest parameter is also used/) assert_syntax_error("def b(**) ->(k:, **) {c(**)} end", /anonymous keyword rest parameter is also used/) ``` However it is now also producing syntax errors in all of these cases: ```rb def b(&) -> { c(&) } end def b(*) -> { c(*) } end def b(a, *) -> { c(1, *) } end def b(*) ->(a) { c(a, *) } end def b(**) -> { c(**) } end def b(k:, **) -> { c(k: 1, **) } end def b(**) ->(k:) { c(k:, **) } end ``` Again, it's possible I misunderstood the scope of the previous change. But it would be sad to lose the unambiguous case, as I've used that pattern quite a bit in my own projects. This is my first time opening an issue here, so I apologize in advance if I've done anything non-standard. -- https://bugs.ruby-lang.org/

Issue #20090 has been updated by eliotp123 (Eliot Partridge). @naruse Hi - I'm new around here. I was poking around this bug as it affects our codebase at work, and I think the wrong commit may have been flagged as the backport for this bug? Checking the Git tree, I don't see 596db9c1f486d6609a4e97d82c8c71b54609fb6f as having been backported to the `ruby_3_3` branch. Just wanted to know if this was going to make it in for 3.3.1? ---------------------------------------- Bug #20090: Anonymous arguments are now syntax errors in unambiguous cases https://bugs.ruby-lang.org/issues/20090#change-106734 * Author: willcosgrove (Will Cosgrove) * Status: Closed * Priority: Normal * ruby -v: ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23] * Backport: 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONE ---------------------------------------- It looks like the changes that were made in #19370 may have gone further than intended. It's also possible I'm misunderstanding what decision was made. But it was my understanding that the goal was to make ambiguous cases a syntax error. The test cases added are all testing the ambiguous cases: ```rb assert_syntax_error("def b(&) ->(&) {c(&)} end", /anonymous block parameter is also used/) # ... assert_syntax_error("def b(*) ->(*) {c(*)} end", /anonymous rest parameter is also used/) assert_syntax_error("def b(a, *) ->(*) {c(1, *)} end", /anonymous rest parameter is also used/) assert_syntax_error("def b(*) ->(a, *) {c(*)} end", /anonymous rest parameter is also used/) # ... assert_syntax_error("def b(**) ->(**) {c(**)} end", /anonymous keyword rest parameter is also used/) assert_syntax_error("def b(k:, **) ->(**) {c(k: 1, **)} end", /anonymous keyword rest parameter is also used/) assert_syntax_error("def b(**) ->(k:, **) {c(**)} end", /anonymous keyword rest parameter is also used/) ``` However it is now also producing syntax errors in all of these cases: ```rb def b(&) -> { c(&) } end def b(*) -> { c(*) } end def b(a, *) -> { c(1, *) } end def b(*) ->(a) { c(a, *) } end def b(**) -> { c(**) } end def b(k:, **) -> { c(k: 1, **) } end def b(**) ->(k:) { c(k:, **) } end ``` Again, it's possible I misunderstood the scope of the previous change. But it would be sad to lose the unambiguous case, as I've used that pattern quite a bit in my own projects. This is my first time opening an issue here, so I apologize in advance if I've done anything non-standard. -- https://bugs.ruby-lang.org/

Issue #20090 has been updated by eliotp123 (Eliot Partridge). @nobu I hate to bother you as well, but I just want to make sure someone sees this before Ruby 3.3.1 is cut. ---------------------------------------- Bug #20090: Anonymous arguments are now syntax errors in unambiguous cases https://bugs.ruby-lang.org/issues/20090#change-107018 * Author: willcosgrove (Will Cosgrove) * Status: Closed * ruby -v: ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23] * Backport: 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONE ---------------------------------------- It looks like the changes that were made in #19370 may have gone further than intended. It's also possible I'm misunderstanding what decision was made. But it was my understanding that the goal was to make ambiguous cases a syntax error. The test cases added are all testing the ambiguous cases: ```rb assert_syntax_error("def b(&) ->(&) {c(&)} end", /anonymous block parameter is also used/) # ... assert_syntax_error("def b(*) ->(*) {c(*)} end", /anonymous rest parameter is also used/) assert_syntax_error("def b(a, *) ->(*) {c(1, *)} end", /anonymous rest parameter is also used/) assert_syntax_error("def b(*) ->(a, *) {c(*)} end", /anonymous rest parameter is also used/) # ... assert_syntax_error("def b(**) ->(**) {c(**)} end", /anonymous keyword rest parameter is also used/) assert_syntax_error("def b(k:, **) ->(**) {c(k: 1, **)} end", /anonymous keyword rest parameter is also used/) assert_syntax_error("def b(**) ->(k:, **) {c(**)} end", /anonymous keyword rest parameter is also used/) ``` However it is now also producing syntax errors in all of these cases: ```rb def b(&) -> { c(&) } end def b(*) -> { c(*) } end def b(a, *) -> { c(1, *) } end def b(*) ->(a) { c(a, *) } end def b(**) -> { c(**) } end def b(k:, **) -> { c(k: 1, **) } end def b(**) ->(k:) { c(k:, **) } end ``` Again, it's possible I misunderstood the scope of the previous change. But it would be sad to lose the unambiguous case, as I've used that pattern quite a bit in my own projects. This is my first time opening an issue here, so I apologize in advance if I've done anything non-standard. -- https://bugs.ruby-lang.org/

Issue #20090 has been updated by hsbt (Hiroshi SHIBATA). Backport changed from 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONE to 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: REQUIRED I confirmed. @naruse https://github.com/ruby/ruby/commit/f8f0d342e48a38caac6d32b438c145bb581a51e6 seems wrong commit. Should we revert it and apply https://github.com/ruby/ruby/commit/596db9c1f486d6609a4e97d82c8c71b54609fb6f again? ---------------------------------------- Bug #20090: Anonymous arguments are now syntax errors in unambiguous cases https://bugs.ruby-lang.org/issues/20090#change-107035 * Author: willcosgrove (Will Cosgrove) * Status: Closed * ruby -v: ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23] * Backport: 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: REQUIRED ---------------------------------------- It looks like the changes that were made in #19370 may have gone further than intended. It's also possible I'm misunderstanding what decision was made. But it was my understanding that the goal was to make ambiguous cases a syntax error. The test cases added are all testing the ambiguous cases: ```rb assert_syntax_error("def b(&) ->(&) {c(&)} end", /anonymous block parameter is also used/) # ... assert_syntax_error("def b(*) ->(*) {c(*)} end", /anonymous rest parameter is also used/) assert_syntax_error("def b(a, *) ->(*) {c(1, *)} end", /anonymous rest parameter is also used/) assert_syntax_error("def b(*) ->(a, *) {c(*)} end", /anonymous rest parameter is also used/) # ... assert_syntax_error("def b(**) ->(**) {c(**)} end", /anonymous keyword rest parameter is also used/) assert_syntax_error("def b(k:, **) ->(**) {c(k: 1, **)} end", /anonymous keyword rest parameter is also used/) assert_syntax_error("def b(**) ->(k:, **) {c(**)} end", /anonymous keyword rest parameter is also used/) ``` However it is now also producing syntax errors in all of these cases: ```rb def b(&) -> { c(&) } end def b(*) -> { c(*) } end def b(a, *) -> { c(1, *) } end def b(*) ->(a) { c(a, *) } end def b(**) -> { c(**) } end def b(k:, **) -> { c(k: 1, **) } end def b(**) ->(k:) { c(k:, **) } end ``` Again, it's possible I misunderstood the scope of the previous change. But it would be sad to lose the unambiguous case, as I've used that pattern quite a bit in my own projects. This is my first time opening an issue here, so I apologize in advance if I've done anything non-standard. -- https://bugs.ruby-lang.org/

Issue #20090 has been updated by naruse (Yui NARUSE). Backport changed from 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: REQUIRED to 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONE ruby_3_3 2a84aaf4a8c8d6d6bbb09416711922532b0033fe merged revision(s) 596db9c1f486d6609a4e97d82c8c71b54609fb6f. ---------------------------------------- Bug #20090: Anonymous arguments are now syntax errors in unambiguous cases https://bugs.ruby-lang.org/issues/20090#change-107257 * Author: willcosgrove (Will Cosgrove) * Status: Closed * ruby -v: ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23] * Backport: 3.0: DONTNEED, 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONE ---------------------------------------- It looks like the changes that were made in #19370 may have gone further than intended. It's also possible I'm misunderstanding what decision was made. But it was my understanding that the goal was to make ambiguous cases a syntax error. The test cases added are all testing the ambiguous cases: ```rb assert_syntax_error("def b(&) ->(&) {c(&)} end", /anonymous block parameter is also used/) # ... assert_syntax_error("def b(*) ->(*) {c(*)} end", /anonymous rest parameter is also used/) assert_syntax_error("def b(a, *) ->(*) {c(1, *)} end", /anonymous rest parameter is also used/) assert_syntax_error("def b(*) ->(a, *) {c(*)} end", /anonymous rest parameter is also used/) # ... assert_syntax_error("def b(**) ->(**) {c(**)} end", /anonymous keyword rest parameter is also used/) assert_syntax_error("def b(k:, **) ->(**) {c(k: 1, **)} end", /anonymous keyword rest parameter is also used/) assert_syntax_error("def b(**) ->(k:, **) {c(**)} end", /anonymous keyword rest parameter is also used/) ``` However it is now also producing syntax errors in all of these cases: ```rb def b(&) -> { c(&) } end def b(*) -> { c(*) } end def b(a, *) -> { c(1, *) } end def b(*) ->(a) { c(a, *) } end def b(**) -> { c(**) } end def b(k:, **) -> { c(k: 1, **) } end def b(**) ->(k:) { c(k:, **) } end ``` Again, it's possible I misunderstood the scope of the previous change. But it would be sad to lose the unambiguous case, as I've used that pattern quite a bit in my own projects. This is my first time opening an issue here, so I apologize in advance if I've done anything non-standard. -- https://bugs.ruby-lang.org/
participants (6)
-
eliotp123 (Eliot Partridge)
-
hsbt (Hiroshi SHIBATA)
-
matheusrich (Matheus Richard)
-
naruse (Yui NARUSE)
-
nobu (Nobuyoshi Nakada)
-
willcosgrove (Will Cosgrove)