diff options
author | Vlad Ureche <vlad.ureche@gmail.com> | 2012-04-13 11:55:35 +0200 |
---|---|---|
committer | Vlad Ureche <vlad.ureche@gmail.com> | 2012-04-13 11:55:35 +0200 |
commit | 355264f9d53c09182fe6f480319543dc914860d1 (patch) | |
tree | b701eeebc4df1703baf3c91e81641ba70349edf4 /test/scaladoc/resources/implicits-scopes-res.scala | |
parent | 821229f7fe966f955ebfa87ed0d6ed3760d3f875 (diff) | |
download | scala-355264f9d53c09182fe6f480319543dc914860d1.tar.gz scala-355264f9d53c09182fe6f480319543dc914860d1.tar.bz2 scala-355264f9d53c09182fe6f480319543dc914860d1.zip |
Scaladoc feature that shows implicit conversions
See https://github.com/VladUreche/scala/tree/feature/doc-implicits for the history.
See https://scala-webapps.epfl.ch/jenkins/view/scaladoc/job/scaladoc-implicits-nightly/ for nightlies.
Many thanks fly out to Adriaan for his help with implicit search!
Diffstat (limited to 'test/scaladoc/resources/implicits-scopes-res.scala')
-rw-r--r-- | test/scaladoc/resources/implicits-scopes-res.scala | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/scaladoc/resources/implicits-scopes-res.scala b/test/scaladoc/resources/implicits-scopes-res.scala new file mode 100644 index 0000000000..4e55c3e388 --- /dev/null +++ b/test/scaladoc/resources/implicits-scopes-res.scala @@ -0,0 +1,51 @@ +/** + * Testing scaladoc implicit scopes - looking for implicits in the right places + */ +package scala.test.scaladoc.implicits.scopes + +// TEST1 - In package object +package object test1 { + implicit def toB(a: A): B = null +} +package test1 { + class A + class B { def b = "" } +} + +// TEST2 - In enclosing package - doesn't seem to work even in scalac +package object test2 { + import classes._ + implicit def toB(a: A): B = null +} +package test2 { + package classes { + class A + class B { def b = "" } + object test { /* (new A).b won't compile */ } + } +} + +// TEST3 - In companion object +package test3 { + class A + object A { implicit def toB(a: A): B = null } + class B { def b = "" } +} + +// TEST4 - Nested type's companion object +package test4 { + class U[V] + class S + object S { implicit def toB(a: A): B = null } + class A extends U[S] + class B { def b = "" } +} + +// TEST5 - In scope +package test5 { + object scope { + class A + class B { def b = "" } + implicit def toB(a: A): B = null + } +} |