Skip to content

Commit

Permalink
[red-knot] Remove unneeded branch in Type::is_equivalent_to() (#15242)
Browse files Browse the repository at this point in the history
## Summary

We understand `sys.version_info` branches now! As such, I _believe_ this
branch is no longer required; all tests pass without it. I also ran
`QUICKCHECK_TESTS=100000 cargo test -p red_knot_python_semantic --
--ignored types::property_tests::stable`, and no tests failed except for
the known issue with `Type::is_assignable_to()`
(#14899)

## Test Plan

See above
  • Loading branch information
AlexWaygood authored Jan 3, 2025
1 parent 842f882 commit bde8ecd
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions crates/red_knot_python_semantic/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1010,26 +1010,6 @@ impl<'db> Type<'db> {
return false;
}

// TODO: The following is a workaround that is required to unify the two different versions
// of `NoneType` and `NoDefaultType` in typeshed. This should not be required anymore once
// we understand `sys.version_info` branches.
if let (
Type::Instance(InstanceType { class: self_class }),
Type::Instance(InstanceType {
class: target_class,
}),
) = (self, other)
{
let self_known = self_class.known(db);
if matches!(
self_known,
Some(KnownClass::NoneType | KnownClass::NoDefaultType)
) && self_known == target_class.known(db)
{
return true;
}
}

// type[object] ≡ type
if let (
Type::SubclassOf(SubclassOfType {
Expand Down

0 comments on commit bde8ecd

Please sign in to comment.