-
-
Notifications
You must be signed in to change notification settings - Fork 3k
feat: add ConditionalExpr support to constant_fold_expr
[2/2]
#19984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
This PR adds ConditionalExpr support to `constant_fold_expr`
constant_fold_expr
constant_fold_expr
[1/1]
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add an irbuild test and a run test?
Hmm that's weird, it looks like the constant for the base folded correctly, as did the 2 branch values, but not the overall expression
|
I mean... I guess it did constant fold all of the necessary values... And I think with the code like this the C compiler can optimize away the if check in some cases (ex: ints), but not all (ex: strings) |
This comment has been minimized.
This comment has been minimized.
Oh, I know why! Let's put this on hold until #19982 is merged, so I can use the |
constant_fold_expr
[1/1]constant_fold_expr
[2/2]
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
This PR adds ConditionalExpr support to
constant_fold_expr