Status: Accepted
Owner: [email protected]
CC: [email protected]
Labels: Type-Bug Priority-Medium

New issue 760 by [email protected]: [[DefaultValue]] discrepancy
http://code.google.com/p/v8/issues/detail?id=760

What steps will reproduce the problem?

String.prototype.toString = function() { return { } };
String.prototype.valueOf = function(){ return 'y' };
var o = Object('x');
String(o) === o + '';

What is the expected result?
true

What happens instead?
false

Additional information:
o + '' returns 'x' instead of expected 'y'. Both — `String(o)` and `o + ''` should result in internal ToString being called, which should in its turn call ToPrimitive with the hint "String" (since given value is an object); ToPrimitive should call [[DefaultValue]], which should delegate to `toString`; after `toString` returns non-primitive, [[DefaultValue]] should try to call `valueOf` and finally return its value (since value is a primitive).

But something is off there in V8...

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to