@@ -30,13 +30,6 @@ use std::path::Path;
30
30
31
31
use itertools:: Itertools ;
32
32
use log:: debug;
33
- use ruff_python_ast:: {
34
- self as ast, AnyParameterRef , Comprehension , ElifElseClause , ExceptHandler , Expr , ExprContext ,
35
- FStringElement , Keyword , MatchCase , ModModule , Parameter , Parameters , Pattern , Stmt , Suite ,
36
- UnaryOp ,
37
- } ;
38
- use ruff_python_parser:: Parsed ;
39
- use ruff_text_size:: { Ranged , TextRange , TextSize } ;
40
33
41
34
use ruff_diagnostics:: { Diagnostic , IsolationLevel } ;
42
35
use ruff_notebook:: { CellOffsets , NotebookIndex } ;
@@ -47,10 +40,16 @@ use ruff_python_ast::identifier::Identifier;
47
40
use ruff_python_ast:: name:: QualifiedName ;
48
41
use ruff_python_ast:: str:: Quote ;
49
42
use ruff_python_ast:: visitor:: { walk_except_handler, walk_pattern, Visitor } ;
43
+ use ruff_python_ast:: {
44
+ self as ast, AnyParameterRef , Comprehension , ElifElseClause , ExceptHandler , Expr , ExprContext ,
45
+ FStringElement , Keyword , MatchCase , ModExpression , ModModule , Parameter , Parameters , Pattern ,
46
+ Stmt , Suite , UnaryOp ,
47
+ } ;
50
48
use ruff_python_ast:: { helpers, str, visitor, PySourceType } ;
51
49
use ruff_python_codegen:: { Generator , Stylist } ;
52
50
use ruff_python_index:: Indexer ;
53
51
use ruff_python_parser:: typing:: { parse_type_annotation, AnnotationKind } ;
52
+ use ruff_python_parser:: Parsed ;
54
53
use ruff_python_semantic:: all:: { DunderAllDefinition , DunderAllFlags } ;
55
54
use ruff_python_semantic:: analyze:: { imports, typing} ;
56
55
use ruff_python_semantic:: {
@@ -60,6 +59,7 @@ use ruff_python_semantic::{
60
59
} ;
61
60
use ruff_python_stdlib:: builtins:: { IPYTHON_BUILTINS , MAGIC_GLOBALS , PYTHON_BUILTINS } ;
62
61
use ruff_source_file:: { Locator , OneIndexed , SourceRow } ;
62
+ use ruff_text_size:: { Ranged , TextRange , TextSize } ;
63
63
64
64
use crate :: checkers:: ast:: annotation:: AnnotationContext ;
65
65
use crate :: docstrings:: extraction:: ExtractionTarget ;
@@ -2148,7 +2148,10 @@ impl<'a> Checker<'a> {
2148
2148
///
2149
2149
/// class Bar: pass
2150
2150
/// ```
2151
- fn visit_deferred_string_type_definitions ( & mut self , allocator : & ' a typed_arena:: Arena < Expr > ) {
2151
+ fn visit_deferred_string_type_definitions (
2152
+ & mut self ,
2153
+ allocator : & ' a typed_arena:: Arena < Parsed < ModExpression > > ,
2154
+ ) {
2152
2155
let snapshot = self . semantic . snapshot ( ) ;
2153
2156
while !self . visit . string_type_definitions . is_empty ( ) {
2154
2157
let type_definitions = std:: mem:: take ( & mut self . visit . string_type_definitions ) ;
@@ -2183,7 +2186,7 @@ impl<'a> Checker<'a> {
2183
2186
2184
2187
self . semantic . flags |=
2185
2188
SemanticModelFlags :: TYPE_DEFINITION | type_definition_flag;
2186
- self . visit_expr ( parsed_annotation) ;
2189
+ self . visit_expr ( parsed_annotation. expr ( ) ) ;
2187
2190
} else {
2188
2191
if self . enabled ( Rule :: ForwardAnnotationSyntaxError ) {
2189
2192
self . diagnostics . push ( Diagnostic :: new (
@@ -2258,7 +2261,7 @@ impl<'a> Checker<'a> {
2258
2261
/// After initial traversal of the source tree has been completed,
2259
2262
/// recursively visit all AST nodes that were deferred on the first pass.
2260
2263
/// This includes lambdas, functions, type parameters, and type annotations.
2261
- fn visit_deferred ( & mut self , allocator : & ' a typed_arena:: Arena < Expr > ) {
2264
+ fn visit_deferred ( & mut self , allocator : & ' a typed_arena:: Arena < Parsed < ModExpression > > ) {
2262
2265
while !self . visit . is_empty ( ) {
2263
2266
self . visit_deferred_class_bases ( ) ;
2264
2267
self . visit_deferred_functions ( ) ;
0 commit comments