Skip to content
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

Codegen: allow full annotation of classes #17530

Merged
merged 2 commits into from
Sep 20, 2024
Merged

Conversation

redsun82
Copy link
Contributor

@redsun82 redsun82 commented Sep 20, 2024

This allows to fully reannotate classes with the @annotate decoration. Properties can be modified by adding property modifiers to the special _ placeholder. Property modifiers can also be undone with ~. See unit tests for example (defs namespacing is only used in tests).

@redsun82 redsun82 requested a review from a team as a code owner September 20, 2024 04:57
@github-actions github-actions bot added the Rust Pull requests that update Rust code label Sep 20, 2024
Copy link
Contributor

@aibaars aibaars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really great, however, adding additional annotations to a class doesn't seem to work for me yet.

@@ -774,6 +775,63 @@ class _:
}


def test_annotate_fields():
@load
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding additional annotation to a class doesn't seem to work yet. I tried:

@annotate(LetExpr)
@rust.doc_test_signature("(maybe_some: Option<String>) -> ()")
class _:

but the tests still ends up with a () -> () signature.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, I initially forgot that, fixed now 🙂

Copy link
Contributor

@aibaars aibaars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thanks!

@aibaars aibaars merged commit 594045b into main Sep 20, 2024
22 checks passed
@aibaars aibaars deleted the redsun82/codegen-annotate branch September 20, 2024 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants