@@ -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 :
@@ -1604,14 +1605,14 @@ def check_func_def(
16041605 else :
16051606 msg = message_registry .MISSING_RETURN_STATEMENT
16061607 if body_is_trivial :
1607- msg = msg ._replace ( code = codes .EMPTY_BODY )
1608+ msg = ErrorMessage ( msg .value , code = codes .EMPTY_BODY )
16081609 self .fail (msg , defn )
16091610 if may_be_abstract :
16101611 self .note (message_registry .EMPTY_BODY_ABSTRACT , defn )
16111612 else :
16121613 msg = message_registry .INCOMPATIBLE_RETURN_VALUE_TYPE
16131614 if body_is_trivial :
1614- msg = msg ._replace ( code = codes .EMPTY_BODY )
1615+ msg = ErrorMessage ( msg .value , code = codes .EMPTY_BODY )
16151616 # similar to code in check_return_stmt
16161617 if (
16171618 not self .check_subtype (
@@ -7857,7 +7858,7 @@ def enter_partial_types(
78577858 self .options .check_untyped_defs and self .dynamic_funcs and self .dynamic_funcs [- 1 ]
78587859 )
78597860
7860- partial_types , _ , _ = self .partial_types .pop ()
7861+ partial_types = self .partial_types .pop (). map
78617862 if not self .current_node_deferred :
78627863 for var , context in partial_types .items ():
78637864 if isinstance (var .type , PartialType ) and var .type .type is None and not permissive :
0 commit comments