@@ -1969,10 +1969,20 @@ def accept(self, visitor: ExpressionVisitor[T]) -> T:
19691969
19701970
19711971class OpExpr (Expression ):
1972- """Binary operation (other than . or [] or comparison operators,
1973- which have specific nodes)."""
1972+ """Binary operation.
19741973
1975- __slots__ = ("op" , "left" , "right" , "method_type" , "right_always" , "right_unreachable" )
1974+ The dot (.), [] and comparison operators have more specific nodes.
1975+ """
1976+
1977+ __slots__ = (
1978+ "op" ,
1979+ "left" ,
1980+ "right" ,
1981+ "method_type" ,
1982+ "right_always" ,
1983+ "right_unreachable" ,
1984+ "analyzed" ,
1985+ )
19761986
19771987 __match_args__ = ("left" , "op" , "right" )
19781988
@@ -1985,15 +1995,20 @@ class OpExpr(Expression):
19851995 right_always : bool
19861996 # Per static analysis only: Is the right side unreachable?
19871997 right_unreachable : bool
1998+ # Used for expressions that represent a type "X | Y" in some contexts
1999+ analyzed : TypeAliasExpr | None
19882000
1989- def __init__ (self , op : str , left : Expression , right : Expression ) -> None :
2001+ def __init__ (
2002+ self , op : str , left : Expression , right : Expression , analyzed : TypeAliasExpr | None = None
2003+ ) -> None :
19902004 super ().__init__ ()
19912005 self .op = op
19922006 self .left = left
19932007 self .right = right
19942008 self .method_type = None
19952009 self .right_always = False
19962010 self .right_unreachable = False
2011+ self .analyzed = analyzed
19972012
19982013 def accept (self , visitor : ExpressionVisitor [T ]) -> T :
19992014 return visitor .visit_op_expr (self )
0 commit comments