From a180f5f24f2094112a01cdb02e0e8f218db68d70 Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Wed, 25 Feb 2015 20:33:20 -0800 Subject: SI-9170 More flexible SessionTest SessionTest session text can include line continuations and pasted text. Pasted script (which looks like a double prompt) probably doesn't work. This commit includes @retronym's SI-9170 one-liner. --- test/files/run/t9170.scala | 58 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 test/files/run/t9170.scala (limited to 'test') diff --git a/test/files/run/t9170.scala b/test/files/run/t9170.scala new file mode 100644 index 0000000000..25a0e84581 --- /dev/null +++ b/test/files/run/t9170.scala @@ -0,0 +1,58 @@ + +import scala.tools.partest.SessionTest + +object Test extends SessionTest { + + override def stripMargins = false + + def session = +"""Type in expressions to have them evaluated. +Type :help for more information. + +scala> object Y { def f[A](a: => A) = 1 ; def f[A](a: => Either[Exception, A]) = 2 } +:7: error: double definition: +def f[A](a: => A): Int at line 7 and +def f[A](a: => Either[Exception,A]): Int at line 7 +have same type after erasure: (a: Function0)Int + object Y { def f[A](a: => A) = 1 ; def f[A](a: => Either[Exception, A]) = 2 } + ^ + +scala> object Y { def f[A](a: => A) = 1 ; def f[A](a: => Either[Exception, A]) = 2 } +:7: error: double definition: +def f[A](a: => A): Int at line 7 and +def f[A](a: => Either[Exception,A]): Int at line 7 +have same type after erasure: (a: Function0)Int + object Y { def f[A](a: => A) = 1 ; def f[A](a: => Either[Exception, A]) = 2 } + ^ + +scala> object Y { + | def f[A](a: => A) = 1 + | def f[A](a: => Either[Exception, A]) = 2 + | } +:9: error: double definition: +def f[A](a: => A): Int at line 8 and +def f[A](a: => Either[Exception,A]): Int at line 9 +have same type after erasure: (a: Function0)Int + def f[A](a: => Either[Exception, A]) = 2 + ^ + +scala> :pa +// Entering paste mode (ctrl-D to finish) + +object Y { + def f[A](a: => A) = 1 + def f[A](a: => Either[Exception, A]) = 2 +} + +// Exiting paste mode, now interpreting. + +:9: error: double definition: +def f[A](a: => A): Int at line 8 and +def f[A](a: => Either[Exception,A]): Int at line 9 +have same type after erasure: (a: Function0)Int + def f[A](a: => Either[Exception, A]) = 2 + ^ + +scala> :quit""" +} + -- cgit v1.2.3