Commit fd036db
Do not respect ruby2_keywords on method/proc with post arguments
Previously, ruby2_keywords could be used on a method or proc with
post arguments, but I don't think the behavior is desired:
```ruby
def a(*c, **kw) [c, kw] end
def b(*a, b) a(*a, b) end
ruby2_keywords(:b)
b({foo: 1}, bar: 1)
```
This changes ruby2_keywords to emit a warning and not set the
flag on a method/proc with post arguments.
While here, fix the ruby2_keywords specs for warnings, since they
weren't testing what they should be testing. They all warned
because the method didn't accept a rest argument, not because it
accepted a keyword or keyword rest argument.
[Backport #21402]1 parent d49c7d0 commit fd036db
File tree
5 files changed
+62
-10
lines changed- spec/ruby/core
- module
- proc
- test/ruby
5 files changed
+62
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3958 | 3958 | | |
3959 | 3959 | | |
3960 | 3960 | | |
| 3961 | + | |
3961 | 3962 | | |
3962 | 3963 | | |
3963 | 3964 | | |
3964 | 3965 | | |
3965 | 3966 | | |
3966 | | - | |
| 3967 | + | |
3967 | 3968 | | |
3968 | 3969 | | |
3969 | 3970 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | | - | |
| 278 | + | |
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
289 | | - | |
| 289 | + | |
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
297 | 310 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
56 | 66 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2424 | 2424 | | |
2425 | 2425 | | |
2426 | 2426 | | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
| 2441 | + | |
2427 | 2442 | | |
2428 | 2443 | | |
2429 | 2444 | | |
| |||
2436 | 2451 | | |
2437 | 2452 | | |
2438 | 2453 | | |
2439 | | - | |
2440 | | - | |
| 2454 | + | |
| 2455 | + | |
2441 | 2456 | | |
2442 | 2457 | | |
2443 | 2458 | | |
| |||
2790 | 2805 | | |
2791 | 2806 | | |
2792 | 2807 | | |
2793 | | - | |
| 2808 | + | |
2794 | 2809 | | |
2795 | 2810 | | |
2796 | 2811 | | |
| 2812 | + | |
| 2813 | + | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
| 2817 | + | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
| 2822 | + | |
2797 | 2823 | | |
2798 | 2824 | | |
2799 | 2825 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2599 | 2599 | | |
2600 | 2600 | | |
2601 | 2601 | | |
| 2602 | + | |
2602 | 2603 | | |
2603 | 2604 | | |
2604 | 2605 | | |
2605 | 2606 | | |
2606 | 2607 | | |
2607 | 2608 | | |
2608 | | - | |
| 2609 | + | |
2609 | 2610 | | |
2610 | 2611 | | |
2611 | 2612 | | |
| |||
2618 | 2619 | | |
2619 | 2620 | | |
2620 | 2621 | | |
| 2622 | + | |
2621 | 2623 | | |
2622 | 2624 | | |
2623 | 2625 | | |
2624 | 2626 | | |
2625 | 2627 | | |
2626 | 2628 | | |
2627 | | - | |
| 2629 | + | |
2628 | 2630 | | |
2629 | 2631 | | |
2630 | 2632 | | |
| |||
0 commit comments