Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,29 @@ class UsesMeta2(metaclass=Meta2): ...
static_assert(is_disjoint_from(type[UsesMeta1], type[UsesMeta2]))
```

### `property`

```py
from ty_extensions import is_disjoint_from, static_assert, TypeOf
from typing import final

class C:
@property
def prop(self) -> int:
return 1

reveal_type(C.prop) # revealed: property

@final
class D:
pass

static_assert(not is_disjoint_from(int, TypeOf[C.prop]))
static_assert(not is_disjoint_from(TypeOf[C.prop], int))
static_assert(is_disjoint_from(TypeOf[C.prop], D))
static_assert(is_disjoint_from(D, TypeOf[C.prop]))
```

## Callables

No two callable types are disjoint because there exists a non-empty callable type
Expand Down
8 changes: 5 additions & 3 deletions crates/ty_python_semantic/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2101,9 +2101,11 @@ impl<'db> Type<'db> {
instance.is_disjoint_from(db, KnownClass::Tuple.to_instance(db))
}

(Type::PropertyInstance(_), _) | (_, Type::PropertyInstance(_)) => KnownClass::Property
.to_instance(db)
.is_disjoint_from(db, other),
(Type::PropertyInstance(_), other) | (other, Type::PropertyInstance(_)) => {
KnownClass::Property
.to_instance(db)
.is_disjoint_from(db, other)
}

(Type::BoundSuper(_), Type::BoundSuper(_)) => !self.is_equivalent_to(db, other),
(Type::BoundSuper(_), other) | (other, Type::BoundSuper(_)) => KnownClass::Super
Expand Down
Loading