Skip to content
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

Forbid overloading operations with Promise and non-Promise return types. #776

Merged
merged 1 commit into from
Apr 30, 2020

Conversation

Ms2ger
Copy link
Member

@Ms2ger Ms2ger commented Aug 23, 2019

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable but I wonder if https://www.w3.org/Bugs/Public/show_bug.cgi?id=25051 has more to it. In particular the sentence @bzbarsky quotes there remains, and e.g. for void/Window overloads (like document.open), "the return type" is still problematic.

As such I'll leave @bzbarsky to give approval on the best approach here. (But thanks for tackling old issue-tracker issues!!)

@bzbarsky
Copy link
Collaborator

We should probably go through the uses of the "return type" concept in the spec and see what they actually want. Maybe we should actually have a "set of return types". For example, the [NewObject] requirement around "return type" should probably apply to all the return types for all the overloads.

We could then require that all the types in the set either are or are not promise types and switch on that boolean in the operation steps that check for promise return type.

In general, it seems we use "return type" in the following normative language:

I think that's it.

I'm happy to solve the promise-vs-not problem for a start, because I think that's the only "real" problem here in practice, or have a slightly more extensive refactoring if desired.

@Ms2ger
Copy link
Member Author

Ms2ger commented Aug 27, 2019

We're generally not clear on whether an "operation" is a single signature or a set of signature; that also causes issues in the loop over all operations in define the operations, for example. I'd like to untangle it all at some point, but not in this PR.

@ExE-Boss
Copy link
Contributor

It should also be disallowed to have Promise and non‑Promise types in a union of a return type.

@bzbarsky
Copy link
Collaborator

See https://heycam.github.io/webidl/#dfn-distinguishable and "Example 27" following it.

domenic added a commit to jsdom/webidl2js that referenced this pull request Apr 27, 2020
Closes #79.

This removes support for overloading promise operations and non-promise operations, per whatwg/webidl#776.
@annevk annevk requested a review from domenic April 30, 2020 06:23
Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's merge this and spin off a separate issue for examining the "return type" problem generally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants