ruff/crates/red_knot_python_semantic/resources/mdtest/diagnostics
Brent Westbrook 92ecfc908b
[syntax-errors] Make async-comprehension-in-sync-comprehension more specific (#17460)
## Summary

While adding semantic error support to red-knot, I noticed duplicate
diagnostics for code like this:

```py
# error: [invalid-syntax] "cannot use an asynchronous comprehension outside of an asynchronous function on Python 3.9 (syntax was added in 3.11)"
# error: [invalid-syntax] "`asynchronous comprehension` outside of an asynchronous function"
 [reveal_type(x) async for x in AsyncIterable()]
```

Beyond the duplication, the first error message doesn't make much sense
because this syntax is _not_ allowed on Python 3.11 either.

To fix this, this PR renames the
`async-comprehension-outside-async-function` semantic syntax error to
`async-comprehension-in-sync-comprehension` and fixes the rule to avoid
applying outside of sync comprehensions at all.

## Test Plan

New linter test demonstrating the false positive. The mdtests from my red-knot 
PR also reflect this change.
2025-04-24 15:45:54 -04:00
..
attribute_assignment.md [red-knot] Document current state of attribute assignment diagnostics (#16746) 2025-03-14 20:34:43 +01:00
invalid_argument_type.md [red-knot] Better diagnostics for method calls (#16362) 2025-02-25 09:58:08 +01:00
no_matching_overload.md [red-knot] Support multiple overloads when binding parameters at call sites (#16568) 2025-03-11 15:08:17 -04:00
semantic_syntax_errors.md [syntax-errors] Make async-comprehension-in-sync-comprehension more specific (#17460) 2025-04-24 15:45:54 -04:00
shadowing.md red_knot_python_semantic: migrate INVALID_ASSIGNMENT for shadowing 2025-04-22 12:08:03 -04:00
unpacking.md red_knot_python_semantic: add invalid assignment diagnostic snapshot 2025-04-22 12:08:03 -04:00
unresolved_import.md [red-knot] fix unresolvable import range (#15976) 2025-02-05 14:01:58 -05:00
unsupported_bool_conversion.md red_knot_python_semantic: avoid Rust's screaming snake case convention in mdtest 2025-04-24 11:43:01 -04:00
version_related_syntax_errors.md [red-knot] Detect version-related syntax errors (#16379) 2025-04-17 14:00:30 -04:00