summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-10-04 16:16:42 -0700
committerPaul Phillips <paulp@improving.org>2012-10-04 16:16:42 -0700
commit172080b6a487db6e2b3ec2d5de4b2ce7441e8557 (patch)
tree1dec1dbe43b75295392c78a785de0dab3b7543e9 /test
parent4715d782d4f4f1f36c11d26023f970a25f2a8c23 (diff)
parent29a59700b4cf1ade91abb6020ba4814be5ef88e7 (diff)
downloadscala-172080b6a487db6e2b3ec2d5de4b2ce7441e8557.tar.gz
scala-172080b6a487db6e2b3ec2d5de4b2ce7441e8557.tar.bz2
scala-172080b6a487db6e2b3ec2d5de4b2ce7441e8557.zip
Merge pull request #1429 from paulp/topic/shortClass
Added utility function shortClass.
Diffstat (limited to 'test')
-rw-r--r--test/files/run/shortClass.check10
-rw-r--r--test/files/run/shortClass.scala24
2 files changed, 34 insertions, 0 deletions
diff --git a/test/files/run/shortClass.check b/test/files/run/shortClass.check
new file mode 100644
index 0000000000..fbdb725cca
--- /dev/null
+++ b/test/files/run/shortClass.check
@@ -0,0 +1,10 @@
+bippity.bop.Foo
+bippity.bop.Foo$Bar
+bippity.bop.Foo$Bar$
+Test$$anon$1
+Test$$anon$2
+Foo
+Bar
+Bar$
+Foo with DingDongBippy
+Bar with DingDongBippy
diff --git a/test/files/run/shortClass.scala b/test/files/run/shortClass.scala
new file mode 100644
index 0000000000..b7bb016896
--- /dev/null
+++ b/test/files/run/shortClass.scala
@@ -0,0 +1,24 @@
+import scala.reflect.internal.util._
+
+package bippity {
+ trait DingDongBippy
+
+ package bop {
+ class Foo {
+ class Bar
+ object Bar
+ }
+ }
+}
+
+object Test {
+ import bippity._
+ import bop._
+
+ def main(args: Array[String]): Unit = {
+ val f = new Foo
+ val instances = List(f, new f.Bar, f.Bar, new Foo with DingDongBippy, new f.Bar with DingDongBippy)
+ instances map (_.getClass.getName) foreach println
+ instances map shortClassOfInstance foreach println
+ }
+}