@@ -507,7 +507,20 @@ impl ReportArgs {
507507 _ => continue ,
508508 } ;
509509 match binding {
510- BindingExport :: AnnotatedForward ( annot_idx, _) => {
510+ BindingExport :: AnnotatedForward ( annot_idx, key_idx) => {
511+ // IMPLICIT: type aliases are type-level constructs with 0 slots.
512+ if matches ! (
513+ bindings. get( * key_idx) ,
514+ Binding :: TypeAlias ( _) | Binding :: TypeAliasRef ( _)
515+ ) {
516+ variables. push ( Variable {
517+ name : qualified_name,
518+ annotation : None ,
519+ slots : SlotCounts :: default ( ) ,
520+ location,
521+ } ) ;
522+ continue ;
523+ }
511524 let annotation_text = match bindings. get ( * annot_idx) {
512525 BindingAnnotation :: AnnotateExpr ( _, expr, _) => {
513526 Some ( module. code_at ( expr. range ( ) ) . to_owned ( ) )
@@ -531,8 +544,12 @@ impl ReportArgs {
531544 match bindings. get ( * idx) {
532545 // Skip injected implicit globals
533546 Binding :: Global ( _) => { }
534- // IMPLICIT: special type forms have 0 slots
535- Binding :: TypeVar ( _) | Binding :: ParamSpec ( _) | Binding :: TypeVarTuple ( _) => {
547+ // IMPLICIT: special type forms and type aliases have 0 slots
548+ Binding :: TypeVar ( _)
549+ | Binding :: ParamSpec ( _)
550+ | Binding :: TypeVarTuple ( _)
551+ | Binding :: TypeAlias ( _)
552+ | Binding :: TypeAliasRef ( _) => {
536553 variables. push ( Variable {
537554 name : qualified_name,
538555 annotation : None ,
@@ -2248,4 +2265,12 @@ mod tests {
22482265 let report = build_module_report_for_test ( "partial_any.py" ) ;
22492266 compare_snapshot ( "partial_any.expected.json" , & report) ;
22502267 }
2268+
2269+ /// Type aliases (explicit `TypeAlias`, bare assignments, PEP 695, TypeAliasType)
2270+ /// are type-level constructs and should have 0 typable slots.
2271+ #[ test]
2272+ fn test_report_type_aliases ( ) {
2273+ let report = build_module_report_for_test ( "type_aliases.py" ) ;
2274+ compare_snapshot ( "type_aliases.expected.json" , & report) ;
2275+ }
22512276}
0 commit comments