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

Recommend string interpolation instead of toString #7201

Merged
merged 2 commits into from Sep 13, 2018

Conversation

@exoego
Copy link
Contributor

commented Sep 11, 2018

Adresses scala/bug#11025 (comment)

s"" interpolator is optimized since 2.12.5 (#6093), as mentioned in scala/bug#11025 (comment),

@scala-jenkins scala-jenkins added this to the 2.13.0-RC1 milestone Sep 11, 2018

@@ -147,7 +147,7 @@ import scala.language.implicitConversions"""
def mkCoercions = numeric map (x => "def to%s: %s".format(x, x))
def mkUnaryOps = unaryOps map (x => "%s\n def unary_%s : %s".format(x.doc, x.op, this opType I))
def mkStringOps = List(
"""@deprecated("Adding a number and a String is deprecated. Convert the number to a String with `toString` first to call +", "2.13.0") def +(x: String): String"""
"""@deprecated("Adding a number and a String is deprecated. Use the string interpolation `s\"${num}{$str}\"`", "2.13.0") def +(x: String): String"""

This comment has been minimized.

Copy link
@NthPortal

NthPortal Sep 12, 2018

Contributor

should be either s\"${num}${str}\" or s\"$num$str\"

This comment has been minimized.

Copy link
@exoego

exoego Sep 12, 2018

Author Contributor

Oops.
Made the example valid and shorter.

xuwei-k added a commit to xuwei-k/scalaj-http that referenced this pull request Sep 13, 2018

@szeiger szeiger merged commit 4c9136a into scala:2.13.x Sep 13, 2018

4 checks passed

cla @exoego signed the Scala CLA. Thanks!
Details
combined All previous commits successful.
continuous-integration/travis-ci/pr The Travis CI build passed
Details
validate-main [4415] SUCCESS. Took 40 min.
Details

@exoego exoego deleted the exoego:recommend-string-interpolation branch Sep 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.