`not` is parsed as an operator
chrisseaton opened this issue · comments
I think this is something which not should be changed. In 1.8 not is a keyword and in 1.9+ it is actually a method call. I could change it to be a notnode, but this will screw up type inference libraries like rsense who can actually look up !/not impl and better infer types. no syntactical info is really lost here either. I will close this unless there is something I am missing about this.
Ah this is me getting confused about the differences between different versions of Ruby again, then.
Here's why I'm confused by this:
This is what we parse for not x
:
1.8: (RootNode, (NewlineNode, (NotNode, (VCallNode:x))))
1.9: (RootNode, (NewlineNode, (CallNode:not, (VCallNode:x), (ArrayNode))))
2.0: (RootNode, (NewlineNode, (CallNode:!, (VCallNode:x), (ListNode))))
1.8 makes sense.
Everyone says that in 1.9 they made not
an operator that means call !
just with different precedence, and this is what seems to happen when I try it out. However! The docs contradict that! http://www.ruby-doc.org/docs/keywords/1.9/files/keywords_rb.html#M000027 says that !
can be overridden, and that this is what makes it different to not
. I guess the docs are wrong?
Also in 1.9 there is no not
method, so that should be !
, possibly with some hint to say lexically it was actually not
.
2.0 makes sense.
So all in all 1.9 needs to produce a call to !
rather than not
, and the 1.9 docs on not
seem to be wrong.
Yeah the documentation does seem wrong to me.
I am thinking that in 1.9/2.0 we should return lexical name of 'not' and name of '!' perhaps? I might need to audit Netbeans code and make some changes for this since I think renames only use the lexical name without any decorations as the highlighted region in a rename action. If this is an issue I think I might add another method which maybe is getSigil or getDecoration so that I can use lexical name and then subtract the sigil or decoration to calculate the proper highlight range for IDE usage. Then name is a semantic value and non-semantic uses can just use lexical name unconditionally.
Fixed in 088aba6.