Skip to content

Do not pass message builder to analyze_member_access #18818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,6 @@ def extract_callable_type(self, inner_type: Type | None, ctx: Context) -> Callab
is_lvalue=False,
is_super=False,
is_operator=True,
msg=self.msg,
original_type=inner_type,
chk=self,
)
Expand Down Expand Up @@ -4736,7 +4735,6 @@ def check_member_assignment(
original_type=instance_type,
context=context,
self_type=None,
msg=self.msg,
chk=self,
)
get_type = analyze_descriptor_access(attribute_type, mx, assignment=True)
Expand Down Expand Up @@ -6746,7 +6744,6 @@ def replay_lookup(new_parent_type: ProperType) -> Type | None:
is_lvalue=False,
is_super=False,
is_operator=False,
msg=self.msg,
original_type=new_parent_type,
chk=self,
in_literal_context=False,
Expand Down Expand Up @@ -8044,7 +8041,6 @@ def has_valid_attribute(self, typ: Type, name: str) -> bool:
is_lvalue=False,
is_super=False,
is_operator=False,
msg=self.msg,
original_type=typ,
chk=self,
# This is not a real attribute lookup so don't mess with deferring nodes.
Expand Down
7 changes: 0 additions & 7 deletions mypy/checkexpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,6 @@ def check_union_call_expr(self, e: CallExpr, object_type: UnionType, member: str
is_lvalue=False,
is_super=False,
is_operator=False,
msg=self.msg,
original_type=object_type,
chk=self.chk,
in_literal_context=self.is_literal_context(),
Expand Down Expand Up @@ -1593,7 +1592,6 @@ def check_call(
is_lvalue=False,
is_super=False,
is_operator=True,
msg=self.msg,
original_type=original_type or callee,
chk=self.chk,
in_literal_context=self.is_literal_context(),
Expand Down Expand Up @@ -3353,7 +3351,6 @@ def analyze_ordinary_member_access(self, e: MemberExpr, is_lvalue: bool) -> Type
is_lvalue=is_lvalue,
is_super=False,
is_operator=False,
msg=self.msg,
original_type=original_type,
chk=self.chk,
in_literal_context=self.is_literal_context(),
Expand All @@ -3377,7 +3374,6 @@ def analyze_external_member_access(
is_lvalue=False,
is_super=False,
is_operator=False,
msg=self.msg,
original_type=base_type,
chk=self.chk,
in_literal_context=self.is_literal_context(),
Expand Down Expand Up @@ -3872,7 +3868,6 @@ def check_method_call_by_name(
is_lvalue=False,
is_super=False,
is_operator=True,
msg=self.msg,
original_type=original_type,
self_type=base_type,
chk=self.chk,
Expand Down Expand Up @@ -3967,7 +3962,6 @@ def lookup_operator(op_name: str, base_type: Type) -> Type | None:
is_operator=True,
original_type=base_type,
context=context,
msg=self.msg,
chk=self.chk,
in_literal_context=self.is_literal_context(),
)
Expand Down Expand Up @@ -5568,7 +5562,6 @@ def visit_super_expr(self, e: SuperExpr) -> Type:
original_type=instance_type,
override_info=base,
context=e,
msg=self.msg,
chk=self.chk,
in_literal_context=self.is_literal_context(),
)
Expand Down
9 changes: 1 addition & 8 deletions mypy/checkmember.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def __init__(
is_operator: bool,
original_type: Type,
context: Context,
msg: MessageBuilder,
chk: mypy.checker.TypeChecker,
self_type: Type | None,
module_symbol_table: SymbolTable | None = None,
Expand All @@ -108,8 +107,8 @@ def __init__(
self.original_type = original_type
self.self_type = self_type or original_type
self.context = context # Error context
self.msg = msg
self.chk = chk
self.msg = chk.msg
self.module_symbol_table = module_symbol_table
self.no_deferral = no_deferral
self.is_self = is_self
Expand All @@ -123,7 +122,6 @@ def not_ready_callback(self, name: str, context: Context) -> None:
def copy_modified(
self,
*,
messages: MessageBuilder | None = None,
self_type: Type | None = None,
is_lvalue: bool | None = None,
original_type: Type | None = None,
Expand All @@ -134,14 +132,11 @@ def copy_modified(
is_operator=self.is_operator,
original_type=self.original_type,
context=self.context,
msg=self.msg,
chk=self.chk,
self_type=self.self_type,
module_symbol_table=self.module_symbol_table,
no_deferral=self.no_deferral,
)
if messages is not None:
mx.msg = messages
if self_type is not None:
mx.self_type = self_type
if is_lvalue is not None:
Expand All @@ -159,7 +154,6 @@ def analyze_member_access(
is_lvalue: bool,
is_super: bool,
is_operator: bool,
msg: MessageBuilder,
original_type: Type,
chk: mypy.checker.TypeChecker,
override_info: TypeInfo | None = None,
Expand Down Expand Up @@ -198,7 +192,6 @@ def analyze_member_access(
is_operator=is_operator,
original_type=original_type,
context=context,
msg=msg,
chk=chk,
self_type=self_type,
module_symbol_table=module_symbol_table,
Expand Down
2 changes: 0 additions & 2 deletions mypy/checkpattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,6 @@ def visit_class_pattern(self, o: ClassPattern) -> PatternType:
is_lvalue=False,
is_super=False,
is_operator=False,
msg=self.msg,
original_type=typ,
chk=self.chk,
)
Expand Down Expand Up @@ -664,7 +663,6 @@ def visit_class_pattern(self, o: ClassPattern) -> PatternType:
is_lvalue=False,
is_super=False,
is_operator=False,
msg=self.msg,
original_type=new_type,
chk=self.chk,
)
Expand Down