@@ -4430,8 +4430,6 @@ impl<'db> TypeInferenceBuilder<'db> {
4430
4430
match ( op, operand_type) {
4431
4431
( _, Type :: Dynamic ( _) ) => operand_type,
4432
4432
( _, Type :: Never ) => Type :: Never ,
4433
- // TODO: Apply the unary expression to the typevar's upper bound/constraints.
4434
- ( _, Type :: TypeVar ( _) ) => Type :: unknown ( ) ,
4435
4433
4436
4434
( ast:: UnaryOp :: UAdd , Type :: IntLiteral ( value) ) => Type :: IntLiteral ( value) ,
4437
4435
( ast:: UnaryOp :: USub , Type :: IntLiteral ( value) ) => Type :: IntLiteral ( -value) ,
@@ -4472,7 +4470,8 @@ impl<'db> TypeInferenceBuilder<'db> {
4472
4470
| Type :: LiteralString
4473
4471
| Type :: BytesLiteral ( _)
4474
4472
| Type :: SliceLiteral ( _)
4475
- | Type :: Tuple ( _) ,
4473
+ | Type :: Tuple ( _)
4474
+ | Type :: TypeVar ( _) ,
4476
4475
) => {
4477
4476
let unary_dunder_method = match op {
4478
4477
ast:: UnaryOp :: Invert => "__invert__" ,
@@ -4594,8 +4593,6 @@ impl<'db> TypeInferenceBuilder<'db> {
4594
4593
( todo @ Type :: Dynamic ( DynamicType :: TodoProtocol ) , _, _)
4595
4594
| ( _, todo @ Type :: Dynamic ( DynamicType :: TodoProtocol ) , _) => Some ( todo) ,
4596
4595
( Type :: Never , _, _) | ( _, Type :: Never , _) => Some ( Type :: Never ) ,
4597
- // TODO: Apply the binary expression to the typevar's upper bound/constraints.
4598
- ( Type :: TypeVar ( _) , _, _) | ( _, Type :: TypeVar ( _) , _) => Some ( Type :: unknown ( ) ) ,
4599
4596
4600
4597
( Type :: IntLiteral ( n) , Type :: IntLiteral ( m) , ast:: Operator :: Add ) => Some (
4601
4598
n. checked_add ( m)
@@ -4749,7 +4746,8 @@ impl<'db> TypeInferenceBuilder<'db> {
4749
4746
| Type :: LiteralString
4750
4747
| Type :: BytesLiteral ( _)
4751
4748
| Type :: SliceLiteral ( _)
4752
- | Type :: Tuple ( _) ,
4749
+ | Type :: Tuple ( _)
4750
+ | Type :: TypeVar ( _) ,
4753
4751
Type :: FunctionLiteral ( _)
4754
4752
| Type :: Callable ( ..)
4755
4753
| Type :: BoundMethod ( _)
@@ -4769,7 +4767,8 @@ impl<'db> TypeInferenceBuilder<'db> {
4769
4767
| Type :: LiteralString
4770
4768
| Type :: BytesLiteral ( _)
4771
4769
| Type :: SliceLiteral ( _)
4772
- | Type :: Tuple ( _) ,
4770
+ | Type :: Tuple ( _)
4771
+ | Type :: TypeVar ( _) ,
4773
4772
op,
4774
4773
) => {
4775
4774
// We either want to call lhs.__op__ or rhs.__rop__. The full decision tree from
0 commit comments