Skip to content

Commit 82dcdce

Browse files
committed
[GR-47834] Fixes for Cerner plugin applications
PullRequest: truffleruby/4003
2 parents 97cf7b1 + 5371c4d commit 82dcdce

File tree

6 files changed

+21
-5
lines changed

6 files changed

+21
-5
lines changed

lib/cext/ABI_check.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2
1+
4

lib/cext/include/ruby/internal/core/rarray.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ long rb_array_len(VALUE a);
279279
int RARRAY_LENINT(VALUE ary);
280280
VALUE *RARRAY_PTR_IMPL(VALUE array);
281281
void rb_ary_store(VALUE, long, VALUE);
282-
VALUE RARRAY_AREF(VALUE array, long index);
282+
VALUE rb_tr_rarray_aref(VALUE array, long index);
283283
#endif
284284
RBIMPL_SYMBOL_EXPORT_END()
285285

@@ -611,7 +611,7 @@ RARRAY_ASET(VALUE ary, long i, VALUE v)
611611
* transition path, but currently no way is found to do so.
612612
*/
613613
#ifdef TRUFFLERUBY
614-
#define RARRAY_AREF RARRAY_AREF
614+
#define RARRAY_AREF rb_tr_rarray_aref
615615
#else
616616
#define RARRAY_AREF(a, i) RARRAY_CONST_PTR_TRANSIENT(a)[i]
617617
#endif

lib/cext/include/truffleruby/truffleruby.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ static inline int rb_tr_scan_args_kw_int(int kw_flag, int argc, VALUE *argv, str
278278
if (parse_data.rest || argc <= n_mand + n_opt) {
279279
parse_data.kwargs = false;
280280
erased_kwargs = true;
281-
rb_warn("The last argument is nil, treating as empty keywords");
282281
}
283282
}
284283
else {

spec/ruby/library/datetime/rfc2822_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@
33

44
describe "DateTime.rfc2822" do
55
it "needs to be reviewed for spec completeness"
6+
7+
it "raises DateError if passed nil" do
8+
-> { DateTime.rfc2822(nil) }.should raise_error(Date::Error, "invalid date")
9+
end
610
end

spec/ruby/optional/capi/util_spec.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,19 @@
127127
ScratchPad.recorded.should == [1, 7, 4]
128128
end
129129

130+
it "assigns optional arguments with no hash argument given" do
131+
@o.rb_scan_args([1, 7], "02:", 3, @acc).should == 2
132+
ScratchPad.recorded.should == [1, 7, nil]
133+
end
134+
135+
it "assigns optional arguments with no hash argument given and rejects the use of optional nil argument as a hash" do
136+
-> {
137+
@o.rb_scan_args([1, nil], "02:", 3, @acc).should == 2
138+
}.should_not complain
139+
140+
ScratchPad.recorded.should == [1, nil, nil]
141+
end
142+
130143
it "assigns required, optional, splat, post-splat, Hash and block arguments" do
131144
h = {a: 1, b: 2}
132145
@o.rb_scan_args([1, 2, 3, 4, 5, h], "k11*1:&", 6, @acc, &@prc).should == 5

src/main/c/cext/array.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ int RARRAY_LENINT(VALUE array) {
2020
return polyglot_get_array_size(rb_tr_unwrap(array));
2121
}
2222

23-
VALUE RARRAY_AREF(VALUE array, long index) {
23+
VALUE rb_tr_rarray_aref(VALUE array, long index) {
2424
return rb_tr_wrap(polyglot_get_array_element(rb_tr_unwrap(array), (int) index));
2525
}
2626

0 commit comments

Comments
 (0)