David Peter
c60e8a037a
[red-knot] Add support for calling type[…] (#16597)
## Summary
This fixes the non-diagnostics part of #15948.
## Test Plan
New Markdown tests.
Negative diff on the ecosystem checks:
```diff
zipp (https://github.com/jaraco/zipp)
- error: lint:call-non-callable
- --> /tmp/mypy_primer/projects/zipp/zipp/__init__.py:393:16
- |
- 392 | def _next(self, at):
- 393 | return self.__class__(self.root, at)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Object of type `type[Unknown]` is not callable
- 394 |
- 395 | def is_dir(self):
- |
-
- Found 9 diagnostics
+ Found 8 diagnostics
arrow (https://github.com/arrow-py/arrow)
+ |
+ |
+ warning: lint:unused-ignore-comment
+ --> /tmp/mypy_primer/projects/arrow/arrow/arrow.py:576:66
+ 574 | values.append(1)
+ 575 |
+ 576 | floor = self.__class__(*values, tzinfo=self.tzinfo) # type: ignore[misc]
+ | -------------------- Unused blanket `type: ignore` directive
+ 577 |
+ 578 | if frame_absolute == "week":
- error: lint:call-non-callable
- --> /tmp/mypy_primer/projects/arrow/arrow/arrow.py:1080:16
- |
- 1078 | dt = self._datetime.astimezone(tz)
- 1079 |
- 1080 | return self.__class__(
- | ________________^
- 1081 | | dt.year,
- 1082 | | dt.month,
- 1083 | | dt.day,
- 1084 | | dt.hour,
- 1085 | | dt.minute,
- 1086 | | dt.second,
- 1087 | | dt.microsecond,
- 1088 | | dt.tzinfo,
- 1089 | | fold=getattr(dt, "fold", 0),
- 1090 | | )
- | |_________^ Object of type `type[Unknown]` is not callable
- 1091 |
- 1092 | # string output and formatting
- |
black (https://github.com/psf/black)
-
- |
- |
- error: lint:call-non-callable
- --> /tmp/mypy_primer/projects/black/src/blib2to3/pgen2/grammar.py:135:15
- 133 | Copy the grammar.
- 134 | """
- 135 | new = self.__class__()
- | ^^^^^^^^^^^^^^^^ Object of type `type[@Todo]` is not callable
- 136 | for dict_attr in (
- 137 | "symbol2number",
- Found 328 diagnostics
+ Found 327 diagnostics
```
2025-03-10 13:24:13 +01:00
..
2025-03-08 03:58:52 +00:00
2025-03-07 22:03:28 +01:00
2025-03-07 22:03:28 +01:00
2024-12-21 11:33:10 +01:00
2025-02-04 08:27:17 +01:00
2025-03-10 13:24:13 +01:00
2025-02-25 20:38:15 +01:00
2025-02-19 10:22:30 -05:00
2025-02-21 19:26:05 +01:00
2024-12-17 09:49:39 +05:30
2025-02-25 09:58:08 +01:00
2025-02-03 09:27:29 +00:00
2025-02-12 08:52:11 +01:00
2025-02-20 12:25:55 +00:00
2025-02-24 15:17:16 +01:00
2024-12-06 12:55:56 -08:00
2025-03-07 22:03:28 +01:00
2025-03-06 10:41:40 +01:00
2025-01-16 11:21:56 -08:00
2025-03-06 15:59:19 +00:00
2025-02-21 21:05:48 +00:00
2025-02-04 08:27:17 +01:00
2025-03-07 22:03:28 +01:00
2025-02-05 22:26:15 +01:00
2025-02-25 20:38:15 +01:00
2025-03-07 22:03:28 +01:00
2025-03-07 22:03:28 +01:00
2025-03-07 22:03:28 +01:00
2025-02-20 23:22:26 +01:00
2025-03-09 12:30:32 +00:00
2025-02-25 20:00:38 +01:00
2025-02-21 19:26:05 +01:00
2025-03-08 02:36:35 +00:00
2024-10-31 21:00:51 +00:00
2025-03-09 12:30:32 +00:00
2025-03-09 12:30:32 +00:00
2024-12-19 21:02:14 +00:00
2025-02-03 09:27:29 +00:00
2025-03-08 03:58:52 +00:00
2025-03-04 19:49:34 +00:00
2025-02-03 09:27:29 +00:00
2025-02-04 08:27:17 +01:00
2025-03-09 12:30:32 +00:00
2025-02-04 08:27:17 +01:00
2025-01-20 09:55:54 +01:00
2025-02-20 23:22:26 +01:00
2025-02-24 09:55:34 +01:00
2025-02-06 07:15:26 +00:00
2025-02-20 23:22:26 +01:00
2025-02-05 22:26:15 +01:00
2025-02-05 17:47:49 -05:00
2025-02-21 19:26:05 +01:00
2025-02-14 12:24:10 -08:00
2025-03-08 02:36:35 +00:00