Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
410c1c8
update typeddict kwarg forwarding test
yangdanny97 Aug 11, 2026
156623e
update spec wording and results to make erroring on implicitly open T…
yangdanny97 Aug 12, 2026
f09c47b
link to terms & handle implicitly open typeddicts the same as explici…
yangdanny97 Aug 13, 2026
4a3bbc6
address reviewer comments, revise spec and add a bunch of test cases
yangdanny97 Aug 13, 2026
b2453bb
modify notes
yangdanny97 Aug 13, 2026
722ec37
add additional conformance test cases
yangdanny97 Aug 15, 2026
cdb8426
change wording from may -> should, make error required
yangdanny97 Aug 28, 2026
5a1ff15
update notes
yangdanny97 Aug 28, 2026
2021073
update message
yangdanny97 Aug 29, 2026
3b7c926
add new test cases
yangdanny97 Aug 29, 2026
dd9df61
update spec wording
yangdanny97 Aug 29, 2026
b45c105
regenerate conformance results after rebase
yangdanny97 Nov 24, 2026
9025a12
add additional test cases and spec clarifications
yangdanny97 Nov 25, 2026
0eed5c3
merge sections
yangdanny97 Nov 25, 2026
cedf53f
update test and regenerate
yangdanny97 Nov 26, 2026
ff7b65e
make small edits
yangdanny97 Nov 26, 2026
1c3f1a2
fix more wording
yangdanny97 Nov 27, 2026
7e6b844
rewrite assignability rules
yangdanny97 Nov 27, 2026
33b8c88
arguments -> argument types
yangdanny97 Nov 28, 2026
57b3694
restore Unpacking a TypedDict as keyword argument types more concisely
yangdanny97 Nov 28, 2026
01e1de6
remove outdated spec text from tests, update links
yangdanny97 Nov 28, 2026
4beecbc
regenerate results
yangdanny97 Nov 28, 2026
49dd072
address nits
yangdanny97 Dec 1, 2026
8959c1d
add test case
yangdanny97 Dec 1, 2026
61ac3b9
fix nits
yangdanny97 Dec 1, 2026
aa327cf
reorder some sections
yangdanny97 Dec 2, 2026
3d993ac
clean up extra items section
yangdanny97 Dec 2, 2026
20447bc
add more tests
yangdanny97 Dec 2, 2026
b119ac2
better wording of notes
yangdanny97 Dec 2, 2026
1e0f152
add open-unpacking=error for pyrefly
yangdanny97 Dec 4, 2026
09b690f
address comments
yangdanny97 Dec 4, 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
107 changes: 87 additions & 20 deletions conformance/results/mypy/callables_kwargs.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,96 @@
conformant = "Partial"
notes = """
Comment thread
yangdanny97 marked this conversation as resolved.
Resolved
Allows callable without kwargs to be assigned to callable with unpacked kwargs.
Does not support the `extra_items` TypedDict class argument.
Does not reject unpacking an open TypedDict in a call to a callable that has no `**kwargs`.
Does not reject unpacking an open TypedDict in a call to a callable whose `**kwargs` is typed with a closed TypedDict.
Does not check the type of an unpacked TypedDict's extra items against the callee's `**kwargs` annotation.
Does not check the type of an unpacked TypedDict's extra items against the callee's named keyword parameters.
Does not reject unpacking a TypedDict that sets `extra_items` in a call to a callable that has no `**kwargs`.
Does not reject unpacking a TypedDict that sets `extra_items` in a call to a callable whose `**kwargs` is typed with a closed TypedDict.
When `Base` is open and `Child` adds a non-required `int` key, incorrectly allows a callable taking `**kwargs: Unpack[Child]` to stand in for one taking `**kwargs: Unpack[Base]` and rejects the reverse assignment.
Incorrectly rejects assigning a callable whose `**kwargs` is an unpacked open TypedDict to an equivalent callable with `**kwargs: object`.
Does not check an unpacked open TypedDict's extra items against non-required keys of the callee's `**kwargs: Unpack[...]` TypedDict.
Incorrectly rejects unpacking a TypedDict with an extra key when calling a function with `**kwargs` typed with an open TypedDict.
"""
output = """
callables_kwargs.py:46: error: Missing named argument "v1" for "func1" [call-arg]
callables_kwargs.py:46: error: Missing named argument "v3" for "func1" [call-arg]
callables_kwargs.py:51: error: Unexpected keyword argument "v4" for "func1" [call-arg]
callables_kwargs.py:52: error: Too many positional arguments for "func1" [call-arg]
callables_kwargs.py:58: error: Argument 1 to "func1" has incompatible type "**dict[str, str]"; expected "int" [arg-type]
callables_kwargs.py:61: error: Argument 1 to "func1" has incompatible type "**dict[str, object]"; expected "int" [arg-type]
callables_kwargs.py:61: error: Argument 1 to "func1" has incompatible type "**dict[str, object]"; expected "str" [arg-type]
callables_kwargs.py:63: error: "func1" gets multiple values for keyword argument "v1" [misc]
callables_kwargs.py:64: error: "func2" gets multiple values for keyword argument "v3" [misc]
callables_kwargs.py:64: error: Argument 1 to "func2" has incompatible type "int"; expected "str" [arg-type]
callables_kwargs.py:65: error: "func2" gets multiple values for keyword argument "v1" [misc]
callables_kwargs.py:101: error: Incompatible types in assignment (expression has type "def func1(**kwargs: **TD2) -> None", variable has type "TDProtocol3") [assignment]
callables_kwargs.py:101: note: "TDProtocol3.__call__" has type "def __call__(self, *, v1: int, v2: int, v3: str) -> None"
callables_kwargs.py:102: error: Incompatible types in assignment (expression has type "def func1(**kwargs: **TD2) -> None", variable has type "TDProtocol4") [assignment]
callables_kwargs.py:102: note: "TDProtocol4.__call__" has type "def __call__(self, *, v1: int) -> None"
callables_kwargs.py:103: error: Incompatible types in assignment (expression has type "def func1(**kwargs: **TD2) -> None", variable has type "TDProtocol5") [assignment]
callables_kwargs.py:103: note: "TDProtocol5.__call__" has type "def __call__(self, v1: int, v3: str) -> None"
callables_kwargs.py:111: error: Overlap between parameter names and ** TypedDict items: "v1" [misc]
callables_kwargs.py:122: error: Unpack item in ** parameter must be a TypedDict [misc]
callables_kwargs.py:27: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
callables_kwargs.py:55: error: Missing named argument "v1" for "func1" [call-arg]
callables_kwargs.py:55: error: Missing named argument "v3" for "func1" [call-arg]
callables_kwargs.py:60: error: Unexpected keyword argument "v4" for "func1" [call-arg]
callables_kwargs.py:61: error: Too many positional arguments for "func1" [call-arg]
callables_kwargs.py:67: error: Argument 1 to "func1" has incompatible type "**dict[str, str]"; expected "int" [arg-type]
callables_kwargs.py:70: error: Argument 1 to "func1" has incompatible type "**dict[str, object]"; expected "int" [arg-type]
callables_kwargs.py:70: error: Argument 1 to "func1" has incompatible type "**dict[str, object]"; expected "str" [arg-type]
callables_kwargs.py:72: error: "func1" gets multiple values for keyword argument "v1" [misc]
callables_kwargs.py:73: error: "func2" gets multiple values for keyword argument "v3" [misc]
callables_kwargs.py:73: error: Argument 1 to "func2" has incompatible type "int"; expected "str" [arg-type]
callables_kwargs.py:74: error: "func2" gets multiple values for keyword argument "v1" [misc]
callables_kwargs.py:121: error: Incompatible types in assignment (expression has type "def func1(**kwargs: **TD2) -> None", variable has type "TDProtocol3") [assignment]
callables_kwargs.py:121: note: "TDProtocol3.__call__" has type "def __call__(self, *, v1: int, v2: int, v3: str) -> None"
callables_kwargs.py:122: error: Incompatible types in assignment (expression has type "def func1(**kwargs: **TD2) -> None", variable has type "TDProtocol4") [assignment]
callables_kwargs.py:122: note: "TDProtocol4.__call__" has type "def __call__(self, *, v1: int) -> None"
callables_kwargs.py:123: error: Incompatible types in assignment (expression has type "def func1(**kwargs: **TD2) -> None", variable has type "TDProtocol5") [assignment]
callables_kwargs.py:123: note: "TDProtocol5.__call__" has type "def __call__(self, v1: int, v3: str) -> None"
callables_kwargs.py:131: error: Overlap between parameter names and ** TypedDict items: "v1" [misc]
callables_kwargs.py:142: error: Unpack item in ** parameter must be a TypedDict [misc]
callables_kwargs.py:206: error: Incompatible types in assignment (expression has type "def func8(**kwargs: **TDBase) -> None", variable has type "TDProtocol10") [assignment]
callables_kwargs.py:206: note: "TDProtocol10.__call__" has type "def __call__(self, **kwargs: **TDChild) -> None"
callables_kwargs.py:216: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
callables_kwargs.py:265: error: Incompatible types in assignment (expression has type "def func8(**kwargs: **TDBase) -> None", variable has type "TDProtocol11") [assignment]
callables_kwargs.py:265: note: "TDProtocol11.__call__" has type "def __call__(self, *, x: int, **kwargs: object) -> None"
callables_kwargs.py:269: error: Incompatible types in assignment (expression has type "def func13(**kwargs: **TDExtraInt) -> None", variable has type "TDProtocol15") [assignment]
callables_kwargs.py:269: note: "TDProtocol15.__call__" has type "def __call__(self, *, x: int, **kwargs: int) -> None"
callables_kwargs.py:299: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
callables_kwargs.py:303: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
callables_kwargs.py:307: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
callables_kwargs.py:394: error: Unexpected keyword argument "year" for "takes_open" [call-arg]
callables_kwargs.py:395: error: Unexpected keyword argument "year" for "takes_closed" [call-arg]
callables_kwargs.py:396: error: Unexpected keyword argument "year" for "takes_extra_items_int" [call-arg]
callables_kwargs.py:397: error: Unexpected keyword argument "year" for "takes_extra_items_int" [call-arg]
callables_kwargs.py:401: error: Extra argument "y" from **args for "func8" [misc]
callables_kwargs.py:448: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]
"""
conformance_automated = "Fail"
errors_diff = """
Line 134: Expected 1 errors
Line 150: Expected 1 errors
Line 170: Expected 1 errors
Line 205: Expected 1 errors
Line 354: Expected 1 errors
Line 356: Expected 1 errors
Line 357: Expected 1 errors
Line 359: Expected 1 errors
Line 360: Expected 1 errors
Line 361: Expected 1 errors
Line 366: Expected 1 errors
Line 367: Expected 1 errors
Line 373: Expected 1 errors
Line 375: Expected 1 errors
Line 376: Expected 1 errors
Line 378: Expected 1 errors
Line 379: Expected 1 errors
Line 380: Expected 1 errors
Line 385: Expected 1 errors
Line 386: Expected 1 errors
Line 416: Expected 1 errors
Line 417: Expected 1 errors
Line 419: Expected 1 errors
Line 420: Expected 1 errors
Line 422: Expected 1 errors
Line 423: Expected 1 errors
Line 424: Expected 1 errors
Line 425: Expected 1 errors
Line 444: Expected 1 errors
Line 445: Expected 1 errors
Line 27: Unexpected errors ['callables_kwargs.py:27: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
Line 206: Unexpected errors ['callables_kwargs.py:206: error: Incompatible types in assignment (expression has type "def func8(**kwargs: **TDBase) -> None", variable has type "TDProtocol10") [assignment]']
Line 216: Unexpected errors ['callables_kwargs.py:216: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
Line 265: Unexpected errors ['callables_kwargs.py:265: error: Incompatible types in assignment (expression has type "def func8(**kwargs: **TDBase) -> None", variable has type "TDProtocol11") [assignment]']
Line 269: Unexpected errors ['callables_kwargs.py:269: error: Incompatible types in assignment (expression has type "def func13(**kwargs: **TDExtraInt) -> None", variable has type "TDProtocol15") [assignment]']
Line 299: Unexpected errors ['callables_kwargs.py:299: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
Line 303: Unexpected errors ['callables_kwargs.py:303: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
Line 307: Unexpected errors ['callables_kwargs.py:307: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
Line 396: Unexpected errors ['callables_kwargs.py:396: error: Unexpected keyword argument "year" for "takes_extra_items_int" [call-arg]']
Line 401: Unexpected errors ['callables_kwargs.py:401: error: Extra argument "y" from **args for "func8" [misc]']
Line 448: Unexpected errors ['callables_kwargs.py:448: error: Unexpected keyword argument "extra_items" for "__init_subclass__" of "TypedDict" [call-arg]']
"""
69 changes: 54 additions & 15 deletions conformance/results/pycroscope/callables_kwargs.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,58 @@
conformance_automated = "Pass"
conformant = "Partial"
notes = """
Does not reject unpacking an open TypedDict in a call to a callable that has no `**kwargs`.
Does not reject unpacking an open TypedDict in a call to a callable whose `**kwargs` is typed with a closed TypedDict.
Incorrectly rejects unpacking a TypedDict with an extra key when calling a function with `**kwargs` typed with an open TypedDict.
"""
conformance_automated = "Fail"
errors_diff = """
Line 354: Expected 1 errors
Line 357: Expected 1 errors
Line 360: Expected 1 errors
Line 361: Expected 1 errors
Line 373: Expected 1 errors
Line 376: Expected 1 errors
Line 379: Expected 1 errors
Line 380: Expected 1 errors
Line 401: Unexpected errors ["./callables_kwargs.py:401:4: In call to callables_kwargs.func8: Got an unexpected keyword argument 'y' [incompatible_call]"]
"""
output = """
./callables_kwargs.py:46:4: In call to callables_kwargs.func1: Missing required argument 'v1' [incompatible_call]
./callables_kwargs.py:51:4: In call to callables_kwargs.func1: Got an unexpected keyword argument 'v4' [incompatible_call]
./callables_kwargs.py:52:4: In call to callables_kwargs.func1: Missing required argument 'v1' [incompatible_call]
./callables_kwargs.py:58:4: Incompatible argument type for v1: expected int but got str [incompatible_argument]
./callables_kwargs.py:61:4: In call to callables_kwargs.func1: Got an unexpected keyword argument 'v4' [incompatible_call]
./callables_kwargs.py:63:4: Multiple values provided for argument 'v1' [incompatible_call]
./callables_kwargs.py:64:4: In call to callables_kwargs.func2: Parameter 'v3' provided as both a positional and a keyword argument [incompatible_call]
./callables_kwargs.py:65:4: Multiple values provided for argument 'v1' [incompatible_call]
./callables_kwargs.py:101:0: Incompatible assignment: expected callables_kwargs.TDProtocol3, got function 'callables_kwargs.func1' [incompatible_assignment]
./callables_kwargs.py:102:0: Incompatible assignment: expected callables_kwargs.TDProtocol4, got function 'callables_kwargs.func1' [incompatible_assignment]
./callables_kwargs.py:103:0: Incompatible assignment: expected callables_kwargs.TDProtocol5, got function 'callables_kwargs.func1' [incompatible_assignment]
./callables_kwargs.py:111:21: Parameter v1 overlaps with TypedDict key in **kwargs [invalid_annotation]
./callables_kwargs.py:122:12: Expected TypedDict type inside Unpack[] for **kwargs [invalid_annotation]
./callables_kwargs.py:134:0: Incompatible assignment: expected callables_kwargs.TDProtocol6, got function 'callables_kwargs.func7' [incompatible_assignment]
./callables_kwargs.py:55:4: In call to callables_kwargs.func1: Missing required argument 'v1' [incompatible_call]
./callables_kwargs.py:60:4: In call to callables_kwargs.func1: Got an unexpected keyword argument 'v4' [incompatible_call]
./callables_kwargs.py:61:4: In call to callables_kwargs.func1: Missing required argument 'v1' [incompatible_call]
./callables_kwargs.py:67:4: Incompatible argument type for v1: expected int but got str [incompatible_argument]
./callables_kwargs.py:70:4: In call to callables_kwargs.func1: Got an unexpected keyword argument 'v4' [incompatible_call]
./callables_kwargs.py:72:4: Multiple values provided for argument 'v1' [incompatible_call]
./callables_kwargs.py:73:4: In call to callables_kwargs.func2: Parameter 'v3' provided as both a positional and a keyword argument [incompatible_call]
./callables_kwargs.py:74:4: Multiple values provided for argument 'v1' [incompatible_call]
./callables_kwargs.py:121:0: Incompatible assignment: expected callables_kwargs.TDProtocol3, got function 'callables_kwargs.func1' [incompatible_assignment]
./callables_kwargs.py:122:0: Incompatible assignment: expected callables_kwargs.TDProtocol4, got function 'callables_kwargs.func1' [incompatible_assignment]
./callables_kwargs.py:123:0: Incompatible assignment: expected callables_kwargs.TDProtocol5, got function 'callables_kwargs.func1' [incompatible_assignment]
./callables_kwargs.py:131:21: Parameter v1 overlaps with TypedDict key in **kwargs [invalid_annotation]
./callables_kwargs.py:142:12: Expected TypedDict type inside Unpack[] for **kwargs [invalid_annotation]
./callables_kwargs.py:150:0: Incompatible assignment: expected callables_kwargs.TDProtocol6, got function 'callables_kwargs.func7' [incompatible_assignment]
./callables_kwargs.py:170:4: Value of method incompatible with base class callables_kwargs.BaseUnpacked [incompatible_override]
./callables_kwargs.py:205:0: Incompatible assignment: expected callables_kwargs.TDProtocol9, got function 'callables_kwargs.func9' [incompatible_assignment]
./callables_kwargs.py:356:4: Incompatible argument type for kwargs: expected dict[str, str] but got <dict containing {**{str?: object}}> [incompatible_argument]
./callables_kwargs.py:359:4: Incompatible argument type for kwargs: expected dict[str, str] but got <dict containing {**{str?: object}}> [incompatible_argument]
./callables_kwargs.py:366:4: Incompatible argument type for kwargs: expected dict[str, int] but got <dict containing {**{str?: object}}> [incompatible_argument]
./callables_kwargs.py:367:4: Incompatible argument type for kwargs: expected dict[str, int] but got <dict containing {**{str?: object}}> [incompatible_argument]
./callables_kwargs.py:375:4: Incompatible argument type for kwargs: expected dict[str, str] but got <dict containing {**{str?: object}}> [incompatible_argument]
./callables_kwargs.py:378:4: Incompatible argument type for kwargs: expected dict[str, str] but got <dict containing {**{str?: object}}> [incompatible_argument]
./callables_kwargs.py:385:4: Incompatible argument type for kwargs: expected dict[str, int] but got <dict containing {**{str?: object}}> [incompatible_argument]
./callables_kwargs.py:386:4: Incompatible argument type for kwargs: expected dict[str, int] but got <dict containing {**{str?: object}}> [incompatible_argument]
./callables_kwargs.py:394:4: In call to callables_kwargs.takes_open: Got an unexpected keyword argument 'year' [incompatible_call]
./callables_kwargs.py:395:4: In call to callables_kwargs.takes_closed: Got an unexpected keyword argument 'year' [incompatible_call]
./callables_kwargs.py:397:4: Incompatible argument type for kwargs: expected dict[str, int] but got <dict containing {Literal['year']: Literal['']}> [incompatible_argument]
./callables_kwargs.py:401:4: In call to callables_kwargs.func8: Got an unexpected keyword argument 'y' [incompatible_call]
./callables_kwargs.py:416:4: In call to callables_kwargs.takes_name: **kwargs provided but not used [incompatible_call]
./callables_kwargs.py:417:4: Incompatible argument type for kwargs: expected dict[str, str] but got <dict containing {**{str: int}}> [incompatible_argument]
./callables_kwargs.py:419:4: In call to callables_kwargs.takes_name: **kwargs provided but not used [incompatible_call]
./callables_kwargs.py:420:4: Incompatible argument type for kwargs: expected dict[str, str] but got <dict containing {**{str: int}}> [incompatible_argument]
./callables_kwargs.py:422:4: In call to callables_kwargs.takes_closed: **kwargs provided but not used [incompatible_call]
./callables_kwargs.py:423:4: In call to callables_kwargs.takes_closed: **kwargs provided but not used [incompatible_call]
./callables_kwargs.py:424:4: Incompatible argument type for label: expected str but got int [incompatible_argument]
./callables_kwargs.py:425:4: Incompatible argument type for label: expected str but got int [incompatible_argument]
./callables_kwargs.py:444:4: Incompatible argument type for y: expected int but got object [incompatible_argument]
./callables_kwargs.py:445:4: Incompatible argument type for y: expected int but got object [incompatible_argument]
"""
Loading