@@ -86,6 +86,57 @@ def f(a: 'A') -> None: pass # N: "f" defined here
8686f(b=object()) # E: Unexpected keyword argument "b" for "f"
8787class A: pass
8888
89+ [case testKeywordMisspelling]
90+ def f(other: 'A') -> None: pass # N: "f" defined here
91+ f(otter=A()) # E: Unexpected keyword argument "otter" for "f"; did you mean "other"?
92+ class A: pass
93+
94+ [case testMultipleKeywordsForMisspelling]
95+ def f(thing : 'A', other: 'A', atter: 'A', btter: 'B') -> None: pass # N: "f" defined here
96+ f(otter=A()) # E: Unexpected keyword argument "otter" for "f"; did you mean "other" or "atter"?
97+ class A: pass
98+ class B: pass
99+
100+ [case testKeywordMisspellingDifferentType]
101+ def f(other: 'A') -> None: pass # N: "f" defined here
102+ f(otter=B()) # E: Unexpected keyword argument "otter" for "f"; did you mean "other"?
103+ class A: pass
104+ class B: pass
105+
106+ [case testKeywordMisspellingInheritance]
107+ def f(atter: 'A', btter: 'B', ctter: 'C') -> None: pass # N: "f" defined here
108+ f(otter=B()) # E: Unexpected keyword argument "otter" for "f"; did you mean "btter" or "atter"?
109+ class A: pass
110+ class B(A): pass
111+ class C: pass
112+
113+ [case testKeywordMisspellingFloatInt]
114+ def f(atter: float, btter: int) -> None: pass # N: "f" defined here
115+ x: int = 5
116+ f(otter=x) # E: Unexpected keyword argument "otter" for "f"; did you mean "btter" or "atter"?
117+
118+ [case testKeywordMisspellingVarArgs]
119+ def f(other: 'A', *atter: 'A') -> None: pass # N: "f" defined here
120+ f(otter=A()) # E: Unexpected keyword argument "otter" for "f"; did you mean "other"?
121+ class A: pass
122+
123+ [case testKeywordMisspellingOnlyVarArgs]
124+ def f(*other: 'A') -> None: pass # N: "f" defined here
125+ f(otter=A()) # E: Unexpected keyword argument "otter" for "f"
126+ class A: pass
127+
128+ [case testKeywordMisspellingVarArgsDifferentTypes]
129+ def f(other: 'B', *atter: 'A') -> None: pass # N: "f" defined here
130+ f(otter=A()) # E: Unexpected keyword argument "otter" for "f"; did you mean "other"?
131+ class A: pass
132+ class B: pass
133+
134+ [case testKeywordMisspellingVarKwargs]
135+ def f(other: 'A', **atter: 'A') -> None: pass
136+ f(otter=A()) # E: Missing positional argument "other" in call to "f"
137+ class A: pass
138+ [builtins fixtures/dict.pyi]
139+
89140[case testKeywordArgumentsWithDynamicallyTypedCallable]
90141from typing import Any
91142f = None # type: Any
0 commit comments