-
-
Notifications
You must be signed in to change notification settings - Fork 406
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
Implement Object.getOwnPropertyNames and Object.getOwnPropertySymbols #1606
Implement Object.getOwnPropertyNames and Object.getOwnPropertySymbols #1606
Conversation
Conformance testsBeforeResults: AfterTotal tests: 80930 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some recommendations to improve the code. Aside from that, looks good!
Test262 conformance changes:
Fixed tests (121):
|
Smaller diffs are better for first contributions. This allows us to review and merge ASAP.
Please do so! We are currently lacking a lot of tests so they are always appreciated :) |
Thank you very much for the contribution!! It's interesting how |
@jedel1043 Thanks a lot for helping review this!
Sure, sounds great 👍
Alright, I'll write some soon! |
@Razican no problem!
Indeed, I was wondering about the same thing... I don't think the following provides much value since it seems that boa tries to stick to the spec as much as possible, but when running the following code on the browser (I use firefox): const returned = "Array,BigInt,Boolean,Date,Error,EvalError,Function,Infinity,JSON,Map,Math,NaN,Number,Object,RangeError,ReferenceError,Reflect,RegExp,Set,String,Symbol,SyntaxError,TypeError,URIError,console,globalThis,isFinite,isNaN,parseFloat,parseInt,undefined".split(",");
for (let ret of returned) {
if (!Object.getOwnPropertyNames(this).includes(ret)) {
console.log("not included:", ret);
}
} I don't see any output in the console, which seems to suggest that boa's |
@jedel1043 just curious, is there a way for me to recreate this output easily? |
Yeah, the workflow has an "EcmaScript official test suite" check with exactly that. For first contributions we have to manually run the workflow but after the first contribution you can just check that section to see the number of fixed and broken tests |
The "update comment" job of that check gives you a nifty table that you can copy-paste as a comment: Test262 conformance changes:
Fixed tests (121):
|
Ah okay got it, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Good work!
We normally wait for two reviews in order to merge a PR, just in case the first reviewer missed something, so you just need to wait a bit of time until another maintainer approves it and it should be merged asap :) |
Sure, no problem. Thanks for the help! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, let's merge! :)
Scope
This Pull Request partially fixes/closes #1580.
In this PR, I implemented
Object.getOwnPropertyNames
andObject.getOwnPropertySymbols
. Originally I planned to open separate PRs for each of the missing method listed in #1580, but ended up implementing these two methods in one PR since they are very much alike.I still plan to work on
Object.fromEntries
andObject.hasOwn
in separate PRs, though. Please let me know in case it's preferred to have the implementation of these four methods in this PR instead!Testing
There are several failing conformance tests, which are due to the following:
Proxy
not defined (I'm guessing it's not implemented yet?)Object.getOwnPropertyNames(this)
returning slightly different set of properties from expected:Array,Boolean,Date,Date,Error,EvalError,Function,Infinity,JSON,Math,NaN,Number,Object,RangeError,ReferenceError,RegExp,String,SyntaxError,TypeError,URIError,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,eval,isFinite,isNaN,parseFloat,parseInt,undefined
Array,BigInt,Boolean,Date,Error,EvalError,Function,Infinity,JSON,Map,Math,NaN,Number,Object,RangeError,ReferenceError,Reflect,RegExp,Set,String,Symbol,SyntaxError,TypeError,URIError,console,globalThis,isFinite,isNaN,parseFloat,parseInt,undefined
test/built-ins/Object/getOwnPropertySymbols/order-after-define-property.js
failing withUncaught "TypeError": "can't convert symbol to string"
. I think this has something to do with calling[Symbol("a")].toString()
, but I'm not exactly sure. Anyhow, I tried editing the test such that no string conversion happens, and the test passed.On another note, should I also write some custom tests in the
builtins/object/tests.rs
file?