-
Notifications
You must be signed in to change notification settings - Fork 423
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
Dyno: Default initializers for classes that inherit #26028
Merged
Merged
Conversation
This file contains 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
This commit replaces the current signature-based implementation for default initializers with uAST for a Function. This Function's body contains the suitable statements to initialize each field, as well as a "super.init" call if applicable. This code currently lacks suitable init-expressions for default-initializable formals, which is left as future work. An UntypedFnSignature is built manually so that we can force resolution to accept non-existent default values for each formal, regardless of whether it has an init-expression or not. The resulting TypedFnSignature is created with `typedSignatureInitial`. This might be overkill, but it keeps the code cleaner for the time being. Signed-off-by: Ben Harshbarger <[email protected]>
Signed-off-by: Ben Harshbarger <[email protected]>
Signed-off-by: Ben Harshbarger <[email protected]>
Signed-off-by: Ben Harshbarger <[email protected]>
Now that default initializers have actual bodies, the frontend is attempting to resolve various assignment operators only defined in the internal/standard modules. This commit updates the frontend to generate assignment operators for primitive types, tuples, and classes when the standard library is not available. Signed-off-by: Ben Harshbarger <[email protected]>
Signed-off-by: Ben Harshbarger <[email protected]>
Signed-off-by: Ben Harshbarger <[email protected]>
Signed-off-by: Ben Harshbarger <[email protected]>
…based Signed-off-by: Ben Harshbarger <[email protected]>
Signed-off-by: Ben Harshbarger <[email protected]>
Signed-off-by: Ben Harshbarger <[email protected]>
Signed-off-by: Ben Harshbarger <[email protected]>
Note for reviewer: this might be easier to review commit-by-commit |
mppf
approved these changes
Oct 2, 2024
Signed-off-by: Ben Harshbarger <[email protected]>
Nice! |
2 tasks
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.
This PR changes the frontend to start generating uAST for default initializers, which allows us to support default initializers on classes that inherit.
This PR replaces the current signature-based implementation for default initializers with uAST for a Function. This Function's body contains the suitable statements to initialize each field, as well as a "super.init" call if applicable. This code currently lacks suitable init-expressions for default-initializable formals, which is left as future work.
An UntypedFnSignature is built manually so that we can force resolution to accept non-existent default values for each formal, regardless of whether it has an init-expression or not.
The resulting TypedFnSignature is created with
typedSignatureInitial
. This might be overkill, but it keeps the code cleaner for the time being.Now that default initializers have actual bodies, the frontend is attempting to resolve various assignment operators only defined in the internal/standard modules. This was initially a problem for the dedicated frontend tests, which do not generally load the internal modules in which basic assignment operators are implemented. This PR updates the frontend to generate assignment operators for primitive types, tuples, and classes when the standard library is not available.
Testing: