@@ -2147,16 +2147,11 @@ def check_method_override_for_base_with_name(
21472147 # it can be checked for compatibility.
21482148 original_type = get_proper_type (base_attr .type )
21492149 original_node = base_attr .node
2150- always_allow_covariant = False
2151- if is_settable_property (defn ) and (
2152- is_settable_property (original_node ) or isinstance (original_node , Var )
2153- ):
2154- if is_custom_settable_property (defn ) or (is_custom_settable_property (original_node )):
2155- always_allow_covariant = True
2156- self .check_setter_type_override (defn , base_attr , base )
21572150 # `original_type` can be partial if (e.g.) it is originally an
21582151 # instance variable from an `__init__` block that becomes deferred.
2152+ supertype_ready = True
21592153 if original_type is None or isinstance (original_type , PartialType ):
2154+ supertype_ready = False
21602155 if self .pass_num < self .last_pass :
21612156 # If there are passes left, defer this node until next pass,
21622157 # otherwise try reconstructing the method type from available information.
@@ -2179,6 +2174,19 @@ def check_method_override_for_base_with_name(
21792174 else :
21802175 # Will always fail to typecheck below, since we know the node is a method
21812176 original_type = NoneType ()
2177+
2178+ always_allow_covariant = False
2179+ if is_settable_property (defn ) and (
2180+ is_settable_property (original_node ) or isinstance (original_node , Var )
2181+ ):
2182+ if is_custom_settable_property (defn ) or (is_custom_settable_property (original_node )):
2183+ # Unlike with getter, where we try to construct some fallback type in case of
2184+ # deferral during last_pass, we can't make meaningful setter checks if the
2185+ # supertype is not known precisely.
2186+ if supertype_ready :
2187+ always_allow_covariant = True
2188+ self .check_setter_type_override (defn , base_attr , base )
2189+
21822190 if isinstance (original_node , (FuncDef , OverloadedFuncDef )):
21832191 original_class_or_static = original_node .is_class or original_node .is_static
21842192 elif isinstance (original_node , Decorator ):
0 commit comments