swift - Int extension not applied to raw negative values -
My extensions of type int for raw, negative values do not work I I can work, but failure is a type of condemnation problem. Why is it not working as expected?
For the first time, I had to face it within the application development environment, but I have built a simple way here on the playground. I'm using the latest version of Xcode; Version 6.2 (6C107a).
This is because the code implemented on - integer 2 is interpreted as zero operator, and Not in the form of part of numerical literal -2
To prove this, just try this:
- (1.foo ()) which is the same Error generates error
member 'foo'
The message is possibly misleading because the return of the foo method about the error Trying to apply operator to zero in value.
I do not know whether it is deliberate behavior or not, but how does it work :)
Comments
Post a Comment