Commit 87f1588
Suppress misleading Foo[...] suggestion when annotation has keyword args
When a call expression with keyword arguments is used in a type
annotation (e.g., `Foo(arg=val)`), mypy previously suggested using
`Foo[...]` instead. However, `Foo[arg=val]` is a SyntaxError in
Python, making the suggestion misleading. This change suppresses the
bracket syntax suggestion when the call contains keyword arguments.
Fixes #16506
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>1 parent a7bdffd commit 87f1588
3 files changed
Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1957 | 1957 | | |
1958 | 1958 | | |
1959 | 1959 | | |
1960 | | - | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
1961 | 1963 | | |
1962 | 1964 | | |
1963 | 1965 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
125 | 130 | | |
126 | 131 | | |
127 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
210 | 222 | | |
211 | 223 | | |
212 | 224 | | |
| |||
0 commit comments