| 1 |
// Copyright (C) 2017 Josh Wolfe. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
/*--- |
| 4 |
description: unsigned-right-shift operator ToNumeric with BigInt operands |
| 5 |
esid: sec-unsigned-right-shift-operator-runtime-semantics-evaluation |
| 6 |
info: After ToNumeric type coercion, unsigned-right-shift always throws for BigInt operands |
| 7 |
features: [BigInt, Symbol.toPrimitive, computed-property-names] |
| 8 |
---*/ |
| 9 |
|
| 10 |
assert.throws(TypeError, function() { |
| 11 |
Object(2n) >>> 0n; |
| 12 |
}, "ToPrimitive: unbox object with internal slot"); |
| 13 |
assert.throws(TypeError, function() { |
| 14 |
0n >>> Object(2n); |
| 15 |
}, "ToPrimitive: unbox object with internal slot"); |
| 16 |
assert.throws(TypeError, function() { |
| 17 |
({ |
| 18 |
[Symbol.toPrimitive]: function() { |
| 19 |
return 2n; |
| 20 |
} |
| 21 |
}) >>> 0n; |
| 22 |
}, "ToPrimitive: @@toPrimitive"); |
| 23 |
assert.throws(TypeError, function() { |
| 24 |
0n >>> { |
| 25 |
[Symbol.toPrimitive]: function() { |
| 26 |
return 2n; |
| 27 |
} |
| 28 |
}; |
| 29 |
}, "ToPrimitive: @@toPrimitive"); |
| 30 |
assert.throws(TypeError, function() { |
| 31 |
({ |
| 32 |
valueOf: function() { |
| 33 |
return 2n; |
| 34 |
} |
| 35 |
}) >>> 0n; |
| 36 |
}, "ToPrimitive: valueOf"); |
| 37 |
assert.throws(TypeError, function() { |
| 38 |
0n >>> { |
| 39 |
valueOf: function() { |
| 40 |
return 2n; |
| 41 |
} |
| 42 |
}; |
| 43 |
}, "ToPrimitive: valueOf"); |
| 44 |
assert.throws(TypeError, function() { |
| 45 |
({ |
| 46 |
toString: function() { |
| 47 |
return 2n; |
| 48 |
} |
| 49 |
}) >>> 0n; |
| 50 |
}, "ToPrimitive: toString"); |
| 51 |
assert.throws(TypeError, function() { |
| 52 |
0n >>> { |
| 53 |
toString: function() { |
| 54 |
return 2n; |
| 55 |
} |
| 56 |
}; |
| 57 |
}, "ToPrimitive: toString"); |