From 86ae2f95ce33ef22f9c9ad40d6a966fbef7d352f Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Thu, 7 Apr 2016 12:32:40 -0700 Subject: SI-9740 Repl import fix -Yrepl-class-based Under `-Yrepl-class-based`, templating must follow the same scoping as under traditional object-based. The new test shows a typical case where two values of the same simple name must be imported in different scopes. --- test/files/run/repl-classbased.check | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 test/files/run/repl-classbased.check (limited to 'test/files/run/repl-classbased.check') diff --git a/test/files/run/repl-classbased.check b/test/files/run/repl-classbased.check new file mode 100644 index 0000000000..e11fc170e5 --- /dev/null +++ b/test/files/run/repl-classbased.check @@ -0,0 +1,23 @@ + +scala> case class K(s: String) +defined class K + +scala> class C { implicit val k: K = K("OK?"); override def toString = s"C($k)" } +defined class C + +scala> val c = new C +c: C = C(K(OK?)) + +scala> import c.k +import c.k + +scala> implicitly[K] +res0: K = K(OK?) + +scala> val k = 42 +k: Int = 42 + +scala> k // was K(OK?) +res1: Int = 42 + +scala> :quit -- cgit v1.2.3