Skip to content

Commit 4cf0e68

Browse files
committed
revert line number change
1 parent 8aabd64 commit 4cf0e68

3 files changed

Lines changed: 9 additions & 17 deletions

File tree

mypy/messages.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
ArgKind,
4545
CallExpr,
4646
Context,
47-
Decorator,
4847
Expression,
4948
FuncDef,
5049
IndexExpr,
@@ -1144,14 +1143,6 @@ def no_variant_matches_arguments(
11441143

11451144
msg = f'Unexpected keyword argument "{kwarg_name}"' + for_func
11461145

1147-
if matching_variant is not None and matching_variant.definition is not None:
1148-
defn = matching_variant.definition
1149-
if isinstance(defn, Decorator):
1150-
func_line = defn.func.line
1151-
else:
1152-
func_line = defn.line
1153-
msg += f" defined on line {func_line}"
1154-
11551146
if matches:
11561147
msg += f"; did you mean {pretty_seq(matches, 'or')}?"
11571148
self.fail(msg, context, code=code)

mypy/semanal.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -493,10 +493,6 @@ def __init__(
493493
# since it's possible that the name will be there once the namespace is complete.
494494
self.incomplete_namespaces = incomplete_namespaces
495495
self.all_exports: list[str] = []
496-
# Map from module id to list of explicitly exported names (i.e. names in __all__).
497-
# This is used by stubgen/stubtest, DO NOT use for any other purposes as it is
498-
# not populated on incremental runs (nor in parallel mode).
499-
self.export_map: dict[str, list[str]] = {}
500496
self.plugin = plugin
501497
# If True, process function definitions. If False, don't. This is used
502498
# for processing module top levels in fine-grained incremental mode.
@@ -724,7 +720,6 @@ def refresh_top_level(self, file_node: MypyFile) -> None:
724720
if file_node.fullname == "typing_extensions":
725721
self.add_typing_extension_aliases(file_node)
726722
self.adjust_public_exports()
727-
self.export_map[self.cur_mod_id] = self.all_exports
728723
self.all_exports = []
729724

730725
def add_implicit_module_attrs(self, file_node: MypyFile) -> None:
@@ -4061,7 +4056,11 @@ def check_and_set_up_type_alias(self, s: AssignmentStmt) -> bool:
40614056
type_params: TypeVarLikeList | None
40624057
all_type_params_names: list[str] | None
40634058
if self.check_type_alias_type_call(s.rvalue, name=lvalue.name):
4064-
rvalue = s.rvalue.args[1]
4059+
rvalue = (
4060+
s.rvalue.args[1]
4061+
if s.rvalue.arg_kinds[1] == ARG_POS
4062+
else s.rvalue.args[s.rvalue.arg_names.index("value")]
4063+
)
40654064
pep_695 = True
40664065
type_params, all_type_params_names = self.analyze_type_alias_type_params(s.rvalue)
40674066
else:
@@ -4249,7 +4248,9 @@ def check_type_alias_type_call(self, rvalue: Expression, *, name: str) -> TypeGu
42494248
return False
42504249
if not self.check_typevarlike_name(rvalue, name, rvalue):
42514250
return False
4252-
if rvalue.arg_kinds.count(ARG_POS) != 2:
4251+
if rvalue.arg_kinds.count(ARG_POS) != (
4252+
2 - ("value" in rvalue.arg_names) - ("name" in rvalue.arg_names)
4253+
):
42534254
return False
42544255

42554256
return True

test-data/unit/check-expressions.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2574,7 +2574,7 @@ def f(foobar: str) -> None: ...
25742574
def f(foobar: Union[int, str]) -> None:
25752575
pass
25762576

2577-
f(fobar=1) # E: Unexpected keyword argument "fobar" for overloaded function "f" defined on line 4; did you mean "foobar"?
2577+
f(fobar=1) # E: Unexpected keyword argument "fobar" for overloaded function "f"; did you mean "foobar"?
25782578
f(random=[1,2,3]) # E: Unexpected keyword argument "random" for overloaded function "f" \
25792579
# N: Possible overload variants: \
25802580
# N: def f(foobar: int) -> None \

0 commit comments

Comments
 (0)