@@ -1206,14 +1206,14 @@ protected int leftShift(long a, long b,
1206
1206
if (zeroProfile .profile (a == 0L )) {
1207
1207
return 0 ;
1208
1208
} else {
1209
- throw new RaiseException ( getContext (), coreExceptions (). noMemoryError ( this , null ) );
1209
+ throw shiftWidthTooBig ( );
1210
1210
}
1211
1211
}
1212
1212
1213
1213
@ Specialization (guards = "b > MAX_INT" )
1214
1214
protected int leftShift (RubyBignum a , long b ) {
1215
1215
// We raise a NoMemoryError like MRI; JRuby would raise a coercion error.
1216
- throw new RaiseException ( getContext (), coreExceptions (). noMemoryError ( this , null ) );
1216
+ throw shiftWidthTooBig ( );
1217
1217
}
1218
1218
1219
1219
@ Specialization (guards = "isPositive(b)" )
@@ -1222,14 +1222,18 @@ protected int leftShift(long a, RubyBignum b,
1222
1222
if (zeroProfile .profile (a == 0L )) {
1223
1223
return 0 ;
1224
1224
} else {
1225
- throw new RaiseException ( getContext (), coreExceptions (). noMemoryError ( this , null ) );
1225
+ throw shiftWidthTooBig ( );
1226
1226
}
1227
1227
}
1228
1228
1229
1229
@ Specialization (guards = "isPositive(b)" )
1230
1230
protected int leftShift (RubyBignum a , RubyBignum b ) {
1231
1231
// We raise a NoMemoryError like MRI; JRuby would raise a coercion error.
1232
- throw new RaiseException (getContext (), coreExceptions ().noMemoryError (this , null ));
1232
+ throw shiftWidthTooBig ();
1233
+ }
1234
+
1235
+ private RaiseException shiftWidthTooBig () {
1236
+ return new RaiseException (getContext (), coreExceptions ().rangeError ("shift width too big" , this ));
1233
1237
}
1234
1238
1235
1239
// b < 0, delegate to a >> -b
0 commit comments