not-callable.js (858B)
1 // Copyright (C) 2019 Aleksey Shvayka. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 esid: sec-properties-of-symbol-instances 5 description: > 6 Symbol primitives and objects are not callable. 7 info: | 8 Properties of Symbol Instances 9 10 Symbol instances are ordinary objects that inherit properties from the 11 Symbol prototype object. Symbol instances have a [[SymbolData]] internal slot. 12 The [[SymbolData]] internal slot is the Symbol value represented by this 13 Symbol object. 14 features: [Symbol] 15 ---*/ 16 17 var sym = Symbol('desc'); 18 var symObj = Object(Symbol()); 19 20 assert.throws(TypeError, function() { 21 sym(); 22 }); 23 24 assert.throws(TypeError, function() { 25 new sym(); 26 }); 27 28 assert.throws(TypeError, function() { 29 symObj(); 30 }); 31 32 assert.throws(TypeError, function() { 33 new symObj(); 34 }); 35 36 reportCompare(0, 0);