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
Parser counts one new line instead of two #5740
Comments
Imported From: https://issues.scala-lang.org/browse/SI-5740?orig=1 |
@paulp said: |
@Alefas said: |
@Alefas said: def foo(x: Int)(y: Int) = 1
foo(1)/*
*/(2) This is not compilable, however it seems it should be compilable. foo(1)//line comment
(2) So something about comments is wrong or not specified. |
@paulp said (edited on May 5, 2012 8:30:35 PM UTC): Nil map // foo
identity
Nil map
// foo
identity
Nil map
// foo
// foo
identity
Nil map /* foo
*/ identity
Nil map /* foo */
identity
Nil map /*
foo
*/
identity
Nil map /*
foo
foo
foo
*/
identity But THIS does not (compare with last example.) Nil map /*
*/
identity So you can make code uncompilable by changing the content of the comment, without even changing the number of newlines in it! It looks like a completely blank line is being counted as an nl token even if it's inside a block comment, but a line with any non-whitespace is not. I can find pretty much nothing on how comments translate into whitespace in the spec. |
@odersky said: Normally, only a single \code{nl} token is inserted between two As per suggestions on the thread, we will change this to: Normally, only a single \code{nl} token is inserted between two |
This code shouldn't compile, because there are two new line chars between "1 to" and "5" and such code looks weird to be compilable (other thing is about block comments, which explicitly contains new line chars).
The text was updated successfully, but these errors were encountered: