@@ -3646,7 +3646,12 @@ def unwrap_final(self, s: AssignmentStmt) -> bool:
36463646 invalid_bare_final = False
36473647 if not s .unanalyzed_type .args :
36483648 s .type = None
3649- if isinstance (s .rvalue , TempNode ) and s .rvalue .no_rhs :
3649+ if (
3650+ isinstance (s .rvalue , TempNode )
3651+ and s .rvalue .no_rhs
3652+ # Filter duplicate errors, we already reported this:
3653+ and not (self .type and self .type .is_named_tuple )
3654+ ):
36503655 invalid_bare_final = True
36513656 self .fail ("Type in Final[...] can only be omitted if there is an initializer" , s )
36523657 else :
@@ -7351,6 +7356,7 @@ def type_analyzer(
73517356 allow_unpack : bool = False ,
73527357 report_invalid_types : bool = True ,
73537358 prohibit_self_type : str | None = None ,
7359+ prohibit_special_class_field_types : str | None = None ,
73547360 allow_type_any : bool = False ,
73557361 ) -> TypeAnalyser :
73567362 if tvar_scope is None :
@@ -7370,6 +7376,7 @@ def type_analyzer(
73707376 allow_param_spec_literals = allow_param_spec_literals ,
73717377 allow_unpack = allow_unpack ,
73727378 prohibit_self_type = prohibit_self_type ,
7379+ prohibit_special_class_field_types = prohibit_special_class_field_types ,
73737380 allow_type_any = allow_type_any ,
73747381 )
73757382 tpan .in_dynamic_func = bool (self .function_stack and self .function_stack [- 1 ].is_dynamic ())
@@ -7394,6 +7401,7 @@ def anal_type(
73947401 allow_unpack : bool = False ,
73957402 report_invalid_types : bool = True ,
73967403 prohibit_self_type : str | None = None ,
7404+ prohibit_special_class_field_types : str | None = None ,
73977405 allow_type_any : bool = False ,
73987406 ) -> Type | None :
73997407 """Semantically analyze a type.
@@ -7429,6 +7437,7 @@ def anal_type(
74297437 allow_unpack = allow_unpack ,
74307438 report_invalid_types = report_invalid_types ,
74317439 prohibit_self_type = prohibit_self_type ,
7440+ prohibit_special_class_field_types = prohibit_special_class_field_types ,
74327441 allow_type_any = allow_type_any ,
74337442 )
74347443 tag = self .track_incomplete_refs ()
0 commit comments