whatwg / webidl

Web IDL Standard
https://webidl.spec.whatwg.org/
Other
400 stars 159 forks source link

"Extended attributes associated with ..." omits UnionMemberType first alt? #867

Open bathos opened 4 years ago

bathos commented 4 years ago

The section describing annotated types provides a set of rules for determining which extended attributes are associated with a type (which is then the inner type of an annotated type). From a grammar POV, I think the cases it looks at are:

None of these cases appears to cover the first alternative of UnionMemberType:

That is, the grammar allows for ([Attr] Type1 or Type2) via that alternative, but I don’t think the “extended attributes associated with” set will actually end up including [Attr] for Type1 if these rules are followed as written. At a glance, it might look like step 3 touches on this case — but step 3 only seems to describe the propagation of the attr of [Attr] (union here) to each of the union’s members.

Logically, the ExtendedAttributeList DistinguishableType alternative is the same idea as TypeWithExtendedAttributes but with a narrower set of possible types, so it looks like handling of this case might have been lost inadvertently in a past refactor or something.

domenic commented 4 years ago

There are a number of open issues about this feature; this seems to be very related to https://github.com/heycam/webidl/issues/827.

bathos commented 4 years ago

Thanks. It does seem related insofar as they both pertain to extended attributes which are (or should be) associated with individual members of a union. AFAICT don’t think they overlap though — I’m pretty sure the issue I’ve described here is a straight-up omission of something that was meant to exist (because as written, the ExtendedAttributeList of ExtendedAttributeList DistinguishableType just disappears into the void, and is not actually associated with anything).