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
[SR-186] Comments not followed by whitespace can confuse compiler #42808
Comments
Sounds like a simple Lexer/Parser bug. |
Comment by Jesse Rusak (JIRA) The issue appears to be that the |
Comment by Jesse Rusak (JIRA) After looking over the language reference, it seems like comments should be treated as whitespace, rather than as "invisible". At the moment, the code which decides between postfix/prefix/binary operators treats comments as non-whitespace. Changing this code to treat comments as whitespace could break existing code. For example, the code Worth discussing on the mailing list before making a PR? |
I think it is worth a quick email. |
Comment by Jesse Rusak (JIRA) I've started a thread on swift-evolution to discuss the questions which were raised by this. |
Comment by Jesse Rusak (JIRA) I've started a draft patch for this, pending further discussion on swift-evolution. |
Comment by Jesse Rusak (JIRA) The review for the related swift-evolution proposal concludes today: http://thread.gmane.org/gmane.comp.lang.swift.evolution/9218 |
Comment by Jesse Rusak (JIRA) This has been fixed with this PR: #1732 |
Environment
Swift 2.1.1, Xcode 7.2
Additional Detail from JIRA
md5: 7122c4cd48dd86437f4b98b0c6e18b52
relates to:
Issue Description:
Attempting to compile the following:
Fails with the following errors:
Adding whitespace between the */ and ! compiles fine:
As does removing the NOT without added whitespace:
Expectation: I would expect the compiler to treat everything between and including the /* */ delimiters to be treated as invisible such that:
would appear to the compiler as
The text was updated successfully, but these errors were encountered: