google / google/CodeCity

Array.prototype.concat.call('foo', …) should throw

Open
#277 0 comments 0 reactions 0 assignees View on GitHub
bug server
Dominant language
JavaScript
Stars
198
Forks
38
PR merge metrics
No merged PRs in 30d

Description

In ES5 (and V8), `Array.prototype.concat.call('foo')` returns an array containing a String object (i.e., boxed string)—it's equivalent to `[new String('foo')]`. In our interpreter, it returns `['foo']`.

Since we forbid boxed primitives, the `new String()` call throws TypeError. The `concat` call should too.

At the moment, our implementation of `Array.prototype.concat` calls `intrp.toObject`, which notably does not throw, and then does nothing further with the result.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.