Skip to content

Allow OverloadedFuncDef to have no items #6174

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

Merged
merged 2 commits into from
Jan 10, 2019
Merged

Allow OverloadedFuncDef to have no items #6174

merged 2 commits into from
Jan 10, 2019

Conversation

jstriebel
Copy link
Contributor

Tested this locally, works for me, but I'm not sure if this assertion is necessary for something else.

Fixes #6108

Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I have one suggestion.

self.items = items
self.unanalyzed_items = items.copy()
self.impl = None
self.set_line(items[0].line)
if len(items) > 0:
self.set_line(items[0].line)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe try using self.impl to set line, like in the name() method just below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That does not work, as self.impl is None at this point (see line above).

Copy link
Member

Choose a reason for hiding this comment

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

OK, I see, maybe then set line in deserialize() method below? For example under the if data.get('impl') is not None: branch if items is empty (with a comment explaining that if overload items are empty then the line will not be set in __init__).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, I added it, works for me locally 👍

Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM now!

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.

2 participants