Error parsing string literals when running repl in :power mode?

24 views
Skip to first unread message

arka...@gmail.com

unread,
May 20, 2015, 10:10:30 PM5/20/15
to scala...@googlegroups.com
Has anyone seen an issue like this before? 

[tw-mbp-atetelman birdcage (master)]$ scala
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=utf8
Welcome to Scala version 2.11.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_60).
Type in expressions to have them evaluated.
Type :help for more information.

scala> val event = """
     | "
     | """
event: String =
"
"
"

scala> :power
** Power User mode enabled - BEEP WHIR GYVE **
** :phase has been set to 'typer'.          **
** scala.tools.nsc._ has been imported      **
** global._, definitions._ also imported    **
** Try  :help, :vals, power.<tab>           **

scala> val event = """
     | "
     | """
<console>:6: error: unclosed string literal
"
^

Som Snytt

unread,
May 20, 2015, 10:48:04 PM5/20/15
to arka...@gmail.com, scala-user
I don't know anything about power mode, and I'm afraid to say anything because Li Haoyi will point out that Ammonite doesn't suffer from that defect.

scala> val s = """
     | abc
     | """ // show
object $read extends scala.AnyRef {
  def <init>() = {
    super.<init>;
    ()
  };
  def $line = "val s = ";
  abc;
  " // show";
  def $trees = Nil;
[snip]
                                    object $iw extends scala.AnyRef {
                                      def <init>() = {
                                        super.<init>;
                                        ()
                                      };
                                      val s = "\nabc\n"
                                    }


It looks a bit broken.

--
You received this message because you are subscribed to the Google Groups "scala-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Som Snytt

unread,
May 20, 2015, 10:59:00 PM5/20/15
to arka...@gmail.com, scala-user
Sorry for the spam, but this example offers greater hilarity...

scala> val s = """ abc """ // show
object $read extends scala.AnyRef {
  def <init>() = {
    super.<init>;
    ()
  };
  def $line = "val s = ".abc(" // show");



Som Snytt

unread,
May 20, 2015, 11:03:31 PM5/20/15
to arka...@gmail.com, scala-user
It's not subtle. The $line part uses:

private def tquoted(s: String) = "\"\"\"" + s + "\"\"\""

It falls under https://issues.scala-lang.org/browse/SI-9016 perhaps. "More limits of text-based REPL."


Arkadiy Tetelman

unread,
May 20, 2015, 11:32:20 PM5/20/15
to Som Snytt, scala-user
Hah, well at least I have peace of mind now. Thanks Som.
--
Arkadiy

Seth Tisue

unread,
Aug 27, 2015, 5:44:59 PM8/27/15
to scala-user
reported by me https://issues.scala-lang.org/browse/SI-9450, fixed by Jason Z

Haoyi Li

unread,
Aug 27, 2015, 6:15:15 PM8/27/15
to Seth Tisue, scala-user
> I'm afraid to say anything because Li Haoyi will point out that Ammonite doesn't suffer from that defect.

Ammonite doesn't support power mode =D so I can't take credit for this one

On Thu, Aug 27, 2015 at 5:44 PM, Seth Tisue <se...@tisue.net> wrote:
reported by me https://issues.scala-lang.org/browse/SI-9450, fixed by Jason Z

--

Naftoli Gugenheim

unread,
Aug 27, 2015, 9:56:17 PM8/27/15
to Haoyi Li, Seth Tisue, scala-user


On Thu, Aug 27, 2015, 6:15 PM Haoyi Li <haoy...@gmail.com> wrote:

> I'm afraid to say anything because Li Haoyi will point out that Ammonite doesn't suffer from that defect.

Ammonite doesn't support power mode =

D

You see? Som was right!

Reply all
Reply to author
Forward
0 new messages