Skip to content
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

Multiline string interpolation eats carriage returns #9944

Closed
scabug opened this issue Oct 1, 2016 · 3 comments
Closed

Multiline string interpolation eats carriage returns #9944

scabug opened this issue Oct 1, 2016 · 3 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Oct 1, 2016

Having the following piece of code saved with Windows-style line endings (CRLF)

    implicit class TestStringContext(val context: StringContext) {
      def x(args: Any*): Unit = {
        context.parts.foreach(part => println(part.getBytes("UTF-8").toList))
      }
    }
    x"""
      ${1}
    """

String interpolation eats carriage return

List(13, 10, 32, 32, 32, 32, 32, 32)
List(10, 32, 32, 32, 32)

The first part starts with CRLF as expected, but the second part starts with LF only, CR is missing.

@scabug
Copy link
Author

scabug commented Oct 1, 2016

Imported From: https://issues.scala-lang.org/browse/SI-9944?orig=1
Reporter: Yaroslav Ulanovych (yarulan)
Affected Versions: 2.11.8

@scabug
Copy link
Author

scabug commented Oct 1, 2016

@som-snytt said:
It happens only for the CR immediately following the right brace of an expression.

Workaround is to assign to a variable and use interpolated id $ident.

@scabug
Copy link
Author

scabug commented Oct 2, 2016

@som-snytt said:
scala/scala#5440

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants