- From: Darien Maillet Valentine <notifications@github.com>
- Date: Sun, 08 Aug 2021 10:52:20 -0700
- To: heycam/webidl <webidl@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <heycam/webidl/issues/1009@github.com>
Example Web IDL/JS first to help connect the overload step where I think there’s a mistake to something more concrete (attack crabs): ```webidl interface Crab { constructor(); undefined attack(DOMString target); undefined attack((sequence<DOMString> or boolean) targets); }; ``` ```js let crab = new Crab; crab.attack("Misha"); // good crab.attack(true); // convenient shorthand for attacking everyone also good crab.attack([ "Misha", "Logan" ]); // this is busted I think? — ``` ![Screenshot of step 14 highlighting “Otherwise T is a FrozenArray type” with overlaid annotation saying T is actually a union at this step for this example](https://user-images.githubusercontent.com/6257356/128640341-5ca80fbe-ca74-4674-972e-d8773d5ac183.png) At step 12.9 we match the sequence-likes case because a type at the discriminating index (0) is “a union type, nullable union type, or annotated union type that has one of the above types in its flattened member types” and we get a callable result for `GetMethod(V, @@iterator)` (retained as `method`). At step 14, though, where `method` gets used, the `T` of “Let T be the type at index i in the type list of the remaining entry in S.” is `(sequence<DOMString> or boolean)` rather than `sequence<DOMString>`. Since the intention is still clear, it seems like this is just an oversight in the spec text (unless I’m just misreading something else). I’m guessing implementations already do the obvious thing and select the member of T that’s a sequence-like. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/heycam/webidl/issues/1009
Received on Sunday, 8 August 2021 17:52:33 UTC