Repository navigation
Typed GenExpr fields - #1281
Open
Zeroto521 wants to merge 5 commits into
Open
Typed GenExpr fields#1281Zeroto521 wants to merge 5 commits into
GenExpr fields#1281Zeroto521 wants to merge 5 commits into
Conversation
Store GenExpr.children as a C list and the numeric expression fields (Constant.number, SumExpr.constant, ProdExpr.constant, PowExpr.expo) as C doubles. Update the stub return types accordingly and note the conversion-on-construction in the changelog.
PowExpr.expo is now stored as a double, so the exponent is rendered as e.g. -1.0 instead of -1.
Zeroto521
commented
Oct 28, 2026
Zeroto521
commented
Oct 28, 2026
| class Constant(GenExpr): | ||
| @property | ||
| def number(self) -> SupportsFloat: ... | ||
| def number(self) -> float: ... |
Contributor
Author
There was a problem hiding this comment.
numebr is float now, not like float. SupportsFloat uses the __float__ protocol.
Zeroto521
marked this pull request as ready for review
October 28, 2026 15:18
Contributor
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Member
|
Hey @Zeroto521 , are there no more changes of this type that you have planned? If there are, please apply them all here. |
The concrete Cython field types make Decimal operands work at runtime, so the generator now emits additional assert_type checks that mypy reports.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Expression fields (
Constant.number,SumExpr.constant,ProdExpr.constant,PowExpr.expo,GenExpr.children) were untyped Python attributes that were only convertedto C types when used. This PR gives them concrete Cython types (
double/list), so valuesare converted once on assignment; the stubs now return
floatfor the numeric fields.