[swift-dev] Breaking change in lexing operators next to comments
me at jesserusak.com
Mon Dec 14 22:15:47 CST 2015
I’m investigating this bug: https://bugs.swift.org/browse/SR-186
Which appears to be a result of the fact that the logic that determines if an operator is prefix/postfix/binary does not treat comments as whitespace. So, for example:
/* comment */!foo
does not lex as expected because the “!" thinks it has an something on both sides and so is treated as a binary operator.
Fixing this (by treating comments as whitespace here) will break existing code which relies on the current behavior, such as:
foo/* comment */!
which currently treats the “!” as a postfix operator but will change to binary. I expect these cases would be rare (maybe in some generated code?), but the results might be pretty confusing.
Any objections to fixing this or other thoughts?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-dev