@@ -93,7 +93,6 @@ def __init__(
9393 is_operator : bool ,
9494 original_type : Type ,
9595 context : Context ,
96- msg : MessageBuilder ,
9796 chk : mypy .checker .TypeChecker ,
9897 self_type : Type | None ,
9998 module_symbol_table : SymbolTable | None = None ,
@@ -106,8 +105,8 @@ def __init__(
106105 self .original_type = original_type
107106 self .self_type = self_type or original_type
108107 self .context = context # Error context
109- self .msg = msg
110108 self .chk = chk
109+ self .msg = chk .msg
111110 self .module_symbol_table = module_symbol_table
112111 self .no_deferral = no_deferral
113112 self .is_self = is_self
@@ -121,7 +120,6 @@ def not_ready_callback(self, name: str, context: Context) -> None:
121120 def copy_modified (
122121 self ,
123122 * ,
124- messages : MessageBuilder | None = None ,
125123 self_type : Type | None = None ,
126124 is_lvalue : bool | None = None ,
127125 original_type : Type | None = None ,
@@ -132,14 +130,11 @@ def copy_modified(
132130 is_operator = self .is_operator ,
133131 original_type = self .original_type ,
134132 context = self .context ,
135- msg = self .msg ,
136133 chk = self .chk ,
137134 self_type = self .self_type ,
138135 module_symbol_table = self .module_symbol_table ,
139136 no_deferral = self .no_deferral ,
140137 )
141- if messages is not None :
142- mx .msg = messages
143138 if self_type is not None :
144139 mx .self_type = self_type
145140 if is_lvalue is not None :
@@ -157,7 +152,6 @@ def analyze_member_access(
157152 is_lvalue : bool ,
158153 is_super : bool ,
159154 is_operator : bool ,
160- msg : MessageBuilder ,
161155 original_type : Type ,
162156 chk : mypy .checker .TypeChecker ,
163157 override_info : TypeInfo | None = None ,
@@ -196,7 +190,6 @@ def analyze_member_access(
196190 is_operator = is_operator ,
197191 original_type = original_type ,
198192 context = context ,
199- msg = msg ,
200193 chk = chk ,
201194 self_type = self_type ,
202195 module_symbol_table = module_symbol_table ,
@@ -494,7 +487,8 @@ def analyze_member_var_access(
494487 original_type is the type of E in the expression E.var
495488 """
496489 # It was not a method. Try looking up a variable.
497- v = lookup_member_var_or_accessor (info , name , mx .is_lvalue )
490+ node = info .get (name )
491+ v = node .node if node else None
498492
499493 mx .chk .warn_deprecated (v , mx .context )
500494
@@ -885,16 +879,6 @@ def expand_self_type_if_needed(
885879 return t
886880
887881
888- def lookup_member_var_or_accessor (info : TypeInfo , name : str , is_lvalue : bool ) -> SymbolNode | None :
889- """Find the attribute/accessor node that refers to a member of a type."""
890- # TODO handle lvalues
891- node = info .get (name )
892- if node :
893- return node .node
894- else :
895- return None
896-
897-
898882def check_self_arg (
899883 functype : FunctionLike ,
900884 dispatched_arg_type : Type ,
0 commit comments