[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
```