Commit acb29f7
committed
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.1 parent b0c80c2 commit acb29f7
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 | |
|---|---|---|---|
| |||
4012 | 4012 | | |
4013 | 4013 | | |
4014 | 4014 | | |
| 4015 | + | |
4015 | 4016 | | |
4016 | 4017 | | |
4017 | 4018 | | |
4018 | 4019 | | |
4019 | 4020 | | |
4020 | | - | |
| 4021 | + | |
4021 | 4022 | | |
4022 | 4023 | | |
4023 | 4024 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
| 216 | + | |
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| |||
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
227 | | - | |
| 227 | + | |
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
235 | 248 | | |
| 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 | |
|---|---|---|---|
| |||
2959 | 2959 | | |
2960 | 2960 | | |
2961 | 2961 | | |
| 2962 | + | |
2962 | 2963 | | |
2963 | 2964 | | |
2964 | 2965 | | |
2965 | 2966 | | |
2966 | 2967 | | |
2967 | 2968 | | |
2968 | | - | |
| 2969 | + | |
2969 | 2970 | | |
2970 | 2971 | | |
2971 | 2972 | | |
| |||
2978 | 2979 | | |
2979 | 2980 | | |
2980 | 2981 | | |
| 2982 | + | |
2981 | 2983 | | |
2982 | 2984 | | |
2983 | 2985 | | |
2984 | 2986 | | |
2985 | 2987 | | |
2986 | 2988 | | |
2987 | | - | |
| 2989 | + | |
2988 | 2990 | | |
2989 | 2991 | | |
2990 | 2992 | | |
| |||
0 commit comments