Skip to content

Commit f2739cc

Browse files
committed
Merge remote-tracking branch 'upstream/master' into do-not-update-meta
2 parents a1f8ee7 + 16cd4c5 commit f2739cc

File tree

7 files changed

+24
-11
lines changed

7 files changed

+24
-11
lines changed

docs/source/command_line.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ definitions or calls.
372372

373373
.. option:: --untyped-calls-exclude
374374

375-
This flag allows to selectively disable :option:`--disallow-untyped-calls`
375+
This flag allows one to selectively disable :option:`--disallow-untyped-calls`
376376
for functions and methods defined in specific packages, modules, or classes.
377377
Note that each exclude entry acts as a prefix. For example (assuming there
378378
are no type annotations for ``third_party_lib`` available):
@@ -562,7 +562,7 @@ potentially problematic or redundant in some way.
562562

563563
.. option:: --deprecated-calls-exclude
564564

565-
This flag allows to selectively disable :ref:`deprecated<code-deprecated>` warnings
565+
This flag allows one to selectively disable :ref:`deprecated<code-deprecated>` warnings
566566
for functions and methods defined in specific packages, modules, or classes.
567567
Note that each exclude entry acts as a prefix. For example (assuming ``foo.A.func`` is deprecated):
568568

docs/source/error_code_list.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,8 +1032,8 @@ Warn about top level await expressions [top-level-await]
10321032
This error code is separate from the general ``[syntax]`` errors, because in
10331033
some environments (e.g. IPython) a top level ``await`` is allowed. In such
10341034
environments a user may want to use ``--disable-error-code=top-level-await``,
1035-
that allows to still have errors for other improper uses of ``await``, for
1036-
example:
1035+
which allows one to still have errors for other improper uses of ``await``,
1036+
for example:
10371037

10381038
.. code-block:: python
10391039

docs/source/mypy_daemon.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,16 +252,16 @@ command.
252252
Statically inspect expressions
253253
******************************
254254

255-
The daemon allows to get declared or inferred type of an expression (or other
255+
The daemon allows one to get the declared or inferred type of an expression (or other
256256
information about an expression, such as known attributes or definition location)
257-
using ``dmypy inspect LOCATION`` command. The location of the expression should be
257+
using the ``dmypy inspect LOCATION`` command. The location of the expression should be
258258
specified in the format ``path/to/file.py:line:column[:end_line:end_column]``.
259259
Both line and column are 1-based. Both start and end position are inclusive.
260260
These rules match how mypy prints the error location in error messages.
261261

262262
If a span is given (i.e. all 4 numbers), then only an exactly matching expression
263263
is inspected. If only a position is given (i.e. 2 numbers, line and column), mypy
264-
will inspect all *expressions*, that include this position, starting from the
264+
will inspect all expressions that include this position, starting from the
265265
innermost one.
266266

267267
Consider this Python code snippet:

mypy/traverser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ class ExtendedTraverserVisitor(TraverserVisitor):
504504
In addition to the base traverser it:
505505
* has visit_ methods for leaf nodes
506506
* has common method that is called for all nodes
507-
* allows to skip recursing into a node
507+
* allows skipping recursing into a node
508508
509509
Note that this traverser still doesn't visit some internal
510510
mypy constructs like _promote expression and Var.

mypy/type_visitor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
get_proper_type,
5252
)
5353

54-
T = TypeVar("T")
54+
T = TypeVar("T", covariant=True)
5555

5656

5757
@trait

mypy/types.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3938,8 +3938,12 @@ def visit_type_alias_type(self, t: TypeAliasType, /) -> list[mypy.nodes.TypeAlia
39383938
assert t.alias is not None
39393939
if t.alias not in self.seen_alias_nodes:
39403940
self.seen_alias_nodes.add(t.alias)
3941-
return [t.alias] + t.alias.target.accept(self)
3942-
return []
3941+
res = [t.alias] + t.alias.target.accept(self)
3942+
else:
3943+
res = []
3944+
for arg in t.args:
3945+
res.extend(arg.accept(self))
3946+
return res
39433947

39443948

39453949
def is_named_instance(t: Type, fullnames: str | tuple[str, ...]) -> TypeGuard[Instance]:

test-data/unit/check-recursive-types.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,3 +1014,12 @@ from bogus import Foo # type: ignore
10141014

10151015
A = Callable[[Foo, "B"], Foo] # E: Type alias target becomes "Callable[[Any, B], Any]" due to an unfollowed import
10161016
B = Callable[[Foo, A], Foo] # E: Type alias target becomes "Callable[[Any, A], Any]" due to an unfollowed import
1017+
1018+
[case testRecursiveAliasOnArgumentDetected]
1019+
from typing import TypeVar
1020+
1021+
T = TypeVar("T")
1022+
L = list[T]
1023+
1024+
A = L[A]
1025+
a: A = 1 # E: Incompatible types in assignment (expression has type "int", variable has type "A")

0 commit comments

Comments
 (0)