-
-
Notifications
You must be signed in to change notification settings - Fork 73
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
feat: remainder operator #135
Conversation
Codecov Report
@@ Coverage Diff @@
## master #135 +/- ##
==========================================
+ Coverage 81.73% 81.92% +0.18%
==========================================
Files 141 141
Lines 9035 9055 +20
==========================================
+ Hits 7385 7418 +33
+ Misses 1650 1637 -13
Continue to review full report at Codecov.
|
Nice work! The PR looks good overall. I had one question, does the signed remainder do the same thing as Rust, e.g. |
I got a panic when I tried to test that 😬 |
Never mind, it works when I'm not trying to pass it into an |
Wait, no. It doesn't work when I use it in a |
Here's the script: pub fn main() {
let x = -2 % 5;
} It looks like the error starts here with the LHS' type being unknown. Maybe it has something to do with the unary minus operator? |
Yeah, it's probably the unary minus operator, as this same error happens with other operators, and it doesn't which side the negative number is on. |
Fixing that's outside the scope of this PR, though ¯\_(ツ)_/¯ (sorry for the wall of text 😅) |
I implemented unary operator IR generation anyways, but the type is still unknown for whatever reason. |
Anyways, this should be working. That unary op stuff doesn't have anything to do with this. |
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.
Nice work! I think you got them all. I only have one comment.
Maybe you can add a test like Wodann mentioned using this: pub fn main() {
let x = (0-2) % 5;
} Im missing a few tests to see if the output actually makes sense (I dont exactly know what LLVM does) |
Adds the remainder operators
%
and%=
. Please tell me if I missed anything. 🙂