diff options
author | Heather Miller <heather.miller@epfl.ch> | 2012-04-15 14:51:18 +0200 |
---|---|---|
committer | Heather Miller <heather.miller@epfl.ch> | 2012-04-15 14:51:18 +0200 |
commit | e4bea920b42eaa526a9e07ad001f17443d6abeba (patch) | |
tree | c786202cc9d0fa5b1a26dfd8e1154cacca7fbaf4 /test/scaladoc/resources/implicits-shadowing-res.scala | |
parent | 23aa1a8d7b08b767f90657baf9bc13a355682671 (diff) | |
parent | 364dd41c3e0e33afe6c3ec6e0c04f1d345c4b6ca (diff) | |
download | scala-e4bea920b42eaa526a9e07ad001f17443d6abeba.tar.gz scala-e4bea920b42eaa526a9e07ad001f17443d6abeba.tar.bz2 scala-e4bea920b42eaa526a9e07ad001f17443d6abeba.zip |
Merge branch 'master' of https://github.com/scala/scala into wip-sip14-fixes
Diffstat (limited to 'test/scaladoc/resources/implicits-shadowing-res.scala')
-rw-r--r-- | test/scaladoc/resources/implicits-shadowing-res.scala | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/test/scaladoc/resources/implicits-shadowing-res.scala b/test/scaladoc/resources/implicits-shadowing-res.scala new file mode 100644 index 0000000000..c5e9493bf3 --- /dev/null +++ b/test/scaladoc/resources/implicits-shadowing-res.scala @@ -0,0 +1,64 @@ +/** + * Test scaladoc implicits distinguishing -- supress all members by implicit conversion that are shadowed by the + * class' own members + * + * {{{ + * scala> class A { def foo(t: String) = 4 } + * defined class A + * + * scala> class B { def foo(t: Any) = 5 } + * defined class B + * + * scala> implicit def AtoB(a:A) = new B + * AtoB: (a: A)B + * + * scala> val a = new A + * a: A = A@28f553e3 + * + * scala> a.foo("T") + * res1: Int = 4 + * + * scala> a.foo(4) + * res2: Int = 5 + * }}} + */ +package scala.test.scaladoc.implicits.shadowing +import language.implicitConversions // according to SIP18 + +/** conv5, conv8, conv9, conv10, conv11 should be visible */ +class A[T] { + def conv1: AnyRef = ??? + def conv2: T = ??? + def conv3(l: Int): AnyRef = ??? + def conv4(l: AnyRef): AnyRef = ??? + def conv5(l: String): AnyRef = ??? + def conv6(l: AnyRef): AnyRef = ??? + def conv7(l: AnyRef): String = ??? + def conv8(l: String)(m: String): AnyRef = ??? + def conv9(l: AnyRef)(m: AnyRef): AnyRef = ??? + def conv10(l: T): T = ??? + def conv11(l: T): T = ??? +} +/** conv5, conv8, conv9, conv11 should be visible */ +class B extends A[Int] +/** conv5, conv8, conv9, conv10, conv11 should be visible */ +class C extends A[Double] +/** conv5, conv8, conv9, conv10 should be visible */ +class D extends A[AnyRef] + +class Z[T] { + def conv1: AnyRef = ??? + def conv2: T = ??? + def conv3(p: Int): AnyRef = ??? + def conv4(p: String): AnyRef = ??? + def conv5(p: AnyRef): AnyRef = ??? + def conv6(p: AnyRef): String = ??? + def conv7(p: AnyRef): AnyRef = ??? + def conv8(p: String, q: String): AnyRef = ??? + def conv9(p: AnyRef, q: AnyRef): AnyRef = ??? + def conv10(p: Int): T = ??? + def conv11(p: String): T = ??? +} +object A { + implicit def AtoZ[T](a: A[T]) = new Z[T] +} |