ruff/crates
Charlie Marsh a62c735f9e
Lazily evaluate all PEP 695 type alias values (#8033)
<!--
Thank you for contributing to Ruff! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

In https://github.com/astral-sh/ruff/pull/7968, I introduced a
regression whereby we started to treat imports used _only_ in type
annotation bounds (with `__future__` annotations) as unused.

The root of the issue is that I started using `visit_annotation` for
these bounds. So we'd queue up the bound in the list of deferred type
parameters, then when visiting, we'd further queue it up in the list of
deferred type annotations... Which we'd then never visit, since deferred
type annotations are visited _before_ deferred type parameters.

Anyway, the better solution here is to use a dedicated flag for these,
since they have slightly different behavior than type annotations.

I've also fixed what I _think_ is a bug whereby we previously failed to
resolve `Callable` in:

```python
type RecordCallback[R: Record] = Callable[[R], None]

from collections.abc import Callable
```

IIUC, the values in type aliases should be evaluated lazily, like type
parameters.

Closes https://github.com/astral-sh/ruff/issues/8017.

## Test Plan

`cargo test`
2023-10-17 21:50:26 -04:00
..
flake8_to_ruff Add [format|lint].exclude options (#8000) 2023-10-18 01:15:25 +00:00
ruff_benchmark Bump ureq from 2.7.1 to 2.8.0 (#7756) 2023-10-02 09:49:59 -04:00
ruff_cache Introduce FormatterSettings (#7545) 2023-09-21 08:01:24 +02:00
ruff_cli Add lint.preview (#8002) 2023-10-18 01:26:37 +00:00
ruff_dev Add [format|lint].exclude options (#8000) 2023-10-18 01:15:25 +00:00
ruff_diagnostics Add settings for promoting and demoting fixes (#7841) 2023-10-10 20:04:21 +00:00
ruff_formatter Bump tracing from 0.1.37 to 0.1.39 (#7978) 2023-10-17 07:46:53 +00:00
ruff_index
ruff_linter Lazily evaluate all PEP 695 type alias values (#8033) 2023-10-17 21:50:26 -04:00
ruff_macros Rename RuleGroup::Unspecified to Stable (#7991) 2023-10-16 14:53:27 -05:00
ruff_notebook Add cell field to JSON output format (#7664) 2023-10-13 01:06:02 +00:00
ruff_python_ast Move {AnyNodeRef, AstNode} to ruff_python_ast crate root (#8030) 2023-10-18 00:01:18 +00:00
ruff_python_codegen Add support for PEP 701 (#7376) 2023-09-29 02:55:39 +00:00
ruff_python_formatter Add [format|lint].exclude options (#8000) 2023-10-18 01:15:25 +00:00
ruff_python_index Add support for PEP 701 (#7376) 2023-09-29 02:55:39 +00:00
ruff_python_literal Implement our own small-integer optimization (#7584) 2023-09-25 15:13:21 +00:00
ruff_python_parser Disallow f-strings in match pattern literal (#7857) 2023-10-09 10:11:08 +00:00
ruff_python_resolver
ruff_python_semantic Lazily evaluate all PEP 695 type alias values (#8033) 2023-10-17 21:50:26 -04:00
ruff_python_stdlib Improvements to RUF015 (#7848) 2023-10-08 14:49:45 +00:00
ruff_python_trivia Extend pragma comment cases (#7687) 2023-09-28 18:55:19 +00:00
ruff_shrinking Add support for PEP 701 (#7376) 2023-09-29 02:55:39 +00:00
ruff_source_file Add cell field to JSON output format (#7664) 2023-10-13 01:06:02 +00:00
ruff_text_size Unify line size settings between ruff and the formatter (#6873) 2023-08-28 06:44:56 +00:00
ruff_wasm Add [format|lint].exclude options (#8000) 2023-10-18 01:15:25 +00:00
ruff_workspace Add lint.preview (#8002) 2023-10-18 01:26:37 +00:00