Skip to content

Adds check for abstract methods to generator grammar #25711

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

Closed

Conversation

aleph-naught2tog
Copy link

@aleph-naught2tog aleph-naught2tog commented Jul 17, 2018

Fixes #25710

aleph-naught2tog added 2 commits July 16, 2018 23:57
Before, the compiler would fail on abstract generator methods, since it would confirm
the abstract method had no body; but when checking the generator grammar, it would see the lack of a `node.body` and fail it as an overloaded generator. Adding a check for the Abstract flag means the compiler accurately recognizes the abstract generator not as an overload, but as an abstract method.
@msftclas
Copy link

msftclas commented Jul 17, 2018

CLA assistant check
All CLA requirements met.

@aleph-naught2tog aleph-naught2tog changed the title Adds test case Adds check for abstract methods to generator grammar Jul 17, 2018
Maggie Shemayev added 3 commits July 17, 2018 00:22
The first fix for allowing abstract generators also meant that abstract overloaded generators were allowed. This prevents any overloading of generators, abstract or not, while still allowing the declaration of abstract generator methods.
if (!node.body) {
return grammarErrorOnNode(node.asteriskToken!, Diagnostics.An_overload_signature_cannot_be_declared_as_a_generator);
if (!node.body && !hasModifier(node, ModifierFlags.Abstract)) {
return grammarErrorOnNode(node.asteriskToken!, Diagnostics.An_overload_signature_cannot_be_declared_as_a_generator);
Copy link
Member

Choose a reason for hiding this comment

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

Can you fix the indentation?

Copy link
Author

Choose a reason for hiding this comment

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

Absolutely! 👍

Copy link
Author

Choose a reason for hiding this comment

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

@mhegazy
Copy link
Contributor

mhegazy commented Jul 26, 2018

I do not think this is a change we want to make. see my comment in #25710 (comment)

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

Successfully merging this pull request may close these issues.

5 participants