@@ -395,19 +395,20 @@ func explainInExpr(sb *strings.Builder, n *ast.InExpr, indent string, depth int)
395395 argCount += len (n .List )
396396 }
397397 } else {
398- // Check if all items are tuples
399- allTuples := true
398+ // Check if all items are string literals (large list case - no wrapper)
399+ allStringLiterals := true
400400 for _ , item := range n .List {
401- if lit , ok := item .(* ast.Literal ); ! ok || lit .Type != ast .LiteralTuple {
402- allTuples = false
401+ if lit , ok := item .(* ast.Literal ); ! ok || lit .Type != ast .LiteralString {
402+ allStringLiterals = false
403403 break
404404 }
405405 }
406- if allTuples {
407- // All tuples get wrapped in a single Function tuple
408- argCount ++
409- } else {
406+ if allStringLiterals {
407+ // Large string list - separate children
410408 argCount += len (n .List )
409+ } else {
410+ // Non-string items get wrapped in a single Function tuple
411+ argCount ++
411412 }
412413 }
413414 }
@@ -455,8 +456,26 @@ func explainInExpr(sb *strings.Builder, n *ast.InExpr, indent string, depth int)
455456 explainTupleInInList (sb , item .(* ast.Literal ), indent + " " , depth + 4 )
456457 }
457458 } else {
459+ // Check if all items are string literals (large list case)
460+ allStringLiterals := true
458461 for _ , item := range n .List {
459- Node (sb , item , depth + 2 )
462+ if lit , ok := item .(* ast.Literal ); ! ok || lit .Type != ast .LiteralString {
463+ allStringLiterals = false
464+ break
465+ }
466+ }
467+ if allStringLiterals {
468+ // Large string list - output as separate children (no tuple wrapper)
469+ for _ , item := range n .List {
470+ Node (sb , item , depth + 2 )
471+ }
472+ } else {
473+ // Wrap non-literal/non-tuple list items in Function tuple
474+ fmt .Fprintf (sb , "%s Function tuple (children %d)\n " , indent , 1 )
475+ fmt .Fprintf (sb , "%s ExpressionList (children %d)\n " , indent , len (n .List ))
476+ for _ , item := range n .List {
477+ Node (sb , item , depth + 4 )
478+ }
460479 }
461480 }
462481 }
@@ -548,18 +567,20 @@ func explainInExprWithAlias(sb *strings.Builder, n *ast.InExpr, alias string, in
548567 argCount += len (n .List )
549568 }
550569 } else {
551- // Check if all items are tuples
552- allTuples := true
570+ // Check if all items are string literals (large list case - no wrapper)
571+ allStringLiterals := true
553572 for _ , item := range n .List {
554- if lit , ok := item .(* ast.Literal ); ! ok || lit .Type != ast .LiteralTuple {
555- allTuples = false
573+ if lit , ok := item .(* ast.Literal ); ! ok || lit .Type != ast .LiteralString {
574+ allStringLiterals = false
556575 break
557576 }
558577 }
559- if allTuples {
560- argCount ++
561- } else {
578+ if allStringLiterals {
579+ // Large string list - separate children
562580 argCount += len (n .List )
581+ } else {
582+ // Non-string items get wrapped in a single Function tuple
583+ argCount ++
563584 }
564585 }
565586 }
@@ -600,8 +621,26 @@ func explainInExprWithAlias(sb *strings.Builder, n *ast.InExpr, alias string, in
600621 explainTupleInInList (sb , item .(* ast.Literal ), indent + " " , depth + 4 )
601622 }
602623 } else {
624+ // Check if all items are string literals (large list case)
625+ allStringLiterals := true
603626 for _ , item := range n .List {
604- Node (sb , item , depth + 2 )
627+ if lit , ok := item .(* ast.Literal ); ! ok || lit .Type != ast .LiteralString {
628+ allStringLiterals = false
629+ break
630+ }
631+ }
632+ if allStringLiterals {
633+ // Large string list - output as separate children (no tuple wrapper)
634+ for _ , item := range n .List {
635+ Node (sb , item , depth + 2 )
636+ }
637+ } else {
638+ // Wrap non-literal/non-tuple list items in Function tuple
639+ fmt .Fprintf (sb , "%s Function tuple (children %d)\n " , indent , 1 )
640+ fmt .Fprintf (sb , "%s ExpressionList (children %d)\n " , indent , len (n .List ))
641+ for _ , item := range n .List {
642+ Node (sb , item , depth + 4 )
643+ }
605644 }
606645 }
607646 }
0 commit comments