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 2 commits into from Sep 13, 2018


Copy link

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 Sep 12, 2018


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

This comment has been minimized.

Copy link

exoego Sep 12, 2018

Author Contributor

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!
combined All previous commits successful.
continuous-integration/travis-ci/pr The Travis CI build passed
validate-main [4415] SUCCESS. Took 40 min.

@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
None yet
5 participants
You can’t perform that action at this time.