Skip to content

Conversation

BobTheBuidler
Copy link
Contributor

@BobTheBuidler BobTheBuidler commented Sep 26, 2025

Among other things, get_expr_length currently supports StrExpr, BytesExpr, and string-type Final values.

constant_fold_expr already has the code to parse values from all of these, so we can use it to deduplicate code in get_expr_length.

It's able to parse a few more Expressions than our existing implementation, not that any of these are particularly relevant at the moment, and allows get_expr_length to automatically benefit from more relevant future constant-folding enhancements.

This PR is ready for review. All of the get_expr_length PRs are entirely independent and can be reviewed/merged in any order.

BobTheBuidler and others added 2 commits September 25, 2025 23:49
get_expr_len currently support StrExpr, BytesExpr, and string-type Final values

constant_fold_expr already has the code to parse values from all of these, so we can deduplicate code by using it

It's able to parse a few more Expressions than our existing implementation, and allows get_expr_length to automatically benefit from future constant-folding enhancements
@BobTheBuidler BobTheBuidler changed the title [mypyc] feat: extend get_expr_len to try constant_fold_expr [mypyc] feat: extend get_expr_length to try constant_fold_expr Sep 26, 2025
@BobTheBuidler BobTheBuidler changed the title [mypyc] feat: extend get_expr_length to try constant_fold_expr [mypyc] feat: extend get_expr_length to try constant_fold_expr [review me next plz] Oct 1, 2025
@BobTheBuidler BobTheBuidler changed the title [mypyc] feat: extend get_expr_length to try constant_fold_expr [review me next plz] [mypyc] feat: extend get_expr_length to try constant_fold_expr [1/4] Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant