Skip to content
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
7 changes: 1 addition & 6 deletions mypy/semanal_namedtuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,16 +605,11 @@ def make_init_arg(var: Var) -> Argument:

add_method("__new__", ret=selftype, args=[make_init_arg(var) for var in vars], is_new=True)
add_method("_asdict", args=[], ret=ordereddictype)
special_form_any = AnyType(TypeOfAny.special_form)
add_method(
"_make",
ret=selftype,
is_classmethod=True,
args=[
Argument(Var("iterable", iterable_type), iterable_type, None, ARG_POS),
Argument(Var("new"), special_form_any, EllipsisExpr(), ARG_NAMED_OPT),
Argument(Var("len"), special_form_any, EllipsisExpr(), ARG_NAMED_OPT),
],
args=[Argument(Var("iterable", iterable_type), iterable_type, None, ARG_POS)],
)

self_tvar_expr = TypeVarExpr(
Expand Down
4 changes: 2 additions & 2 deletions test-data/unit/check-newsemanal.test
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ class SubO(Out): pass

o: SubO

reveal_type(SubO._make) # N: Revealed type is "def (iterable: typing.Iterable[Any], *, new: Any =, len: Any =) -> Tuple[Tuple[builtins.str, __main__.Other, fallback=__main__.In], __main__.Other, fallback=__main__.SubO]"
reveal_type(SubO._make) # N: Revealed type is "def (iterable: typing.Iterable[Any]) -> Tuple[Tuple[builtins.str, __main__.Other, fallback=__main__.In], __main__.Other, fallback=__main__.SubO]"
reveal_type(o._replace(y=Other())) # N: Revealed type is "Tuple[Tuple[builtins.str, __main__.Other, fallback=__main__.In], __main__.Other, fallback=__main__.SubO]"
[builtins fixtures/tuple.pyi]

Expand All @@ -1009,7 +1009,7 @@ o: Out
reveal_type(o) # N: Revealed type is "Tuple[Tuple[builtins.str, __main__.Other, fallback=__main__.In], __main__.Other, fallback=__main__.Out]"
reveal_type(o.x) # N: Revealed type is "Tuple[builtins.str, __main__.Other, fallback=__main__.In]"
reveal_type(o.x.t) # N: Revealed type is "__main__.Other"
reveal_type(Out._make) # N: Revealed type is "def (iterable: typing.Iterable[Any], *, new: Any =, len: Any =) -> Tuple[Tuple[builtins.str, __main__.Other, fallback=__main__.In], __main__.Other, fallback=__main__.Out]"
reveal_type(Out._make) # N: Revealed type is "def (iterable: typing.Iterable[Any]) -> Tuple[Tuple[builtins.str, __main__.Other, fallback=__main__.In], __main__.Other, fallback=__main__.Out]"
[builtins fixtures/tuple.pyi]

[case testNewAnalyzerIncompleteRefShadowsBuiltin1]
Expand Down