-
Notifications
You must be signed in to change notification settings - Fork 10
feat: restrict uzumaki to variable declarations #80 #99
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: main
Are you sure you want to change the base?
feat: restrict uzumaki to variable declarations #80 #99
Conversation
|
@0xGeorgii can you review and aprove the workflows |
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.
Pull request overview
This PR restricts the Uzumaki (@) operator to only be valid within variable declaration statements, preventing its misuse in assignments, return statements, and general expressions.
Changes:
- Added
UzumakiMisuseerror variant to report invalid Uzumaki operator usage - Modified type checker to emit errors when
@appears outside variable declarations - Updated and added tests to validate the new restrictions
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| core/type-checker/src/errors.rs | Added new UzumakiMisuse error variant with appropriate error message and location tracking |
| core/type-checker/src/type_checker.rs | Replaced Uzumaki type inference logic in assignments, returns, and expressions with error reporting |
| tests/src/type_checker/type_checker.rs | Updated existing test and added three new negative test cases validating error reporting for misuse |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
core/type-checker/src/errors.rs
Outdated
| location: Location, | ||
| }, | ||
|
|
||
| #[error("{location}: `uzumaki` can only be used in variable declaration statements")] |
Copilot
AI
Jan 22, 2026
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.
The error message uses backticks around 'uzumaki' which may not render well in all contexts. Consider removing the backticks or using a more descriptive term like 'the uzumaki operator (@)' for clarity.
| #[error("{location}: `uzumaki` can only be used in variable declaration statements")] | |
| #[error("{location}: the uzumaki operator (@) can only be used in variable declaration statements")] |
| .err() | ||
| .unwrap() | ||
| .to_string() | ||
| .contains("uzumaki can only be used in variable declaration statements"), |
Copilot
AI
Jan 22, 2026
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.
The error message string is duplicated across three test cases (lines 1057, 1072, 1087). Consider extracting this as a constant to improve maintainability and ensure consistency if the message changes.
|
@KevinMB0220 Thanks for the contribution. I think that because this check is scope-bounded and not actually a And there is actually a placeholder function for invoking this new crate: https://github.com/Inferara/inference/blob/main/core/inference/src/lib.rs#L330 |
Ok I work to fix |
1 similar comment
Ok I work to fix |
|
@0xGeorgii can you review the issue? |
📌 Summary
Close #80
This PR introduces stricter validation for the Uzumaki (
@) operator within the type checker, ensuring it is only used in valid contexts and properly reported when misused.✨ Changes
Type Checker
UzumakiMisuseto clearly report invalid usage of the Uzumaki operator.@is used outside ofStatement::VariableDefinition.Tests
✅ Compliance
This PR fully complies with:
cargo fmt)uzumakican only be used in variable declaration statements #80🧪 Verification
All tests pass successfully, and the new validation logic behaves as expected for both valid and invalid Uzumaki usage.
Good
Bad