mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-20 04:29:47 +00:00
## Summary Infer the first argument `type` inside `Annotated[type, …]` as a type expression. This allows us to support stringified annotations inside `Annotated`. ## Ecosystem * The removed diagnostic on `prefect` shows that we now understand the `State.data` type annotation in `src/prefect/client/schemas/objects.py:230`, which uses a stringified annotation in `Annoated`. The other diagnostics are downstream changes that result from this, it seems to be a commonly used data type. * `artigraph` does something like `Annotated[cast(Any, field_info.annotation), *field_info.metadata]` which I'm not sure we need to allow? It's unfortunate since this is probably supported at runtime, but it seems reasonable that they need to add a `# type: ignore` for that. * `pydantic` uses something like `Annotated[(self.annotation, *self.metadata)]` but adds a `# type: ignore` ## Test Plan New Markdown test |
||
|---|---|---|
| .. | ||
| annotated.md | ||
| any.md | ||
| callable.md | ||
| deferred.md | ||
| int_float_complex.md | ||
| invalid.md | ||
| literal.md | ||
| literal_string.md | ||
| never.md | ||
| new_types.md | ||
| optional.md | ||
| self.md | ||
| starred.md | ||
| stdlib_typing_aliases.md | ||
| string.md | ||
| union.md | ||
| unsupported_special_forms.md | ||
| unsupported_special_types.md | ||
| unsupported_type_qualifiers.md | ||