Skip to content

Fix dep generation of super() and class names #4513

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 26, 2018
Merged

Fix dep generation of super() and class names #4513

merged 2 commits into from
Jan 26, 2018

Conversation

msullivan
Copy link
Collaborator

Class names need to generate dependencies to init even when not
directly being called, since they could be passed elsewhere and
called. We generate spurious dependencies in cases such as classes
being referenced in isinstance checks and expect statements, but
that's not a big deal.

Handling super() deps is bundled in with this because the init fix
broke a super() using test that previously worked somewhat by accident.

Class names need to generate dependencies to __init__ even when not
directly being called, since they could be passed elsewhere and
called. We generate spurious dependencies in cases such as classes
being referenced in isinstance checks and expect statements, but
that's not a big deal.

Handling super() deps is bundled in with this because the __init__ fix
broke a super() using test that previously worked somewhat by accident.
@msullivan msullivan requested a review from JukkaL January 26, 2018 01:22
Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

Looks good, just a question about performance (no need to address it now, but might be worth creating an issue/TODO).


# If this is a reference to a type, generate a dependency to its
# constructor. This will be spurious in cases like isinstance
# calls and except statements, but that's no big deal.
Copy link
Collaborator

Choose a reason for hiding this comment

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

What about class attribute references? If things like Foobar.method() depend on FooBar.__init__, this could have performance implications.

@msullivan msullivan merged commit 8ec7046 into master Jan 26, 2018
@msullivan msullivan deleted the ctor-deps branch January 26, 2018 19:25
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