Backed out 3 changesets (bug 1892041) for causing failures on async-module-does-not...
[gecko.git] / js / src / tests / test262 / built-ins / TypedArrayConstructors / internals / Set / BigInt / symbol-tobigint.js
blob6b5618b56894350aa6315bed0bc16a8c872a96d2
1 // Copyright (C) 2018 Valerie Young. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-assignment-operators-runtime-semantics-evaluation
5 description: >
6   Return abrupt on Symbol
7 info: |
8   Runtime Semantics: Evaluation
9   AssignmentExpression : LeftHandSideExpression = AssignmentExpression
10   1. If LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral, then
11   ...
12     f. Perform ? PutValue(lref, rval).
13   ...
15   PutValue ( V, W )
16   ...
17   6. Else if IsPropertyReference(V) is true, then
18     a. If HasPrimitiveBase(V) is true, then
19         i. Assert: In this case, base will never be undefined or null.
20         ii. Set base to ! ToObject(base).
21     b. Let succeeded be ? base.[[Set]](GetReferencedName(V), W, GetThisValue(V)).
22     c. If succeeded is false and IsStrictReference(V) is true, throw a TypeError
23        exception.
24     d. Return.
26   [[Set]] ( P, V, Receiver )
27   When the [[Set]] internal method of an Integer-Indexed exotic object O is
28   called with property key P, value V, and ECMAScript language value Receiver,
29   the following steps are taken:
30   1. Assert: IsPropertyKey(P) is true.
31   2. If Type(P) is String, then
32     a. Let numericIndex be ! CanonicalNumericIndexString(P).
33     b. If numericIndex is not undefined, then
34        i. Return ? IntegerIndexedElementSet(O, numericIndex, V).
36   IntegerIndexedElementSet ( O, index, value )
37   5. If arrayTypeName is "BigUint64Array" or "BigInt64Array",
38      let numValue be ? ToBigInt(value).
39   ...
41   ToBigInt ( argument )
42   Object, Apply the following steps:
43     1. Let prim be ? ToPrimitive(argument, hint Number).
44     2. Return the value that prim corresponds to in Table [BigInt Conversions]
46   BigInt Conversions
47     Argument Type: Symbol
48     Result: Throw a TypeError exception.
50 includes: [testBigIntTypedArray.js]
51 features: [align-detached-buffer-semantics-with-web-reality, BigInt, TypedArray, Symbol]
52 ---*/
54 var s = Symbol()
56 testWithBigIntTypedArrayConstructors(function(TA) {
57   var typedArray = new TA(1)
59   assert.throws(TypeError, function() {
60     typedArray[0] = s;
61   }, '`typedArray[0] = s` throws TypeError');
63 });
65 reportCompare(0, 0);