diff --git a/crates/ruff_linter/src/checkers/ast/mod.rs b/crates/ruff_linter/src/checkers/ast/mod.rs index fb163f8006..7b750536e9 100644 --- a/crates/ruff_linter/src/checkers/ast/mod.rs +++ b/crates/ruff_linter/src/checkers/ast/mod.rs @@ -437,7 +437,11 @@ impl<'a> Checker<'a> { } } - /// Returns the [`Tokens`] for the parsed source file + /// Returns the [`Tokens`] for the parsed source file. + /// + /// + /// Unlike [`Self::tokens`], this method always returns + /// the tokens for the current file, even when within a parsed type annotation. pub(crate) fn source_tokens(&self) -> &'a Tokens { self.parsed.tokens() }