Skip to content
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

Es6 (mostly built-ins) #180

Merged
merged 58 commits into from
Aug 11, 2020
Merged

Es6 (mostly built-ins) #180

merged 58 commits into from
Aug 11, 2020

Conversation

dop251
Copy link
Owner

@dop251 dop251 commented Aug 7, 2020

No description provided.

dop251 and others added 30 commits February 29, 2020 12:31
# Conflicts:
#	runtime_test.go
Proxy, Reflect, new.target, tons of refactoring.

Co-authored-by: noctarius <[email protected]>
* Enabled travis build on s390x (which is big endian)
Implemented ArrayBuffer, DataView and the typed arrays.
# Conflicts:
#	builtin_array.go
@mstoykov
Copy link
Contributor

Hi @dop251,
I did some testing, and as k6 does use core-js 2.5.1 (very old version at this point) to get some more compatibility, and as this is somewhat of a problem for us, I decided to use the core-js compat tests(which turned out to be way too simple) to see if this branch gives us everything core-js 2.5.1 did(not that this is required for us, or from the es6 branch).

Here are all the results and this are the changes to corejs, I did, to get them.

The important thing is the difference between k6 + corejs and k6 with es6 without corejs (the other is there for completeness). I am pretty sure at least some of the falses are because of what core-js specifically tests something, as I can see that there is an Array.sort and I doubt it doesn't ... sort ... The problem actually is that apparently [1,2,3].sort(null) should throw an exception (a quick test shows firefox does that as well ) :)

Here is the output of diff -y --suppress-common-lines ~/extented-0.27.1.json ~/k6-es6.json

  "es.symbol.async-iterator": true,                           |   "es.symbol.async-iterator": false,
  "es.array.concat": false,                                   |   "es.array.concat": true,
  "es.array.filter": false,                                   |   "es.array.filter": true,
  "es.array.flat-map": true,                                  |   "es.array.flat-map": false,
  "es.array.map": false,                                      |   "es.array.map": true,
  "es.array.slice": false,                                    |   "es.array.slice": true,
  "es.array.sort": true,                                      |   "es.array.sort": false,
  "es.array.splice": false,                                   |   "es.array.splice": true,
  "es.array.unscopables.flat-map": true,                      |   "es.array.unscopables.flat-map": false,
  "es.date.to-json": true,                                    |   "es.date.to-json": false,
  "es.object.assign": true,                                   |   "es.object.assign": false,
  "es.object.define-getter": true,                            |   "es.object.define-getter": false,
  "es.object.define-setter": true,                            |   "es.object.define-setter": false,
  "es.object.entries": true,                                  |   "es.object.entries": false,
  "es.object.get-own-property-descriptors": true,             |   "es.object.get-own-property-descriptors": false,
  "es.object.lookup-getter": true,                            |   "es.object.lookup-getter": false,
  "es.object.lookup-setter": true,                            |   "es.object.lookup-setter": false,
  "es.object.values": true,                                   |   "es.object.values": false,
  "es.reflect.set": false,                                    |   "es.reflect.set": true,
  "es.regexp.flags": false,                                   |   "es.regexp.flags": true,
  "es.regexp.sticky": false,                                  |   "es.regexp.sticky": true,
  "es.regexp.to-string": true,                                |   "es.regexp.to-string": false,
  "es.string.match": false,                                   |   "es.string.match": true,
  "es.string.search": false,                                  |   "es.string.search": true,
  "es.string.split": false,                                   |   "es.string.split": true,
  "es.string.trim": false,                                    |   "es.string.trim": true,
  "es.string.anchor": true,                                   |   "es.string.anchor": false,
  "es.string.big": true,                                      |   "es.string.big": false,
  "es.string.blink": true,                                    |   "es.string.blink": false,
  "es.string.bold": true,                                     |   "es.string.bold": false,
  "es.string.fixed": true,                                    |   "es.string.fixed": false,
  "es.string.fontcolor": true,                                |   "es.string.fontcolor": false,
  "es.string.fontsize": true,                                 |   "es.string.fontsize": false,
  "es.string.italics": true,                                  |   "es.string.italics": false,
  "es.string.link": true,                                     |   "es.string.link": false,
  "es.string.small": true,                                    |   "es.string.small": false,
  "es.string.strike": true,                                   |   "es.string.strike": false,
  "es.string.sub": true,                                      |   "es.string.sub": false,
  "es.string.sup": true,                                      |   "es.string.sup": false,
  "esnext.map.from": true,                                    |   "esnext.map.from": false,
  "esnext.map.of": true,                                      |   "esnext.map.of": false,
  "esnext.math.clamp": true,                                  |   "esnext.math.clamp": false,
  "esnext.math.deg-per-rad": true,                            |   "esnext.math.deg-per-rad": false,
  "esnext.math.degrees": true,                                |   "esnext.math.degrees": false,
  "esnext.math.fscale": true,                                 |   "esnext.math.fscale": false,
  "esnext.math.iaddh": true,                                  |   "esnext.math.iaddh": false,
  "esnext.math.imulh": true,                                  |   "esnext.math.imulh": false,
  "esnext.math.isubh": true,                                  |   "esnext.math.isubh": false,
  "esnext.math.rad-per-deg": true,                            |   "esnext.math.rad-per-deg": false,
  "esnext.math.radians": true,                                |   "esnext.math.radians": false,
  "esnext.math.scale": true,                                  |   "esnext.math.scale": false,
  "esnext.math.signbit": true,                                |   "esnext.math.signbit": false,
  "esnext.math.umulh": true,                                  |   "esnext.math.umulh": false,
  "esnext.observable": true,                                  |   "esnext.observable": false,
  "esnext.reflect.define-metadata": true,                     |   "esnext.reflect.define-metadata": false,
  "esnext.reflect.delete-metadata": true,                     |   "esnext.reflect.delete-metadata": false,
  "esnext.reflect.get-metadata": true,                        |   "esnext.reflect.get-metadata": false,
  "esnext.reflect.get-metadata-keys": true,                   |   "esnext.reflect.get-metadata-keys": false,
  "esnext.reflect.get-own-metadata": true,                    |   "esnext.reflect.get-own-metadata": false,
  "esnext.reflect.get-own-metadata-keys": true,               |   "esnext.reflect.get-own-metadata-keys": false,
  "esnext.reflect.has-metadata": true,                        |   "esnext.reflect.has-metadata": false,
  "esnext.reflect.has-own-metadata": true,                    |   "esnext.reflect.has-own-metadata": false,
  "esnext.reflect.metadata": true,                            |   "esnext.reflect.metadata": false,
  "esnext.set.from": true,                                    |   "esnext.set.from": false,
  "esnext.set.of": true,                                      |   "esnext.set.of": false,
  "esnext.string.at": true,                                   |   "esnext.string.at": false,
  "esnext.symbol.observable": true,                           |   "esnext.symbol.observable": false,
  "esnext.weak-map.from": true,                               |   "esnext.weak-map.from": false,
  "esnext.weak-map.of": true,                                 |   "esnext.weak-map.of": false,
  "esnext.weak-set.from": true,                               |   "esnext.weak-set.from": false,
  "esnext.weak-set.of": true,                                 |   "esnext.weak-set.of": false,
  "web.immediate": true,                                      |   "web.immediate": false,

I will try to run the whole test suite with the more intricate tests in the coming days

@dop251
Copy link
Owner Author

dop251 commented Aug 10, 2020

Hi.

Thanks for running those. Can you make it report exactly which test has failed? There may be some genuine issues worth fixing (like the one with sort), but it's hard to tell without knowing more details. I just tried running equivalent tests for Array.prototype.concat and they all look fine to me.

I can see there is a bunch of stuff that is post-es6 (esnext.*), as well as Annex B extensions (like es.string.blink) which I doubt anyone uses...

@mstoykov
Copy link
Contributor

mstoykov commented Aug 11, 2020

I went through the ones that fail with es6 but not with corejs 2.5.1 and aren't obviously not interesting (like the blink stuff or reflect metadata (which has been dropped as far as I can see)). I haven't checked that this is the actual expected behavior in the spec ... :D

  • es.symbol.async-iterator - Symbol.asyncIterator is undefined
  • es.array.flat-map - Array.prototype.flatMap is undefined
  • es.array.sort - [1,2,3].sort(null) should throw an exception
  • es.array.unscopables.flat-map - Array.prototype[Symbol.unscopables].flatMap is undefined
  • es.date.to-json - Date.prototype.toJSON.call({ toISOString: function () { return 1; } }) should return 1 and Date(NaN).toJSON is undefined
  • es.object.assign
  Object.assign({ b: 1 }, Object.assign(Object.defineProperty({}, 'a', {
       enumerable: true,
       get: function () {
        Object.defineProperty(this, 'b', {
           value: 3,
           enumerable: false
         });
       }
    }), { b: 2 })).b

Should return 1 ... apparently ... here the test has other parts so I expect this doesn't work in other ways as well

  • es.object.define-getter - Object.prototype.__defineSetter__ is undefined. This and all the others seem with the same problem use the same check ... 🤷‍♂️

  • es.object.define-setter - Object.prototype.__defineSetter__ is undefined

  • es.object.entries - Object.entries is undefined

  • es.object.get-own-property-descriptors - Object.getOwnPropertyDescriptors is undefined

  • es.object.lookup-getter - Object.prototype.__defineSetter__ is undefined

  • es.object.lookup-setter - Object.prototype.__defineSetter__ is undefined

  • es.object.values - Object.values is undefined

  • es.regexp.to-string RegExp.prototype.toString.call({ source: 'a', flags: 'b' }) should return '/a/b' instead it throws 'TypeError: Method RegExp.prototype.toString called on incompatible receiver [object Object]'

esnext.string.at Does seem to doesn't exist, maybe it was renamed to charAt ?!?

from/of on all the collections, this will probably be easy to add given that it is already there for the array, maybe I will try later on I just checked and it seemed like this never made it to the standard and I can't even find the proposal ... so I guess this won't be added as well ...

  • esnext.map.from, esnext.map.of
  • esnext.set.from, esnext.set.of
  • esnext.weak-map.from, esnext.weak-map.of
  • esnext.weak-set.from, esnext.weak-set.of

@mstoykov
Copy link
Contributor

@dop251 changes from f197596 to 3ec8e20

  "es.array.sort": false,                                     |   "es.array.sort": true,
  "es.array.splice": true,                                    |   "es.array.splice": true,
  "es.date.to-json": false,                                   |   "es.date.to-json": true,
  "es.json.stringify": false,                                 |   "es.json.stringify": true,
  "es.object.assign": false,                                  |   "es.object.assign": true,
  "es.regexp.constructor": false,                             |   "es.regexp.constructor": true,
  "es.regexp.exec": false,                                    |   "es.regexp.exec": true,
  "es.regexp.to-string": false,                               |   "es.regexp.to-string": true,

some weren't in core-js 2.5.1 so compared to it, this are the one es6 fails while corejs 2.5.1 passes and arent't esnext

  "es.symbol.async-iterator": true,                           |   "es.symbol.async-iterator": false,
  "es.array.flat-map": true,                                  |   "es.array.flat-map": false,
  "es.array.unscopables.flat-map": true,                      |   "es.array.unscopables.flat-map": false,
  "es.object.define-getter": true,                            |   "es.object.define-getter": false,
  "es.object.define-setter": true,                            |   "es.object.define-setter": false,
  "es.object.entries": true,                                  |   "es.object.entries": false,
  "es.object.get-own-property-descriptors": true,             |   "es.object.get-own-property-descriptors": false,
  "es.object.lookup-getter": true,                            |   "es.object.lookup-getter": false,
  "es.object.lookup-setter": true,                            |   "es.object.lookup-setter": false,
  "es.object.values": true,                                   |   "es.object.values": false,

@dop251
Copy link
Owner Author

dop251 commented Aug 11, 2020

All these are missing post es6 functionality. I'm going to do the merge now I think...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants