@@ -334,7 +334,7 @@ def f(**kwargs: 'A') -> None: pass
334334b: Mapping
335335d: Mapping[A, A]
336336m: Mapping[str, A]
337- f(**d) # E: Keywords must be strings
337+ f(**d) # E: Argument after ** must have string keys
338338f(**m)
339339f(**b)
340340class A: pass
@@ -354,7 +354,7 @@ from typing import Dict, Any, Optional
354354class A: pass
355355def f(**kwargs: 'A') -> None: pass
356356d = {} # type: Dict[A, A]
357- f(**d) # E: Keywords must be strings
357+ f(**d) # E: Argument after ** must have string keys
358358f(**A()) # E: Argument after ** must be a mapping, not "A"
359359kwargs: Optional[Any]
360360f(**kwargs) # E: Argument after ** must be a mapping, not "Any | None"
@@ -452,7 +452,7 @@ f(b) # E: Argument 1 to "f" has incompatible type "dict[str, str]"; expected "in
452452f(**b) # E: Argument 1 to "f" has incompatible type "**dict[str, str]"; expected "int"
453453
454454c = {0: 0}
455- f(**c) # E: Keywords must be strings
455+ f(**c) # E: Argument after ** must have string keys
456456[builtins fixtures/dict.pyi]
457457
458458[case testCallStar2WithStar]
@@ -570,3 +570,13 @@ main:38: error: Argument after ** must be a mapping, not "C[str, float]"
570570main:39: error: Argument after ** must be a mapping, not "D"
571571main:41: error: Argument 1 to "foo" has incompatible type "**dict[str, str]"; expected "float"
572572[builtins fixtures/dict.pyi]
573+
574+ [case testLiteralKwargs]
575+ from typing import Any, Literal
576+ kw: dict[Literal["a", "b"], Any]
577+ def func(a, b): ...
578+ func(**kw)
579+
580+ badkw: dict[Literal["one", 1], Any]
581+ func(**badkw) # E: Argument after ** must have string keys
582+ [builtins fixtures/dict.pyi]
0 commit comments