-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Support shift operators for variables #527
Changes from 1 commit
98e737d
b14976d
dfad184
1998ec8
5e6b625
d39df5b
f53225a
c97ca4b
44970a9
6cd41b8
d132252
4efdbf7
3fd8d13
f7ee2e4
4fc9a1a
8011274
1f85c7f
e1fbdf1
30dafec
63c90fd
f52b626
ccbdff0
5f318cd
9b20fce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -348,7 348,7 @@ TypePointer IntegerType::binaryOperatorResult(Token::Value _operator, TypePointe | |
if (Token::isCompareOp(_operator)) | ||
return commonType; | ||
if (Token::isShiftOp(_operator) && !isAddress()) // && !_other->isAddress()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chriseth Should we check here for the other side to be an address? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you have to do this whole thing even before line 342. The following should be possible (please add a test):
Yes, we should perform some more checks for the other side. I would say rational number is fine as long as it is an integer. Fixed point is fine, but we have to perform an integer check at run-time. Integer is fine as long as it is not an address. |
||
return commonType; | ||
return shared_from_this(); | ||
if (Token::isBooleanOp(_operator)) | ||
return TypePointer(); | ||
if (auto intType = dynamic_pointer_cast<IntegerType const>(commonType)) | ||
|
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.
As @pirapira suggested further below, this should not return the common type of the operands but rather the type of the left operand.