Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.1k
Fix issues with type aliases and new style unions#14181
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
8d90d97acd93db51660b0f73ee51096d8bd3e4e809a732e7a41cd383afc8754ceee87b8666b557a7284b0716501d178f7fac2df6c3980050File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1969,10 +1969,20 @@ def accept(self, visitor: ExpressionVisitor[T]) -> T: | ||
| class OpExpr(Expression): | ||
| """Binary operation. | ||
| The dot (.), [] and comparison operators have more specific nodes. | ||
| """ | ||
| __slots__ = ( | ||
| "op", | ||
| "left", | ||
| "right", | ||
| "method_type", | ||
| "right_always", | ||
| "right_unreachable", | ||
| "analyzed", | ||
| ) | ||
| __match_args__ = ("left", "op", "right") | ||
| @@ -1985,15 +1995,20 @@ class OpExpr(Expression): | ||
| right_always: bool | ||
| # Per static analysis only: Is the right side unreachable? | ||
| right_unreachable: bool | ||
| # Used for expressions that represent a type "X | Y" in some contexts | ||
| analyzed: TypeAliasExpr | None | ||
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. This should now be handled in various visitors. Three cases come to my mind: First, T=TypeVar("T",int,str)deffoo(x:T)->T:A=type[int]|strreturnx Second, And in general adding in to the basic CollaboratorAuthor 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. Very good points! I'll fix these. | ||
| def __init__( | ||
| self, op: str, left: Expression, right: Expression, analyzed: TypeAliasExpr | None = None | ||
| ) -> None: | ||
| super().__init__() | ||
| self.op = op | ||
| self.left = left | ||
| self.right = right | ||
| self.method_type = None | ||
| self.right_always = False | ||
| self.right_unreachable = False | ||
| self.analyzed = analyzed | ||
| def accept(self, visitor: ExpressionVisitor[T]) -> T: | ||
| return visitor.visit_op_expr(self) | ||