-
Notifications
You must be signed in to change notification settings - Fork 163
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
Type association restrictions for extended attributes break with unions #827
Comments
Would changing it to
work in that we don't really care about unions as type other than using them as a grouping mechanism? That would forbid |
Hmm. That would be one option. The other would be to:
That's equivalent to the proposal in #827 (comment) as far as observable behavior for If we wanted to also allow |
In particular, do we want to have |
I don't think we do? Instead you should annotate the buffer-source types specifically, i.e. it should change to typedef (Blob or [AllowShared] BufferSource or FormData or URLSearchParams or ReadableStream or USVString) BodyInit;
I think we should forbid it because it's significantly less clear than |
OK. And similar for [Clamp] and the like? So it sounds like we should allow an extended attribute on a union only if it applies to everything inside the union, is the thinking? |
That makes the most sense to me, at least. |
My intuition is similar to that of @domenic, FWIW. The nullable variant is interesting though, i.e., is (Aside: now that we have unions maybe |
For the nullable case you could do:
and then
to force the [AllowShared] to bind to the inner type, but it's kinda annoying... |
I guess I'd say that for this case and the |
And yes, we could try to move nullables over to union syntax, with the complication that |
Could they not do |
Hmm. Yes, I think they could. |
Consider IDL that says:
Per spec as written right now, this is invalid, because https://heycam.github.io/webidl/#AllowShared says:
and
ArrayBufferView
is in fact not a buffer source type. The rules in https://heycam.github.io/webidl/#idl-type-extended-attribute-associated-with propate the extended attribute to all the things in the union (ignoring for the moment the typedef complications), but don't remove the currently-invalid association with the outer union type...We should really fix both this and #670, presumably, but it's not clear to me what the goals of these restrictions really were and hence how they should be loosened while preserving those goals.
@domenic @annevk
The text was updated successfully, but these errors were encountered: