-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Optimization: mark some classes as acyclic #20804
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,8 @@ | |
| from re import Pattern | ||
| from typing import Any, Final | ||
|
|
||
| from mypy_extensions import mypyc_attr | ||
|
|
||
| from mypy import defaults | ||
| from mypy.errorcodes import ErrorCode, error_codes | ||
| from mypy.util import get_class_descriptors, replace_object_state | ||
|
|
@@ -92,6 +94,7 @@ class BuildType: | |
| COMPLETE_FEATURES: Final = frozenset((TYPE_VAR_TUPLE, UNPACK, NEW_GENERIC_SYNTAX)) | ||
|
|
||
|
|
||
| @mypyc_attr(acyclic=True) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, |
||
| class Options: | ||
| """Options collected from flags.""" | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ | |
| write_int as write_int_bare, | ||
| write_str as write_str_bare, | ||
| ) | ||
| from mypy_extensions import mypyc_attr | ||
|
|
||
| import mypy.nodes | ||
| from mypy.bogus_type import Bogus | ||
|
|
@@ -1273,6 +1274,7 @@ def __eq__(self, other: object) -> bool: | |
| return isinstance(other, UnpackType) and self.type == other.type | ||
|
|
||
|
|
||
| @mypyc_attr(acyclic=True) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure we can actually guarantee this. There is |
||
| class AnyType(ProperType): | ||
| """The type 'Any'.""" | ||
|
|
||
|
|
@@ -1381,6 +1383,7 @@ def read(cls, data: ReadBuffer) -> AnyType: | |
| return ret | ||
|
|
||
|
|
||
| @mypyc_attr(acyclic=True) | ||
| class UninhabitedType(ProperType): | ||
| """This type has no members. | ||
|
|
||
|
|
@@ -1436,6 +1439,7 @@ def read(cls, data: ReadBuffer) -> UninhabitedType: | |
| return UninhabitedType() | ||
|
|
||
|
|
||
| @mypyc_attr(acyclic=True) | ||
| class NoneType(ProperType): | ||
| """The type of 'None'. | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is true, because of
direct_dependentsthat points back to SCC that depends on the current one. This is used to notify dependents when they are ready to be processed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually ignore this one, we refer to direct dependents by id, so we should be good here.