Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
91228b1
Some foundation
ilevkivskyi Mar 27, 2026
beeb100
Remove guard for overloads
ilevkivskyi Mar 27, 2026
6af211e
Mark some generated things as generated
ilevkivskyi Mar 27, 2026
eb41ad2
Write indirect dependencies separately
ilevkivskyi Mar 29, 2026
f3b4878
Fix fixing awaitable generator
ilevkivskyi Mar 29, 2026
025a25d
Check initializers as part of top levels
ilevkivskyi Mar 29, 2026
ed1cdc6
Do not double-process methods in nested classes
ilevkivskyi Mar 29, 2026
966020b
Simplify class checker scope
ilevkivskyi Mar 29, 2026
c30a0d2
Fix function redefinition
ilevkivskyi Mar 29, 2026
d2c6312
Make decorator inference in semanal consistent with checker
ilevkivskyi Mar 29, 2026
efd98b3
Skip/tweak some more tests
ilevkivskyi Mar 29, 2026
36f9d8f
Split remaining two tests
ilevkivskyi Mar 29, 2026
2e5f7d5
Cleanups/comments
ilevkivskyi Mar 31, 2026
59ea2a0
Some more comments and refactoring
ilevkivskyi Mar 31, 2026
0ddd940
Add a test for accidental discord.py fix
ilevkivskyi Apr 6, 2026
c79069b
Merge remote-tracking branch 'upstream/master' into intf-impl-parallel
ilevkivskyi Apr 6, 2026
1dd01db
Reset lambda argument types in empty context
ilevkivskyi Apr 10, 2026
47bcf75
Merge remote-tracking branch 'upstream/master' into intf-impl-parallel
ilevkivskyi Apr 10, 2026
106c8a6
Apply the blocker error fix
ilevkivskyi Apr 10, 2026
a068037
Another little optimization
ilevkivskyi Apr 11, 2026
19b2445
Get rid of intermediate ack; update docstring
ilevkivskyi Apr 12, 2026
cad8624
Merge remote-tracking branch 'upstream/master' into intf-impl-parallel
ilevkivskyi Apr 13, 2026
484d26d
Refactor stats to record all sends
ilevkivskyi Apr 13, 2026
ce41436
Merge remote-tracking branch 'upstream/master' into intf-impl-parallel
ilevkivskyi Apr 13, 2026
27d6bae
Some more CR
ilevkivskyi Apr 13, 2026
1bd047b
Some final touches
ilevkivskyi Apr 14, 2026
6aa0c6e
Merge remote-tracking branch 'upstream/master' into intf-impl-parallel
ilevkivskyi Apr 14, 2026
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
Prev Previous commit
Next Next commit
Make decorator inference in semanal consistent with checker
  • Loading branch information
ilevkivskyi committed Mar 29, 2026
commit d2c6312664523b388758b4b73fec42814107acfe
7 changes: 5 additions & 2 deletions mypy/semanal_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

from mypy.nodes import ARG_POS, CallExpr, Decorator, Expression, FuncDef, RefExpr, Var
from mypy.semanal_shared import SemanticAnalyzerInterface
from mypy.semanal_shared import SemanticAnalyzerInterface, set_callable_name
from mypy.typeops import function_type
from mypy.types import (
AnyType,
Expand Down Expand Up @@ -58,7 +58,8 @@ def infer_decorator_signature_if_simple(
if decorator_preserves_type:
# No non-identity decorators left. We can trivially infer the type
# of the function here.
dec.var.type = function_type(dec.func, analyzer.named_type("builtins.function"))
sig = function_type(dec.func, analyzer.named_type("builtins.function"))
dec.var.type = set_callable_name(sig, dec.func)
if dec.decorators:
return_type = calculate_return_type(dec.decorators[0])
if return_type and isinstance(return_type, AnyType):
Expand All @@ -72,6 +73,8 @@ def infer_decorator_signature_if_simple(
orig_sig = function_type(dec.func, analyzer.named_type("builtins.function"))
sig.name = orig_sig.items[0].name
dec.var.type = sig
if isinstance(sig, CallableType):
sig.definition = dec


def is_identity_signature(sig: Type) -> bool:
Expand Down
4 changes: 2 additions & 2 deletions test-data/unit/check-functions.test
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ class A:
[case testForwardReferenceToDynamicallyTypedStaticMethod]
def f(self) -> None:
A.x(1).y
A.x() # E: Missing positional argument "x" in call to "x"
A.x() # E: Missing positional argument "x" in call to "x" of "A"

class A:
@staticmethod
Expand All @@ -1144,7 +1144,7 @@ class A:
[case testForwardReferenceToDynamicallyTypedClassMethod]
def f(self) -> None:
A.x(1).y
A.x() # E: Missing positional argument "a" in call to "x"
A.x() # E: Missing positional argument "a" in call to "x" of "A"

class A:
@classmethod
Expand Down
25 changes: 24 additions & 1 deletion test-data/unit/check-protocols.test
Original file line number Diff line number Diff line change
Expand Up @@ -4558,7 +4558,30 @@ def bad() -> Proto:
# N: Expected: \
# N: def f(self) -> int \
# N: Got: \
# N: def f() -> str \
# N: def f(self) -> str \

class Impl:
@defer
def f(self) -> int: ...

[case testProtocolCheckDefersNode2]
from typing import Any, Callable, Protocol, TypeVar

class Proto(Protocol):
def f(self) -> int:
...

T = TypeVar("T")
def defer(f: Callable[[T], int]) -> Callable[[T], list[int]]:
...

def bad() -> Proto:
return Impl() # E: Incompatible return value type (got "Impl", expected "Proto") \
# N: Following member(s) of "Impl" have conflicts: \
# N: Expected: \
# N: def f(self) -> int \
# N: Got: \
# N: def f(self) -> list[int] \

class Impl:
@defer
Expand Down