diff options
author | Dominik Gruntz <dominik.gruntz@fhnw.ch> | 2012-03-28 12:03:51 +0200 |
---|---|---|
committer | Dominik Gruntz <dominik.gruntz@fhnw.ch> | 2012-03-28 12:03:51 +0200 |
commit | 017f48e00b863ecfc6a39c16c89a6ccb1dcde13d (patch) | |
tree | bafad2824b2eff4fa755f5c443032dfd73dc707d | |
parent | d078b58961014c5eaa7540c4cec733679dc8965c (diff) | |
download | scala-017f48e00b863ecfc6a39c16c89a6ccb1dcde13d.tar.gz scala-017f48e00b863ecfc6a39c16c89a6ccb1dcde13d.tar.bz2 scala-017f48e00b863ecfc6a39c16c89a6ccb1dcde13d.zip |
String interpolation bug fix
This change fixes a bug in class StringContext.scala.
Parts were not correctly added to the resulting string.
This commit includes a test case which covers the
example reported in the bug.
Closes SI-5614.
-rw-r--r-- | src/library/scala/StringContext.scala | 2 | ||||
-rw-r--r-- | test/files/run/t5614.check | 3 | ||||
-rw-r--r-- | test/files/run/t5614.flags | 1 | ||||
-rw-r--r-- | test/files/run/t5614.scala | 5 |
4 files changed, 10 insertions, 1 deletions
diff --git a/src/library/scala/StringContext.scala b/src/library/scala/StringContext.scala index 1b01355108..882451680a 100644 --- a/src/library/scala/StringContext.scala +++ b/src/library/scala/StringContext.scala @@ -144,7 +144,7 @@ object StringContext { var cur = 0 var idx = 0 def output(ch: Char) = { - bldr append str substring (start, cur) + bldr append str.substring (start, cur) bldr append ch start = idx } diff --git a/test/files/run/t5614.check b/test/files/run/t5614.check new file mode 100644 index 0000000000..f659f2da3b --- /dev/null +++ b/test/files/run/t5614.check @@ -0,0 +1,3 @@ +3 +a +b diff --git a/test/files/run/t5614.flags b/test/files/run/t5614.flags new file mode 100644 index 0000000000..48fd867160 --- /dev/null +++ b/test/files/run/t5614.flags @@ -0,0 +1 @@ +-Xexperimental diff --git a/test/files/run/t5614.scala b/test/files/run/t5614.scala new file mode 100644 index 0000000000..7c85c33f12 --- /dev/null +++ b/test/files/run/t5614.scala @@ -0,0 +1,5 @@ +object Test extends App { + val str = s"a\nb" + println(str.length) + println(str) +} |