-
Notifications
You must be signed in to change notification settings - Fork 71
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
Type guided '&' translation #683
base: pharo-12
Are you sure you want to change the base?
Conversation
| receiver result | | ||
|
||
receiver := 1000. | ||
result := receiver & false |
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.
What if the boolean is an argument?
methodWithAndIntegerReceiverAndBooleanArgument: arg [
| receiver result |
receiver := 1000.
result := receiver & arg
and all variantas :)
- boolean & boolean
- boolean & int
- int & boolean
- int & int
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 cases where both (arg and receiver) are boolean/int are covered with methodWithAndBooleanReceiver
and methodWithAndIntegerReceiver
. Maybe the name should reference the argument 😅
The other cases I considered them all the same test case (covered by this method), as they fall under the "if they are different types then throw an error" logic.
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.
Yes, but my point is that those tests are on literal booleans/integers!!!
What if the receiver are the result of a more complex expression, say a variable? Do we need a type annotation for booleans?
closes #663
Generates CAST for the
&
send node (checkCCodeGenerator >> generateCASTInferredAnd: aTSendNode
) depending on the type of the receiver and argument&&
&
A
TType
object was implemented to replace some types, yet most operations are still string-based 😢