-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intl functions shouldn't be constructible #637
Comments
@bterlson pointed me toward this discussion tc39/ecma402#57 as a potential concern, but tc39/ecma402#57 (comment) seems to suggest the |
Could they be implemented as arrow functions, or do they need access to |
Unsure. I'll need to understand the spec and the linked discussion a bit better first. |
For myself for future reference: Intl documentation on MDN |
Not a functionality bug per se because we emit the correct kind of error, but the message is perhaps misleading. Adding Dev Experience and unassigning myself for now. |
Was playing around with this a bit -- in chakra, anonymous function expressions bound to variables don't take the name of their variables (unlike at least in SpiderMonkey), so my initial belief on turning this into arrow functions is that the best error message we could get is "Function is not a constructor", rather than "getCanonicalLocales is not a constructor". @bterlson thoughts on if thats good enough? |
It seems like we do the right thing (
not good enough, but our errors messages generally need help. "Function is not a constructor" is in the family of "object is null or undefined" though, in that it isn't particularly helpful. |
See also: #3407. |
…t262 issues, add support for ICU 62.1 Merge pull request #5612 from jackhorton:intl/lots-of-fixes Fixes #637 Fixes #5603 Fixes #3427 Fixes #3513 Fixes #3692 Adds build support for ICU 62.1 by enabling /utf-8 in all ICU files rather than just i18n @rhuanjl's function.length PR took our pass rate from 486 to 530; this further increases it to 580 (compared to V8's 582 and SpiderMonkey's 597). The remaining failures are all known, but slightly more complicated issues, where we shell out to ICU when the spec wants us to do something particularly snowflake-y -- V8 fails most of these tests as well. The remaining ~350 tests are for features that we don't implement and V8/SM either haven't implemented or have turned off by default. For what its worth, some of the features we haven't implemented are extremely straightforward -- the Intl version of String.prototype.toLocale{Lower|Upper}Case and {Typed}Array.prototype.toLocaleString are tiny. Fixing those tests (by implementing those features) would bump us up to 596.
According to the spec:
Since our Intl functions are script functions (implemented in
Intl.js
), they are constructible by default. For example,causes the error:
instead of:
The text was updated successfully, but these errors were encountered: