call-value-of-when-to-string-present.js (611B)
1 // Copyright (C) 2017 Caio Lima. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 description: ToPrimitive receives "hint Number" as parameter, then valueOf needs to be called 6 esid: sec-bigint-constructor-number-value 7 info: | 8 1. If NewTarget is not undefined, throw a TypeError exception. 9 2. Let prim be ? ToPrimitive(value, hint Number). 10 ... 11 features: [BigInt] 12 ---*/ 13 14 let o = { 15 valueOf: function() { 16 return 44; 17 }, 18 19 toString: function() { 20 throw new Test262Error("unreachable"); 21 } 22 } 23 24 assert.sameValue(BigInt(o), 44n); 25 26 reportCompare(0, 0);