@@ -353,10 +353,11 @@ class FineGrainedDeferredNode(NamedTuple):
353353# Keeps track of partial types in a single scope. In fine-grained incremental
354354# mode partial types initially defined at the top level cannot be completed in
355355# a function, and we use the 'is_function' attribute to enforce this.
356- class PartialTypeScope (NamedTuple ):
357- map : dict [Var , Context ]
358- is_function : bool
359- is_local : bool
356+ class PartialTypeScope :
357+ def __init__ (self , map : dict [Var , Context ], is_function : bool , is_local : bool ) -> None :
358+ self .map : Final = map
359+ self .is_function : Final = is_function
360+ self .is_local : Final = is_local
360361
361362
362363class LocalTypeMap :
@@ -1617,14 +1618,14 @@ def check_func_def(
16171618 else :
16181619 msg = message_registry .MISSING_RETURN_STATEMENT
16191620 if body_is_trivial :
1620- msg = msg ._replace ( code = codes .EMPTY_BODY )
1621+ msg = ErrorMessage ( msg .value , code = codes .EMPTY_BODY )
16211622 self .fail (msg , defn )
16221623 if may_be_abstract :
16231624 self .note (message_registry .EMPTY_BODY_ABSTRACT , defn )
16241625 else :
16251626 msg = message_registry .INCOMPATIBLE_RETURN_VALUE_TYPE
16261627 if body_is_trivial :
1627- msg = msg ._replace ( code = codes .EMPTY_BODY )
1628+ msg = ErrorMessage ( msg .value , code = codes .EMPTY_BODY )
16281629 # similar to code in check_return_stmt
16291630 if (
16301631 not self .check_subtype (
@@ -7874,7 +7875,7 @@ def enter_partial_types(
78747875 self .options .check_untyped_defs and self .dynamic_funcs and self .dynamic_funcs [- 1 ]
78757876 )
78767877
7877- partial_types , _ , _ = self .partial_types .pop ()
7878+ partial_types = self .partial_types .pop (). map
78787879 if not self .current_node_deferred :
78797880 for var , context in partial_types .items ():
78807881 if isinstance (var .type , PartialType ) and var .type .type is None and not permissive :
0 commit comments