`@no_type_check` is not respected for string annotations
Author: InSyncWithFooCreated Jan 6, 2025Updated Sep 15, 2026
Labelsbug
For some reason, the logic implemented in #15215 failed to suppress this (playground):
import typing
@typing.no_type_check
def f(arg: "'A' or ''") -> None: ...
# ^ F821
According to println!(), when checking the nested expression, the semantic model is in neither NO_TYPE_CHECK nor STRING_TYPE_DEFINITION context.
Source: astral-sh/ruff