File tree Expand file tree Collapse file tree 2 files changed +5
-17
lines changed
crates/ty_python_semantic Expand file tree Collapse file tree 2 files changed +5
-17
lines changed Original file line number Diff line number Diff line change @@ -891,7 +891,7 @@ reveal_type(Derived().redeclared_with_same_type) # revealed: str | None
891891
892892# TODO : It would probably be more consistent if these were `str | None`
893893reveal_type(Derived.redeclared_with_narrower_type) # revealed: str
894- reveal_type(Derived().redeclared_with_narrower_type) # revealed: str | None
894+ reveal_type(Derived().redeclared_with_narrower_type) # revealed: str
895895
896896# TODO : It would probably be more consistent if these were `str | None`
897897reveal_type(Derived.redeclared_with_wider_type) # revealed: str | int | None
@@ -915,7 +915,7 @@ reveal_type(Derived().pure_overwritten_in_subclass_method) # revealed: str
915915reveal_type(Derived.undeclared) # revealed: Unknown | Literal["intermediate"]
916916reveal_type(Derived().undeclared) # revealed: Unknown | Literal["intermediate"]
917917
918- reveal_type(Derived().pure_undeclared) # revealed: Unknown | Literal["base ", "intermediate "]
918+ reveal_type(Derived().pure_undeclared) # revealed: Unknown | Literal["intermediate ", "base "]
919919```
920920
921921## Accessing attributes on class objects
Original file line number Diff line number Diff line change @@ -113,10 +113,7 @@ fn implicit_attribute_initial<'db>(
113113 _name : String ,
114114 _target_method_decorator : MethodDecorator ,
115115) -> Member < ' db > {
116- Member {
117- inner : Place :: Unbound . into ( ) ,
118- is_declared : false ,
119- }
116+ Member :: unbound ( )
120117}
121118
122119fn try_mro_cycle_recover < ' db > (
@@ -2873,10 +2870,7 @@ impl<'db> ClassLiteral<'db> {
28732870 let mut union_qualifiers = TypeQualifiers :: empty ( ) ;
28742871 let mut is_definitely_bound = false ;
28752872
2876- let mro = self . try_mro ( db, specialization) ;
2877- let mro = mro. unwrap_or_else ( |e| e. fallback_mro ( ) ) ;
2878-
2879- for superclass in mro. iter ( ) . rev ( ) {
2873+ for superclass in self . iter_mro ( db, specialization) {
28802874 match superclass {
28812875 ClassBase :: Generic | ClassBase :: Protocol => {
28822876 // Skip over these very special class bases that aren't really classes.
@@ -2903,13 +2897,7 @@ impl<'db> ClassLiteral<'db> {
29032897 is_definitely_bound = true ;
29042898
29052899 if is_declared {
2906- if union. is_empty ( ) {
2907- // Short-circuit, no need to allocate inside the union builder
2908- return member;
2909- }
2910-
2911- return Place :: bound ( union. add ( ty) . build ( ) )
2912- . with_qualifiers ( union_qualifiers) ;
2900+ return member;
29132901 }
29142902 }
29152903
You can’t perform that action at this time.
0 commit comments