-
-
Notifications
You must be signed in to change notification settings - Fork 62
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 Set.union #212
base: main
Are you sure you want to change the base?
Implement Set.union #212
Conversation
From https://github.com/tc39/proposal-set-methods which is currently at Stage 3
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.
these two things jumped out at me. dunno if they are the cause or not.
Co-authored-by: snek <me@gus.host>
Co-authored-by: snek <me@gus.host>
That appears to have done it, thank you! |
Also add a new message, as I couldn't seem to find one that matched, but I'm unsure if I missed it or not.
I'm marking tc39/test262#3816 as ready for review, and this implementation should pass all the tests there. 👍 |
@@ -172,6 +232,7 @@ export function bootstrapSetPrototype(realmRec) { | |||
['has', SetProto_has, 1], | |||
['size', [SetProto_sizeGetter]], | |||
['values', SetProto_values, 0], | |||
['union', SetProto_union, 1], |
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.
I'm actually fairly unsure what the number here means, so please double check this. :)
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.
its the initial "length" property of the function. based on this in the spec:
Every built-in function object, including constructors, has a "length" property whose value is a non-negative integral Number. Unless otherwise specified, this value is the number of required parameters shown in the subclause heading for the function description. Optional parameters and rest parameters are not included in the parameter count.
[NOTE 2] For example, the function object that is the initial value of the "map" property of the Array prototype object is described under the subclause heading «Array.prototype.map (callbackFn [ , thisArg])» which shows the two named arguments callbackFn and thisArg, the latter being optional; therefore the value of the "length" property of that function object is 1𝔽.
@@ -135,6 +135,7 @@ export const RegExpExecNotObject = (o) => `${i(o)} is not object or null`; | |||
export const ResolutionNullOrAmbiguous = (r, n, m) => (r === null | |||
? `Could not resolve import ${i(n)} from ${m.HostDefined.specifier}` | |||
: `Star export ${i(n)} from ${m.HostDefined.specifier} is ambiguous`); | |||
export const SizeIsNaN = () => 'size property must not be undefined, as it will be NaN'; |
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.
There doesn't appear to be an existing error for this situation, so I added this here. That said, I'm very open to changes/suggestions on this part.
I'm also unsure if there's some sort of process I need to go through to get the linter working with this new error?
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.
all you need to do for the linter is run the build
script.
FYI, the corresponding PR in test262 has been merged. 🎉 This PR should still pass all the tests, but I won't have the chance to verify that for a bit. |
Hello! First time contributor here, so feel free to suggest anything and everything to me. ❤️
I am in the process of looking at writing some test262 tests for the new Set Methods (currently at Stage 3), and subsequently came across engine262 as a place where I could validate the tests.
With that goal in mind, I thought I could start by writing the implementation of just
union
, to get an idea of how everything works and figure it out. That said, I'm sure there's stuff here I've done wrong and would love to get feedback on it.