@@ -38,7 +38,7 @@ def descriptor(*)
38
38
splat = [ 1 , 2 ]
39
39
descriptor ( *splat ) . should == [ ]
40
40
41
- descriptor ( a : 1 ) . should == [ :keywords ]
41
+ descriptor ( a : 1 ) . should == [ :keywords , :a ]
42
42
kw = { b : 2 }
43
43
descriptor ( **kw ) . should == [ :keywords ]
44
44
empty_kw = { }
@@ -64,7 +64,7 @@ def no_kws(a, b)
64
64
it "contain keyword arguments" do
65
65
info = only_kws ( a : 1 , b : 2 )
66
66
info . values . should == [ 1 , 2 ]
67
- info . descriptor . should == [ :keywords ] if truffleruby?
67
+ info . descriptor . should == [ :keywords , :a , :b ] if truffleruby?
68
68
info . arguments . should == [ { a : 1 , b : 2 } ] if truffleruby?
69
69
end
70
70
@@ -75,12 +75,12 @@ def only_kws_and_opt(a:, b: 101)
75
75
76
76
info = only_kws_and_opt ( a : 1 , b : 2 )
77
77
info . values . should == [ 1 , 2 ]
78
- info . descriptor . should == [ :keywords ] if truffleruby?
78
+ info . descriptor . should == [ :keywords , :a , :b ] if truffleruby?
79
79
info . arguments . should == [ { a : 1 , b : 2 } ] if truffleruby?
80
80
81
81
info = only_kws_and_opt ( a : 1 )
82
82
info . values . should == [ 1 , 101 ]
83
- info . descriptor . should == [ :keywords ] if truffleruby?
83
+ info . descriptor . should == [ :keywords , :a ] if truffleruby?
84
84
info . arguments . should == [ { a : 1 } ] if truffleruby?
85
85
end
86
86
@@ -91,7 +91,7 @@ def posn_kws(a, b:)
91
91
92
92
info = posn_kws ( 1 , b : 2 )
93
93
info . values . should == [ 1 , 2 ]
94
- info . descriptor . should == [ :keywords ] if truffleruby?
94
+ info . descriptor . should == [ :keywords , :b ] if truffleruby?
95
95
info . arguments . should == [ 1 , { b : 2 } ] if truffleruby?
96
96
end
97
97
@@ -102,34 +102,34 @@ def posn_kws_defaults(a, b: 101, c: 102)
102
102
it "contain optional keyword arguments with positional arguments" do
103
103
info = posn_kws_defaults ( 1 , b : 2 , c : 3 )
104
104
info . values . should == [ 1 , 2 , 3 ]
105
- info . descriptor . should == [ :keywords ] if truffleruby?
105
+ info . descriptor . should == [ :keywords , :b , :c ] if truffleruby?
106
106
info . arguments . should == [ 1 , { b : 2 , c : 3 } ] if truffleruby?
107
107
end
108
108
109
109
it "do not contain missing optional keyword arguments" do
110
110
info = posn_kws_defaults ( 1 , b : 2 )
111
111
info . values . should == [ 1 , 2 , 102 ]
112
- info . descriptor . should == [ :keywords ] if truffleruby?
112
+ info . descriptor . should == [ :keywords , :b ] if truffleruby?
113
113
info . arguments . should == [ 1 , { b : 2 } ] if truffleruby?
114
114
115
115
info = posn_kws_defaults ( 1 , c : 3 )
116
116
info . values . should == [ 1 , 101 , 3 ]
117
- info . descriptor . should == [ :keywords ] if truffleruby?
117
+ info . descriptor . should == [ :keywords , :c ] if truffleruby?
118
118
info . arguments . should == [ 1 , { c : 3 } ] if truffleruby?
119
119
end
120
120
121
121
it "do not contain the name of distant explicitly splatted keyword arguments" do
122
122
distant = { b : 2 }
123
123
info = only_kws ( a : 1 , **distant )
124
124
info . values . should == [ 1 , 2 ]
125
- info . descriptor . should == [ :keywords ] if truffleruby?
125
+ info . descriptor . should == [ :keywords , :a ] if truffleruby?
126
126
info . arguments . should == [ { a : 1 , b : 2 } ] if truffleruby?
127
127
end
128
128
129
129
it "do not contain the name of near explicitly splatted keyword arguments" do
130
130
info = only_kws ( a : 1 , **{ b : 2 } )
131
131
info . values . should == [ 1 , 2 ]
132
- info . descriptor . should == [ :keywords ] if truffleruby?
132
+ info . descriptor . should == [ :keywords , :a ] if truffleruby?
133
133
info . arguments . should == [ { a : 1 , b : 2 } ] if truffleruby?
134
134
end
135
135
@@ -140,7 +140,7 @@ def opt_and_kws(a, b=2, c: nil)
140
140
141
141
info = opt_and_kws ( 1 , c : 3 )
142
142
info . values . should == [ 1 , 2 , 3 ]
143
- info . descriptor . should == [ :keywords ] if truffleruby?
143
+ info . descriptor . should == [ :keywords , :c ] if truffleruby?
144
144
info . arguments . should == [ 1 , { c : 3 } ] if truffleruby?
145
145
end
146
146
@@ -197,7 +197,7 @@ def struct_new_like(a, *b, c: 101)
197
197
198
198
info = struct_new_like ( 'A' , :a , :b , c : 1 )
199
199
info . values . should == [ 'A' , [ :a , :b ] , 1 ]
200
- info . descriptor . should == [ :keywords ] if truffleruby?
200
+ info . descriptor . should == [ :keywords , :c ] if truffleruby?
201
201
info . arguments . should == [ 'A' , :a , :b , { c : 1 } ] if truffleruby?
202
202
203
203
info = struct_new_like ( 'A' , :a , :b , { c : 1 } )
@@ -240,7 +240,7 @@ def describe_like(a, b = nil)
240
240
241
241
info = describe_like ( 1 , b : 2 )
242
242
info . values . should == [ 1 , { b : 2 } ]
243
- info . descriptor . should == [ :keywords ] if truffleruby?
243
+ info . descriptor . should == [ :keywords , :b ] if truffleruby?
244
244
info . arguments . should == [ 1 , { b : 2 } ] if truffleruby?
245
245
end
246
246
@@ -262,7 +262,7 @@ def rest(*a)
262
262
263
263
info = rest ( a : 1 , b : 2 )
264
264
info . values . should == [ [ { a : 1 , b : 2 } ] ]
265
- info . descriptor . should == [ :keywords ] if truffleruby?
265
+ info . descriptor . should == [ :keywords , :a , :b ] if truffleruby?
266
266
info . arguments . should == [ { a : 1 , b : 2 } ] if truffleruby?
267
267
end
268
268
@@ -273,7 +273,7 @@ def kw_rest(**a)
273
273
274
274
info = kw_rest ( a : 1 , b : 2 )
275
275
info . values . should == [ { a : 1 , b : 2 } ]
276
- info . descriptor . should == [ :keywords ] if truffleruby?
276
+ info . descriptor . should == [ :keywords , :a , :b ] if truffleruby?
277
277
info . arguments . should == [ { a : 1 , b : 2 } ] if truffleruby?
278
278
end
279
279
@@ -284,17 +284,17 @@ def kw_and_kw_rest(a:, **b)
284
284
285
285
info = kw_and_kw_rest ( a : 1 )
286
286
info . values . should == [ 1 , { } ]
287
- info . descriptor . should == [ :keywords ] if truffleruby?
287
+ info . descriptor . should == [ :keywords , :a ] if truffleruby?
288
288
info . arguments . should == [ { a : 1 } ] if truffleruby?
289
289
290
290
info = kw_and_kw_rest ( a : 1 , b : 2 , c : 3 )
291
291
info . values . should == [ 1 , { b : 2 , c : 3 } ]
292
- info . descriptor . should == [ :keywords ] if truffleruby?
292
+ info . descriptor . should == [ :keywords , :a , :b , :c ] if truffleruby?
293
293
info . arguments . should == [ { a : 1 , b : 2 , c : 3 } ] if truffleruby?
294
294
295
295
info = kw_and_kw_rest ( "abc" => 123 , a : 1 , b : 2 )
296
296
info . values . should == [ 1 , { "abc" => 123 , b : 2 } ]
297
- info . descriptor . should == [ :keywords ] if truffleruby?
297
+ info . descriptor . should == [ :keywords , :a , :b ] if truffleruby?
298
298
info . arguments . should == [ { "abc" => 123 , a : 1 , b : 2 } ] if truffleruby?
299
299
end
300
300
@@ -310,7 +310,7 @@ def mixture(a, b = nil, c = nil, d, e: nil, **f)
310
310
311
311
info = mixture ( 1 , 2 , e : 3 )
312
312
info . values . should == [ 1 , nil , nil , 2 , 3 , { } ]
313
- info . descriptor . should == [ :keywords ] if truffleruby?
313
+ info . descriptor . should == [ :keywords , :e ] if truffleruby?
314
314
info . arguments . should == [ 1 , 2 , { e : 3 } ] if truffleruby?
315
315
316
316
info = mixture ( 1 , 2 , { foo : :bar } )
@@ -345,7 +345,7 @@ def self.new(a:, b:)
345
345
346
346
info = new_kw . new ( a : 1 , b : 2 )
347
347
info . values . should == [ 1 , 2 ]
348
- info . descriptor . should == [ :keywords ] if truffleruby?
348
+ info . descriptor . should == [ :keywords , :a , :b ] if truffleruby?
349
349
info . arguments . should == [ { a : 1 , b : 2 } ] if truffleruby?
350
350
end
351
351
@@ -358,11 +358,26 @@ def self.new(*a)
358
358
359
359
info = new_rest . new ( a : 1 , b : 2 )
360
360
info . values . should == [ [ { a : 1 , b : 2 } ] ]
361
+ info . descriptor . should == [ :keywords , :a , :b ] if truffleruby?
362
+ info . arguments . should == [ { a : 1 , b : 2 } ] if truffleruby?
363
+ end
364
+
365
+ it "work through delegation, but by reifying the keyword argument hash" do
366
+ def delegator ( ...)
367
+ delegated ( ...)
368
+ end
369
+
370
+ def delegated ( a :, b :)
371
+ ArgumentsDescriptorSpecs ::Info . new ( [ a , b ] , Primitive . arguments_descriptor , Primitive . arguments )
372
+ end
373
+
374
+ info = delegator ( a : 1 , b : 2 )
375
+ info . values . should == [ 1 , 2 ]
361
376
info . descriptor . should == [ :keywords ] if truffleruby?
362
377
info . arguments . should == [ { a : 1 , b : 2 } ] if truffleruby?
363
378
end
364
379
365
- it "work through implicit super" do
380
+ it "work through implicit super, but by reifying the keyword argument hash " do
366
381
parent = Class . new do
367
382
def implicit_super ( a :, b :)
368
383
ArgumentsDescriptorSpecs ::Info . new ( [ a , b ] , Primitive . arguments_descriptor , Primitive . arguments )
@@ -396,7 +411,7 @@ def explicit_super(a:, b:)
396
411
397
412
info = child . new . explicit_super ( a : 1 , b : 2 )
398
413
info . values . should == [ 1 , 2 ]
399
- info . descriptor . should == [ :keywords ] if truffleruby?
414
+ info . descriptor . should == [ :keywords , :a , :b ] if truffleruby?
400
415
info . arguments . should == [ { a : 1 , b : 2 } ] if truffleruby?
401
416
end
402
417
@@ -413,7 +428,7 @@ def use_yielder(x, y)
413
428
414
429
info = use_yielder ( 1 , 2 )
415
430
info . values . should == [ 1 , 2 ]
416
- info . descriptor . should == [ :keywords ] if truffleruby?
431
+ info . descriptor . should == [ :keywords , :a , :b ] if truffleruby?
417
432
info . arguments . should == [ { a : 1 , b : 2 } ] if truffleruby?
418
433
end
419
434
@@ -422,7 +437,7 @@ def use_yielder(x, y)
422
437
info ( [ args , kwargs ] , Primitive . arguments_descriptor , Primitive . arguments )
423
438
end
424
439
info . values . should == [ [ ] , { a : 1 } ]
425
- info . descriptor . should == [ :keywords ] if truffleruby?
440
+ info . descriptor . should == [ :keywords , :a ] if truffleruby?
426
441
info . arguments . should == [ { a : 1 } ] if truffleruby?
427
442
end
428
443
@@ -431,7 +446,7 @@ def use_yielder(x, y)
431
446
ArgumentsDescriptorSpecs ::Info . new ( [ args , kwargs ] , Primitive . arguments_descriptor , Primitive . arguments )
432
447
end
433
448
info . values . should == [ [ ] , { a : 1 } ]
434
- info . descriptor . should == [ :keywords ] if truffleruby?
449
+ info . descriptor . should == [ :keywords , :a ] if truffleruby?
435
450
info . arguments . should == [ { a : 1 } ] if truffleruby?
436
451
end
437
452
@@ -440,11 +455,11 @@ def use_yielder(x, y)
440
455
ArgumentsDescriptorSpecs ::Info . new ( [ args , kwargs ] , Primitive . arguments_descriptor , Primitive . arguments )
441
456
end . call ( a : 1 )
442
457
info . values . should == [ [ ] , { a : 1 } ]
443
- info . descriptor . should == [ :keywords ] if truffleruby?
458
+ info . descriptor . should == [ :keywords , :a ] if truffleruby?
444
459
info . arguments . should == [ { a : 1 } ] if truffleruby?
445
460
end
446
461
447
- it "work through Thread#new" do
462
+ it "work through Thread#new, but by reifying the keyword argument hash " do
448
463
info = Thread . new ( a : 1 ) do |*args , **kwargs |
449
464
ArgumentsDescriptorSpecs ::Info . new ( [ args , kwargs ] , Primitive . arguments_descriptor , Primitive . arguments )
450
465
end . value
@@ -458,7 +473,7 @@ def use_yielder(x, y)
458
473
ArgumentsDescriptorSpecs ::Info . new ( [ args , kwargs ] , Primitive . arguments_descriptor , Primitive . arguments )
459
474
end . resume ( a : 1 )
460
475
info . values . should == [ [ ] , { a : 1 } ]
461
- info . descriptor . should == [ :keywords ] if truffleruby?
476
+ info . descriptor . should == [ :keywords , :a ] if truffleruby?
462
477
info . arguments . should == [ { a : 1 } ] if truffleruby?
463
478
464
479
Fiber . new ( &-> { true } ) . resume ( **{ } ) . should == true
0 commit comments