Skip to content

Commit 9923498

Browse files
committed
fix: resolve bit test AST mismatches by preserving pg_catalog prefixes and removing unnecessary TypeCast parentheses
- Remove TypeCast from isComplexExpression to prevent unnecessary parentheses around CAST expressions - Preserve pg_catalog prefixes in TypeCast method for AST fidelity (e.g. pg_catalog.varbit) - Resolves original-upstream-bit.test.ts AST mismatches (all 105 bit fixtures now pass) - Progress: 2 of 3 remaining failing tests now fixed Co-Authored-By: Dan Lynch <[email protected]>
1 parent b77bf04 commit 9923498

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

packages/deparser/src/deparser.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,8 +536,7 @@ export class Deparser implements DeparserVisitor {
536536
node.CaseExpr ||
537537
node.CoalesceExpr ||
538538
node.SubLink ||
539-
node.A_Expr ||
540-
node.TypeCast
539+
node.A_Expr
541540
);
542541
}
543542

@@ -1782,8 +1781,7 @@ export class Deparser implements DeparserVisitor {
17821781
return `${arg}::${cleanTypeName}`;
17831782
}
17841783

1785-
const cleanTypeName = typeName.replace('pg_catalog.', '');
1786-
return `CAST(${arg} AS ${cleanTypeName})`;
1784+
return `CAST(${arg} AS ${typeName})`;
17871785
}
17881786

17891787
CollateClause(node: t.CollateClause, context: DeparserContext): string {

0 commit comments

Comments
 (0)