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

Comments

Projects
None yet
2 participants
@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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Author

scabug commented Oct 2, 2016

@scabug scabug closed this Nov 16, 2016

@scabug scabug added this to the 2.12.1 milestone Apr 7, 2017

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