summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/macro-cyclic.check8
-rw-r--r--test/files/neg/macro-cyclic/Impls_Macros_1.scala2
-rw-r--r--test/files/run/existentials-in-compiler.scala2
-rw-r--r--test/files/run/macro-openmacros/Impls_Macros_1.scala2
-rw-r--r--test/files/run/macro-reify-basic/Macros_1.scala2
-rw-r--r--test/files/run/macro-reify-freevars/Macros_1.scala2
-rw-r--r--test/files/run/macro-reify-nested-a/Impls_Macros_1.scala2
-rw-r--r--test/files/run/macro-reify-nested-b/Impls_Macros_1.scala2
-rw-r--r--test/files/run/macro-reify-ref-to-packageless/Impls_1.scala2
-rw-r--r--test/files/run/macro-reify-splice-splice/Macros_1.scala4
-rw-r--r--test/files/run/macro-reify-staticXXX.check12
-rw-r--r--test/files/run/macro-reify-staticXXX.flags1
-rw-r--r--test/files/run/macro-reify-staticXXX/Macros_1.scala48
-rw-r--r--test/files/run/macro-reify-staticXXX/Test_2.scala4
-rw-r--r--test/files/run/macro-reify-tagful-a/Macros_1.scala2
-rw-r--r--test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala2
-rw-r--r--test/files/run/macro-reify-unreify/Macros_1.scala2
-rw-r--r--test/files/run/macro-settings/Impls_Macros_1.scala2
-rw-r--r--test/files/run/macro-sip19-revised/Impls_Macros_1.scala2
-rw-r--r--test/files/run/macro-sip19/Impls_Macros_1.scala2
-rw-r--r--test/files/run/macro-typecheck-macrosdisabled2.check4
-rw-r--r--test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala4
-rw-r--r--test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala2
-rw-r--r--test/files/run/reify-staticXXX.check24
-rw-r--r--test/files/run/reify-staticXXX.scala56
-rw-r--r--test/files/run/t5713/Impls_Macros_1.scala6
-rw-r--r--test/files/run/t6104.check1
-rw-r--r--test/files/run/t6104.scala8
-rw-r--r--test/files/run/toolbox_typecheck_macrosdisabled2.check4
-rw-r--r--test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala2
-rw-r--r--test/pending/run/macro-reify-array/Macros_1.scala2
-rw-r--r--test/pending/run/macro-reify-tagful-b/Macros_1.scala2
-rw-r--r--test/pending/run/macro-reify-tagless-b/Impls_Macros_1.scala2
-rw-r--r--test/pending/run/t5692/Impls_Macros_1.scala2
-rw-r--r--test/scaladoc/resources/SI-3314-diagrams.scala78
-rw-r--r--test/scaladoc/resources/SI-3314.scala85
-rw-r--r--test/scaladoc/resources/SI-4360.scala42
-rw-r--r--test/scaladoc/resources/SI-5558.scala6
-rw-r--r--test/scaladoc/resources/SI-5784.scala28
-rw-r--r--test/scaladoc/resources/SI_4676.scala4
-rw-r--r--test/scaladoc/resources/Trac3484.scala27
-rw-r--r--test/scaladoc/resources/doc-root/AnyRef.scala1
-rw-r--r--test/scaladoc/resources/implicits-known-type-classes-res.scala38
-rw-r--r--test/scaladoc/resources/implicits-scopes-res.scala2
-rw-r--r--test/scaladoc/resources/links.scala57
-rw-r--r--test/scaladoc/resources/package-object-res.scala2
-rw-r--r--test/scaladoc/run/SI-3314-diagrams.check1
-rw-r--r--test/scaladoc/run/SI-3314-diagrams.scala28
-rw-r--r--test/scaladoc/run/SI-3314.check1
-rw-r--r--test/scaladoc/run/SI-3314.scala91
-rw-r--r--test/scaladoc/run/SI-3448.check1
-rw-r--r--test/scaladoc/run/SI-3448.scala38
-rw-r--r--test/scaladoc/run/SI-3484.check1
-rw-r--r--test/scaladoc/run/SI-3484.scala52
-rw-r--r--test/scaladoc/run/SI-4324.check1
-rw-r--r--test/scaladoc/run/SI-4324.scala24
-rw-r--r--test/scaladoc/run/SI-4360.check1
-rw-r--r--test/scaladoc/run/SI-4360.scala48
-rw-r--r--test/scaladoc/run/SI-4676.check1
-rw-r--r--test/scaladoc/run/SI-4676.scala26
-rw-r--r--test/scaladoc/run/SI-4887.check1
-rw-r--r--test/scaladoc/run/SI-4887.scala46
-rw-r--r--test/scaladoc/run/SI-5235.check4
-rw-r--r--test/scaladoc/run/SI-5235.scala87
-rw-r--r--test/scaladoc/run/SI-5533.check1
-rw-r--r--test/scaladoc/run/SI-5533.scala39
-rw-r--r--test/scaladoc/run/SI-5784.check1
-rw-r--r--test/scaladoc/run/SI-5784.scala44
-rw-r--r--test/scaladoc/run/SI-5965.check1
-rw-r--r--test/scaladoc/run/SI-5965.scala24
-rw-r--r--test/scaladoc/run/diagrams-base.scala6
-rw-r--r--test/scaladoc/run/diagrams-determinism.scala20
-rw-r--r--test/scaladoc/run/diagrams-filtering.scala2
-rw-r--r--test/scaladoc/run/groups.check1
-rw-r--r--test/scaladoc/run/groups.scala119
-rw-r--r--test/scaladoc/run/implicits-ambiguating.scala2
-rw-r--r--test/scaladoc/run/implicits-known-type-classes.check1
-rw-r--r--test/scaladoc/run/implicits-known-type-classes.scala33
-rw-r--r--test/scaladoc/run/implicits-scopes.scala6
-rw-r--r--test/scaladoc/run/implicits-shadowing.scala2
-rw-r--r--test/scaladoc/run/implicits-var-exp.scala35
-rw-r--r--test/scaladoc/run/links.check1
-rw-r--r--test/scaladoc/run/links.scala28
-rw-r--r--test/scaladoc/scalacheck/CommentFactoryTest.scala16
-rw-r--r--test/scaladoc/scalacheck/HtmlFactoryTest.scala73
-rw-r--r--test/scaladoc/scalacheck/IndexTest.scala13
86 files changed, 1359 insertions, 155 deletions
diff --git a/test/files/neg/macro-cyclic.check b/test/files/neg/macro-cyclic.check
index 608381e0e8..7978ec64a5 100644
--- a/test/files/neg/macro-cyclic.check
+++ b/test/files/neg/macro-cyclic.check
@@ -1,4 +1,4 @@
-Impls_Macros_1.scala:5: error: could not find implicit value for parameter e: SourceLocation
- c.reify { implicitly[SourceLocation] }
- ^
-one error found
+Impls_Macros_1.scala:5: error: could not find implicit value for parameter e: SourceLocation
+ c.universe.reify { implicitly[SourceLocation] }
+ ^
+one error found
diff --git a/test/files/neg/macro-cyclic/Impls_Macros_1.scala b/test/files/neg/macro-cyclic/Impls_Macros_1.scala
index 1ea06fc968..2ecdc3416e 100644
--- a/test/files/neg/macro-cyclic/Impls_Macros_1.scala
+++ b/test/files/neg/macro-cyclic/Impls_Macros_1.scala
@@ -2,7 +2,7 @@ import scala.reflect.makro.Context
object Macros {
def impl(c: Context) = {
- c.reify { implicitly[SourceLocation] }
+ c.universe.reify { implicitly[SourceLocation] }
}
implicit def sourceLocation: SourceLocation1 = macro impl
diff --git a/test/files/run/existentials-in-compiler.scala b/test/files/run/existentials-in-compiler.scala
index 1f314aa4e0..c69d1217fd 100644
--- a/test/files/run/existentials-in-compiler.scala
+++ b/test/files/run/existentials-in-compiler.scala
@@ -72,7 +72,7 @@ package extest {
"""
def check(source: String, unit: global.CompilationUnit) = {
- getRequiredModule("extest").moduleClass.info.decls.toList.filter(_.isType).map(_.initialize).sortBy(_.name.toString) foreach { clazz =>
+ getRequiredPackage("extest").moduleClass.info.decls.toList.filter(_.isType).map(_.initialize).sortBy(_.name.toString) foreach { clazz =>
afterTyper {
clazz.info
println(clazz.defString)
diff --git a/test/files/run/macro-openmacros/Impls_Macros_1.scala b/test/files/run/macro-openmacros/Impls_Macros_1.scala
index ffeccce1e8..6b92834b81 100644
--- a/test/files/run/macro-openmacros/Impls_Macros_1.scala
+++ b/test/files/run/macro-openmacros/Impls_Macros_1.scala
@@ -16,7 +16,7 @@ object Macros {
import c.universe._
val next = if (c.enclosingMacros.length < 3) c.Expr[Unit](Select(Ident(c.mirror.staticModule("Macros")), newTermName("foo"))) else c.literalUnit
- c.reify {
+ c.universe.reify {
println(c.literal(normalizePaths(c.enclosingMacros.toString)).splice)
next.splice
}
diff --git a/test/files/run/macro-reify-basic/Macros_1.scala b/test/files/run/macro-reify-basic/Macros_1.scala
index 7a43ee58be..8f8598e248 100644
--- a/test/files/run/macro-reify-basic/Macros_1.scala
+++ b/test/files/run/macro-reify-basic/Macros_1.scala
@@ -4,7 +4,7 @@ object Macros {
def foo(s: String) = macro Impls.foo
object Impls {
- def foo(c: Ctx)(s: c.Expr[String]) = c.reify {
+ def foo(c: Ctx)(s: c.Expr[String]) = c.universe.reify {
println("hello " + s.splice)
}
}
diff --git a/test/files/run/macro-reify-freevars/Macros_1.scala b/test/files/run/macro-reify-freevars/Macros_1.scala
index eafc7f9a82..df1473511d 100644
--- a/test/files/run/macro-reify-freevars/Macros_1.scala
+++ b/test/files/run/macro-reify-freevars/Macros_1.scala
@@ -7,7 +7,7 @@ object QueryableMacros{
: c.Expr[scala.collection.slick.Queryable[S]] = {
import c.universe._
val code = EmptyTree
- c.reify{
+ c.universe.reify{
Queryable.factory[S]( code.asInstanceOf[reflect.runtime.universe.Tree] )
}
}
diff --git a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala
index f9a08df90d..b52b962e31 100644
--- a/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala
+++ b/test/files/run/macro-reify-nested-a/Impls_Macros_1.scala
@@ -30,7 +30,7 @@ object QueryableMacros{
Apply(Select(c.prefix.tree, newTermName( name )), List( projection.tree ))
).asInstanceOf[Tree]
)))
- c.reify{ Queryable.factory[S]( foo.splice )}
+ c.universe.reify{ Queryable.factory[S]( foo.splice )}
}
def map[T:c.TypeTag, S:c.TypeTag]
(c: scala.reflect.makro.Context)
diff --git a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala b/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala
index f9a08df90d..b52b962e31 100644
--- a/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala
+++ b/test/files/run/macro-reify-nested-b/Impls_Macros_1.scala
@@ -30,7 +30,7 @@ object QueryableMacros{
Apply(Select(c.prefix.tree, newTermName( name )), List( projection.tree ))
).asInstanceOf[Tree]
)))
- c.reify{ Queryable.factory[S]( foo.splice )}
+ c.universe.reify{ Queryable.factory[S]( foo.splice )}
}
def map[T:c.TypeTag, S:c.TypeTag]
(c: scala.reflect.makro.Context)
diff --git a/test/files/run/macro-reify-ref-to-packageless/Impls_1.scala b/test/files/run/macro-reify-ref-to-packageless/Impls_1.scala
index 2f2d05678d..66c0ee1e9b 100644
--- a/test/files/run/macro-reify-ref-to-packageless/Impls_1.scala
+++ b/test/files/run/macro-reify-ref-to-packageless/Impls_1.scala
@@ -2,5 +2,5 @@ import scala.reflect.makro.{Context => Ctx}
object Impls {
val `Answer to the Ultimate Question of Life, the Universe, and Everything` = 42
- def foo(c: Ctx) = c.reify { `Answer to the Ultimate Question of Life, the Universe, and Everything` }
+ def foo(c: Ctx) = c.universe.reify { `Answer to the Ultimate Question of Life, the Universe, and Everything` }
}
diff --git a/test/files/run/macro-reify-splice-splice/Macros_1.scala b/test/files/run/macro-reify-splice-splice/Macros_1.scala
index 4f1b600f63..0de780b5a2 100644
--- a/test/files/run/macro-reify-splice-splice/Macros_1.scala
+++ b/test/files/run/macro-reify-splice-splice/Macros_1.scala
@@ -4,8 +4,8 @@ object Macros {
def foo = macro Impls.foo
object Impls {
- def foo(c: Ctx) = c.reify {
- { c.reify(c.reify("hello world")) }.splice.splice
+ def foo(c: Ctx) = c.universe.reify {
+ { c.universe.reify(c.universe.reify("hello world")) }.splice.splice
}
}
} \ No newline at end of file
diff --git a/test/files/run/macro-reify-staticXXX.check b/test/files/run/macro-reify-staticXXX.check
new file mode 100644
index 0000000000..2894fa5843
--- /dev/null
+++ b/test/files/run/macro-reify-staticXXX.check
@@ -0,0 +1,12 @@
+object
+class
+object > object
+object > class
+package > object
+package > class
+object
+class
+object > object
+object > class
+package > object
+package > class \ No newline at end of file
diff --git a/test/files/run/macro-reify-staticXXX.flags b/test/files/run/macro-reify-staticXXX.flags
new file mode 100644
index 0000000000..cd66464f2f
--- /dev/null
+++ b/test/files/run/macro-reify-staticXXX.flags
@@ -0,0 +1 @@
+-language:experimental.macros \ No newline at end of file
diff --git a/test/files/run/macro-reify-staticXXX/Macros_1.scala b/test/files/run/macro-reify-staticXXX/Macros_1.scala
new file mode 100644
index 0000000000..b0ce6507f8
--- /dev/null
+++ b/test/files/run/macro-reify-staticXXX/Macros_1.scala
@@ -0,0 +1,48 @@
+import scala.reflect.makro.Context
+
+object B { override def toString = "object" }
+class C { override def toString = "class" }
+
+package foo {
+ object B { override def toString = "package > object" }
+ class C { override def toString = "package > class" }
+}
+
+object foo {
+ object B { override def toString = "object > object" }
+ class C { override def toString = "object > class" }
+}
+
+object packageless {
+ def impl(c: Context) = {
+ import c.universe._
+ reify {
+ println(B)
+ println(new C)
+ println(foo.B)
+ println(new foo.C)
+ println(_root_.foo.B)
+ println(new _root_.foo.C)
+ }
+ }
+
+ def test = macro impl
+}
+
+package packageful {
+ object Test {
+ def impl(c: Context) = {
+ import c.universe._
+ reify {
+ println(B)
+ println(new C)
+ println(foo.B)
+ println(new foo.C)
+ println(_root_.foo.B)
+ println(new _root_.foo.C)
+ }
+ }
+
+ def test = macro impl
+ }
+}
diff --git a/test/files/run/macro-reify-staticXXX/Test_2.scala b/test/files/run/macro-reify-staticXXX/Test_2.scala
new file mode 100644
index 0000000000..6e8cc36080
--- /dev/null
+++ b/test/files/run/macro-reify-staticXXX/Test_2.scala
@@ -0,0 +1,4 @@
+object Test extends App {
+ packageless.test
+ packageful.Test.test
+}
diff --git a/test/files/run/macro-reify-tagful-a/Macros_1.scala b/test/files/run/macro-reify-tagful-a/Macros_1.scala
index 63f117220a..32b09bdcdf 100644
--- a/test/files/run/macro-reify-tagful-a/Macros_1.scala
+++ b/test/files/run/macro-reify-tagful-a/Macros_1.scala
@@ -5,7 +5,7 @@ object Macros {
def foo[T](s: T) = macro Impls.foo[T]
object Impls {
- def foo[T: c.TypeTag](c: Ctx)(s: c.Expr[T]) = c.reify {
+ def foo[T: c.TypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify {
List(s.splice)
}
}
diff --git a/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala b/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala
index 3796ae99cb..77e4b729d3 100644
--- a/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala
+++ b/test/files/run/macro-reify-tagless-a/Impls_Macros_1.scala
@@ -4,7 +4,7 @@ object Macros {
def foo[T](s: T) = macro Impls.foo[T]
object Impls {
- def foo[T](c: Ctx)(s: c.Expr[T]) = c.reify {
+ def foo[T](c: Ctx)(s: c.Expr[T]) = c.universe.reify {
List[T](s.splice)
}
}
diff --git a/test/files/run/macro-reify-unreify/Macros_1.scala b/test/files/run/macro-reify-unreify/Macros_1.scala
index 14777506d3..3e9033966d 100644
--- a/test/files/run/macro-reify-unreify/Macros_1.scala
+++ b/test/files/run/macro-reify-unreify/Macros_1.scala
@@ -11,7 +11,7 @@ object Macros {
val greeting = c.reifyTree(c.runtimeUniverse, EmptyTree, c.typeCheck(Apply(Select(Literal(Constant("hello ")), newTermName("$plus")), List(c.unreifyTree(world)))))
val typedGreeting = c.Expr[String](greeting)
- c.reify {
+ c.universe.reify {
println("hello " + s.splice + " = " + typedGreeting.splice)
}
}
diff --git a/test/files/run/macro-settings/Impls_Macros_1.scala b/test/files/run/macro-settings/Impls_Macros_1.scala
index 56e28b506c..20dcdc1bd1 100644
--- a/test/files/run/macro-settings/Impls_Macros_1.scala
+++ b/test/files/run/macro-settings/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
import scala.reflect.makro.Context
object Impls {
- def impl(c: Context) = c.reify {
+ def impl(c: Context) = c.universe.reify {
println(c.literal(c.settings.toString).splice)
}
}
diff --git a/test/files/run/macro-sip19-revised/Impls_Macros_1.scala b/test/files/run/macro-sip19-revised/Impls_Macros_1.scala
index 994421808e..013130d181 100644
--- a/test/files/run/macro-sip19-revised/Impls_Macros_1.scala
+++ b/test/files/run/macro-sip19-revised/Impls_Macros_1.scala
@@ -11,7 +11,7 @@ object Macros {
val fileName = fun.pos.fileInfo.getName
val line = fun.pos.line
val charOffset = fun.pos.point
- c.reify { SourceLocation1(outer.splice, c.literal(fileName).splice, c.literal(line).splice, c.literal(charOffset).splice) }
+ c.universe.reify { SourceLocation1(outer.splice, c.literal(fileName).splice, c.literal(line).splice, c.literal(charOffset).splice) }
}
implicit def sourceLocation: SourceLocation1 = macro impl
diff --git a/test/files/run/macro-sip19/Impls_Macros_1.scala b/test/files/run/macro-sip19/Impls_Macros_1.scala
index c006ceb691..f6636c298c 100644
--- a/test/files/run/macro-sip19/Impls_Macros_1.scala
+++ b/test/files/run/macro-sip19/Impls_Macros_1.scala
@@ -7,7 +7,7 @@ object Macros {
val fileName = fun.pos.fileInfo.getName
val line = fun.pos.line
val charOffset = fun.pos.point
- c.reify { SourceLocation(c.literal(fileName).splice, c.literal(line).splice, c.literal(charOffset).splice) }
+ c.universe.reify { SourceLocation(c.literal(fileName).splice, c.literal(line).splice, c.literal(charOffset).splice) }
}
implicit def sourceLocation: SourceLocation = macro impl
diff --git a/test/files/run/macro-typecheck-macrosdisabled2.check b/test/files/run/macro-typecheck-macrosdisabled2.check
index e440b2c0cb..2160d3800a 100644
--- a/test/files/run/macro-typecheck-macrosdisabled2.check
+++ b/test/files/run/macro-typecheck-macrosdisabled2.check
@@ -15,7 +15,7 @@
private def applyImpl[U >: Nothing <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): scala.reflect.base.Universe#Tree = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.Apply.apply($u.Select.apply($u.Select.apply($u.build.Ident($m.staticModule("scala")), $u.newTermName("Array")), $u.newTermName("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2))))
+ $u.Apply.apply($u.Select.apply($u.Select.apply($u.build.Ident($m.staticPackage("scala")), $u.newTermName("Array")), $u.newTermName("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2))))
}
};
new $treecreator1()
@@ -28,7 +28,7 @@
def apply[U >: Nothing <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Type = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.TypeRef.apply($u.ThisType.apply($m.staticModule("scala").asModuleSymbol.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asTypeSymbol.asTypeConstructor))
+ $u.TypeRef.apply($u.ThisType.apply($m.staticPackage("scala").asModuleSymbol.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asTypeSymbol.asTypeConstructor))
}
};
new $typecreator2()
diff --git a/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala b/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala
index b9bb2cfcca..7b921c0e57 100644
--- a/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala
+++ b/test/files/run/macro-undetparams-consfromsls/Impls_Macros_1.scala
@@ -2,12 +2,12 @@ import scala.reflect.runtime.universe._
import scala.reflect.makro.Context
object Macros {
- def cons_impl[A: c.AbsTypeTag](c: Context)(x: c.Expr[A], xs: c.Expr[List[A]]): c.Expr[List[A]] = c.reify {
+ def cons_impl[A: c.AbsTypeTag](c: Context)(x: c.Expr[A], xs: c.Expr[List[A]]): c.Expr[List[A]] = c.universe.reify {
println("A = " + c.literal(implicitly[c.AbsTypeTag[A]].toString).splice)
x.splice :: xs.splice
}
- def nil_impl[B: c.AbsTypeTag](c: Context): c.Expr[List[B]] = c.reify {
+ def nil_impl[B: c.AbsTypeTag](c: Context): c.Expr[List[B]] = c.universe.reify {
println("B = " + c.literal(implicitly[c.AbsTypeTag[B]].toString).splice)
Nil
}
diff --git a/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala b/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala
index 9b1dd8e017..fdba40623b 100644
--- a/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala
+++ b/test/files/run/macro-undetparams-macroitself/Impls_Macros_1.scala
@@ -2,7 +2,7 @@ import scala.reflect.runtime.universe._
import scala.reflect.makro.Context
object Macros {
- def impl[T: c.TypeTag](c: Context)(foo: c.Expr[T]): c.Expr[Unit] = c.reify { println(c.literal(implicitly[c.TypeTag[T]].toString).splice) }
+ def impl[T: c.TypeTag](c: Context)(foo: c.Expr[T]): c.Expr[Unit] = c.universe.reify { println(c.literal(implicitly[c.TypeTag[T]].toString).splice) }
def foo[T](foo: T) = macro impl[T]
} \ No newline at end of file
diff --git a/test/files/run/reify-staticXXX.check b/test/files/run/reify-staticXXX.check
new file mode 100644
index 0000000000..5762ec47d6
--- /dev/null
+++ b/test/files/run/reify-staticXXX.check
@@ -0,0 +1,24 @@
+object
+object
+class
+class
+object > object
+object > object
+object > class
+object > class
+package > object
+package > object
+package > class
+package > class
+object
+object
+class
+class
+object > object
+object > object
+object > class
+object > class
+package > object
+package > object
+package > class
+package > class
diff --git a/test/files/run/reify-staticXXX.scala b/test/files/run/reify-staticXXX.scala
new file mode 100644
index 0000000000..dc861f843e
--- /dev/null
+++ b/test/files/run/reify-staticXXX.scala
@@ -0,0 +1,56 @@
+import scala.reflect.runtime.universe._
+import scala.tools.reflect.Eval
+
+object B { override def toString = "object" }
+class C { override def toString = "class" }
+
+package foo {
+ object B { override def toString = "package > object" }
+ class C { override def toString = "package > class" }
+}
+
+object foo {
+ object B { override def toString = "object > object" }
+ class C { override def toString = "object > class" }
+}
+
+object packageless {
+ def test = {
+ println(B)
+ println(reify(B).eval)
+ println(new C)
+ println(reify(new C).eval)
+ println(foo.B)
+ println(reify(foo.B).eval)
+ println(new foo.C)
+ println(reify(new foo.C).eval)
+ println(_root_.foo.B)
+ println(reify(_root_.foo.B).eval)
+ println(new _root_.foo.C)
+ println(reify(new _root_.foo.C).eval)
+ }
+}
+
+package packageful {
+ object Test {
+ def test = {
+ println(B)
+ println(reify(B).eval)
+ println(new C)
+ println(reify(new C).eval)
+ println(foo.B)
+ println(reify(foo.B).eval)
+ println(new foo.C)
+ println(reify(new foo.C).eval)
+ println(_root_.foo.B)
+ println(reify(_root_.foo.B).eval)
+ println(new _root_.foo.C)
+ println(reify(new _root_.foo.C).eval)
+ }
+ }
+}
+
+object Test extends App {
+ packageless.test
+ packageful.Test.test
+}
diff --git a/test/files/run/t5713/Impls_Macros_1.scala b/test/files/run/t5713/Impls_Macros_1.scala
index d16299a0c8..c041d36523 100644
--- a/test/files/run/t5713/Impls_Macros_1.scala
+++ b/test/files/run/t5713/Impls_Macros_1.scala
@@ -16,13 +16,13 @@ private object LoggerMacros {
type LoggerContext = Context { type PrefixType = Logger.type }
def error(c: LoggerContext)(message: c.Expr[String]): c.Expr[Unit] =
- log(c)(c.reify(Level.Error), message)
+ log(c)(c.universe.reify(Level.Error), message)
private def log(c: LoggerContext)(level: c.Expr[Level.Value], message: c.Expr[String]): c.Expr[Unit] =
// was: if (level.splice.id < 4) // TODO Remove hack!
if (c.eval(level).id < 4) // TODO Remove hack!
- c.reify(())
+ c.universe.reify(())
else {
- c.reify(println(message.splice))
+ c.universe.reify(println(message.splice))
}
} \ No newline at end of file
diff --git a/test/files/run/t6104.check b/test/files/run/t6104.check
new file mode 100644
index 0000000000..9766475a41
--- /dev/null
+++ b/test/files/run/t6104.check
@@ -0,0 +1 @@
+ok
diff --git a/test/files/run/t6104.scala b/test/files/run/t6104.scala
new file mode 100644
index 0000000000..8ab12c7752
--- /dev/null
+++ b/test/files/run/t6104.scala
@@ -0,0 +1,8 @@
+class A { Self =>
+ val ok = "ok"
+ this match {
+ case me@Self => println(me.ok)
+ }
+}
+
+object Test extends A with App \ No newline at end of file
diff --git a/test/files/run/toolbox_typecheck_macrosdisabled2.check b/test/files/run/toolbox_typecheck_macrosdisabled2.check
index 2e1e2696ab..53041e328d 100644
--- a/test/files/run/toolbox_typecheck_macrosdisabled2.check
+++ b/test/files/run/toolbox_typecheck_macrosdisabled2.check
@@ -15,7 +15,7 @@
private def applyImpl[U <: scala.reflect.api.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): scala.reflect.base.Universe#Tree = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.Apply.apply($u.Select.apply($u.Select.apply($u.build.Ident($m.staticModule("scala")), $u.newTermName("Array")), $u.newTermName("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2))))
+ $u.Apply.apply($u.Select.apply($u.Select.apply($u.build.Ident($m.staticPackage("scala")), $u.newTermName("Array")), $u.newTermName("apply")), scala.collection.immutable.List.apply[$u.Literal]($u.Literal.apply($u.Constant.apply(2))))
}
};
new $treecreator1()
@@ -28,7 +28,7 @@
def apply[U <: scala.reflect.base.Universe with Singleton]($m$untyped: scala.reflect.base.MirrorOf[U]): U#Type = {
val $u: U = $m$untyped.universe;
val $m: $u.Mirror = $m$untyped.asInstanceOf[$u.Mirror];
- $u.TypeRef.apply($u.ThisType.apply($m.staticModule("scala").asModuleSymbol.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asTypeSymbol.asTypeConstructor))
+ $u.TypeRef.apply($u.ThisType.apply($m.staticPackage("scala").asModuleSymbol.moduleClass), $m.staticClass("scala.Array"), scala.collection.immutable.List.apply[$u.Type]($m.staticClass("scala.Int").asTypeSymbol.asTypeConstructor))
}
};
new $typecreator2()
diff --git a/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala b/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala
index 1740f40daf..599ddf5ed9 100644
--- a/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala
+++ b/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala
@@ -1,7 +1,7 @@
import scala.reflect.makro.Context
object Impls {
- def foo[T: c.TypeTag](c: Context): c.Expr[List[T]] = c.reify {
+ def foo[T: c.TypeTag](c: Context): c.Expr[List[T]] = c.universe.reify {
println("openImplicits are: " + c.literal(c.openImplicits.toString).splice)
println("enclosingImplicits are: " + c.literal(c.enclosingImplicits.toString).splice)
println("typetag is: " + c.literal(c.tag[T].toString).splice)
diff --git a/test/pending/run/macro-reify-array/Macros_1.scala b/test/pending/run/macro-reify-array/Macros_1.scala
index c1bd4187a6..4b4cb05884 100644
--- a/test/pending/run/macro-reify-array/Macros_1.scala
+++ b/test/pending/run/macro-reify-array/Macros_1.scala
@@ -4,7 +4,7 @@ object Macros {
def foo[T](s: String) = macro Impls.foo[T]
object Impls {
- def foo[T: c.TypeTag](c: Ctx)(s: c.Expr[T]) = c.reify {
+ def foo[T: c.TypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify {
Array(s.splice)
}
}
diff --git a/test/pending/run/macro-reify-tagful-b/Macros_1.scala b/test/pending/run/macro-reify-tagful-b/Macros_1.scala
index 04cf46d3a5..f730bb51f1 100644
--- a/test/pending/run/macro-reify-tagful-b/Macros_1.scala
+++ b/test/pending/run/macro-reify-tagful-b/Macros_1.scala
@@ -4,7 +4,7 @@ object Macros {
def foo[T](s: T) = macro Impls.foo[List[T]]
object Impls {
- def foo[T: c.TypeTag](c: Ctx)(s: c.Expr[T]) = c.reify {
+ def foo[T: c.TypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify {
List(s.splice)
}
}
diff --git a/test/pending/run/macro-reify-tagless-b/Impls_Macros_1.scala b/test/pending/run/macro-reify-tagless-b/Impls_Macros_1.scala
index 04366353eb..2c5079ea54 100644
--- a/test/pending/run/macro-reify-tagless-b/Impls_Macros_1.scala
+++ b/test/pending/run/macro-reify-tagless-b/Impls_Macros_1.scala
@@ -4,7 +4,7 @@ object Macros {
def foo[T](s: T) = macro Impls.foo[List[T]]
object Impls {
- def foo[T](c: Ctx)(s: c.Expr[T]) = c.reify {
+ def foo[T](c: Ctx)(s: c.Expr[T]) = c.universe.reify {
List(s.splice)
}
}
diff --git a/test/pending/run/t5692/Impls_Macros_1.scala b/test/pending/run/t5692/Impls_Macros_1.scala
index f9c1e5f12b..7d0e788bd6 100644
--- a/test/pending/run/t5692/Impls_Macros_1.scala
+++ b/test/pending/run/t5692/Impls_Macros_1.scala
@@ -1,7 +1,7 @@
import scala.reflect.makro.Context
object Impls {
- def impl[A](c: reflect.makro.Context) = c.reify(())
+ def impl[A](c: reflect.makro.Context) = c.universe.reify(())
}
object Macros {
diff --git a/test/scaladoc/resources/SI-3314-diagrams.scala b/test/scaladoc/resources/SI-3314-diagrams.scala
new file mode 100644
index 0000000000..b80a97b522
--- /dev/null
+++ b/test/scaladoc/resources/SI-3314-diagrams.scala
@@ -0,0 +1,78 @@
+package scala.test.scaladoc {
+
+ /** Check the interaction between SI-3314 and diagrams
+ * - the three enumerations below should get valid content diagrams:
+ * Value
+ * __________/|\__________
+ * / / / | \ \ \
+ * Mon Tue Wed Thu Fri Sat Sun
+ *
+ * - each member should receive an inhertiance diagram:
+ * Value
+ * |
+ * |
+ * {Mon,Tue,Wed,Thu,Fri,Sat,Sun}
+ */
+ package diagrams {
+
+ /** @contentDiagram
+ * @inheritanceDiagram hideDiagram */
+ trait WeekDayTraitWithDiagram extends Enumeration {
+ type WeekDay = Value
+ /** @inheritanceDiagram */
+ object Mon extends WeekDay
+ /** @inheritanceDiagram */
+ object Tue extends WeekDay
+ /** @inheritanceDiagram */
+ object Wed extends WeekDay
+ /** @inheritanceDiagram */
+ object Thu extends WeekDay
+ /** @inheritanceDiagram */
+ object Fri extends WeekDay
+ /** @inheritanceDiagram */
+ object Sat extends WeekDay
+ /** @inheritanceDiagram */
+ object Sun extends WeekDay
+ }
+
+ /** @contentDiagram
+ * @inheritanceDiagram hideDiagram */
+ class WeekDayClassWithDiagram extends Enumeration {
+ type WeekDay = Value
+ /** @inheritanceDiagram */
+ object Mon extends WeekDay
+ /** @inheritanceDiagram */
+ object Tue extends WeekDay
+ /** @inheritanceDiagram */
+ object Wed extends WeekDay
+ /** @inheritanceDiagram */
+ object Thu extends WeekDay
+ /** @inheritanceDiagram */
+ object Fri extends WeekDay
+ /** @inheritanceDiagram */
+ object Sat extends WeekDay
+ /** @inheritanceDiagram */
+ object Sun extends WeekDay
+ }
+
+ /** @contentDiagram
+ * @inheritanceDiagram hideDiagram */
+ object WeekDayObjectWithDiagram extends Enumeration {
+ type WeekDay = Value
+ /** @inheritanceDiagram */
+ object Mon extends WeekDay
+ /** @inheritanceDiagram */
+ object Tue extends WeekDay
+ /** @inheritanceDiagram */
+ object Wed extends WeekDay
+ /** @inheritanceDiagram */
+ object Thu extends WeekDay
+ /** @inheritanceDiagram */
+ object Fri extends WeekDay
+ /** @inheritanceDiagram */
+ object Sat extends WeekDay
+ /** @inheritanceDiagram */
+ object Sun extends WeekDay
+ }
+ }
+} \ No newline at end of file
diff --git a/test/scaladoc/resources/SI-3314.scala b/test/scaladoc/resources/SI-3314.scala
new file mode 100644
index 0000000000..9e0afdce9d
--- /dev/null
+++ b/test/scaladoc/resources/SI-3314.scala
@@ -0,0 +1,85 @@
+package scala.test.scaladoc {
+
+ // testing inherited <documented> templates (Enum.Value is included in the source, thus is documented in scaladoc)
+ package test1 {
+ class Enum {
+ abstract class Value
+ class Val extends Value
+ def Value(): Value = new Val
+ }
+
+ object Constants extends Enum {
+ def a = Value
+ }
+ }
+
+ // testing inherited <not documented> templates (scala.Enumeration.Value is taken from the library, thus is not
+ // documented in the scaladoc pages -- but should be inherited to make things clear!)
+ package test2 {
+ trait WeekDayTrait extends Enumeration {
+ type WeekDay = Value
+ val Mon, Tue, Wed, Thu, Fri, Sat, Sun = Value
+ }
+
+ class WeekDayClass extends Enumeration {
+ type WeekDay = Value
+ val Mon, Tue, Wed, Thu, Fri, Sat, Sun = Value
+ }
+
+ object WeekDayObject extends Enumeration {
+ type WeekDay = Value
+ val Mon, Tue, Wed, Thu, Fri, Sat, Sun = Value
+ }
+
+ object UserObject {
+ def isWorkingDay1(d: scala.test.scaladoc.test2.WeekDayClass#Value) = false
+ def isWorkingDay2(d: scala.test.scaladoc.test2.WeekDayClass#WeekDay) = false
+ def isWorkingDay3(d: scala.test.scaladoc.test2.WeekDayTrait#Value) = false
+ def isWorkingDay4(d: scala.test.scaladoc.test2.WeekDayTrait#WeekDay) = false
+ def isWorkingDay5(d: scala.test.scaladoc.test2.WeekDayObject.Value) = false
+ def isWorkingDay6(d: scala.test.scaladoc.test2.WeekDayObject.WeekDay) = false
+ import WeekDayObject._
+ def isWorkingDay7(d: Value) = ! (d == Sat || d == Sun)
+ def isWorkingDay8(d: WeekDay) = ! (d == Sat || d == Sun)
+ def isWorkingDay9(d: WeekDayObject.Value) = ! (d == Sat || d == Sun)
+ }
+
+ class UserClass {
+ def isWorkingDay1(d: scala.test.scaladoc.test2.WeekDayClass#Value) = false
+ def isWorkingDay2(d: scala.test.scaladoc.test2.WeekDayClass#WeekDay) = false
+ def isWorkingDay3(d: scala.test.scaladoc.test2.WeekDayTrait#Value) = false
+ def isWorkingDay4(d: scala.test.scaladoc.test2.WeekDayTrait#WeekDay) = false
+ def isWorkingDay5(d: scala.test.scaladoc.test2.WeekDayObject.Value) = false
+ def isWorkingDay6(d: scala.test.scaladoc.test2.WeekDayObject.WeekDay) = false
+ import WeekDayObject._
+ def isWorkingDay7(d: Value) = ! (d == Sat || d == Sun)
+ def isWorkingDay8(d: WeekDay) = ! (d == Sat || d == Sun)
+ def isWorkingDay9(d: WeekDayObject.Value) = ! (d == Sat || d == Sun)
+ }
+
+ trait UserTrait {
+ def isWorkingDay1(d: scala.test.scaladoc.test2.WeekDayClass#Value) = false
+ def isWorkingDay2(d: scala.test.scaladoc.test2.WeekDayClass#WeekDay) = false
+ def isWorkingDay3(d: scala.test.scaladoc.test2.WeekDayTrait#Value) = false
+ def isWorkingDay4(d: scala.test.scaladoc.test2.WeekDayTrait#WeekDay) = false
+ def isWorkingDay5(d: scala.test.scaladoc.test2.WeekDayObject.Value) = false
+ def isWorkingDay6(d: scala.test.scaladoc.test2.WeekDayObject.WeekDay) = false
+ import WeekDayObject._
+ def isWorkingDay7(d: Value) = ! (d == Sat || d == Sun)
+ def isWorkingDay8(d: WeekDay) = ! (d == Sat || d == Sun)
+ def isWorkingDay9(d: WeekDayObject.Value) = ! (d == Sat || d == Sun)
+ }
+ }
+
+ // testing type lambdas and useless prefixes (should be referenced as T instead of foo.T in the first example)
+ package test3 {
+ import language.higherKinds
+ object `package` {
+ trait T
+ trait A
+ trait X
+ def foo[T](x: T) = 7
+ def bar[A](x: ({type Lambda[X] <: Either[A, X]})#Lambda[String]) = 5
+ }
+ }
+}
diff --git a/test/scaladoc/resources/SI-4360.scala b/test/scaladoc/resources/SI-4360.scala
new file mode 100644
index 0000000000..8e8b96afd5
--- /dev/null
+++ b/test/scaladoc/resources/SI-4360.scala
@@ -0,0 +1,42 @@
+package scala.test.scaladoc.prefix {
+ package pack1 {
+
+ class A {
+ class Z
+ }
+
+ class B extends A
+
+ package a {
+ class C
+ }
+
+ package b {
+ class C
+ }
+
+ package c {
+ class C
+
+ class L extends pack2.Z
+
+ class TEST {
+ // test inherited classes
+ def fooCA(x: pack1.A#Z) = 1
+ def fooCB(x: pack1.B#Z) = 1
+ def fooCS(x: pack2.Z#Z) = 1
+ def fooCL(x: L#Z) = 1
+ // test in packages
+ def fooPA(x: pack1.a.C) = 1
+ def fooPB(x: pack1.b.C) = 1
+ def fooPC(x: pack1.c.C) = 1
+ }
+
+ class A extends pack1.A
+ }
+ }
+
+ package pack2 {
+ class Z extends pack1.A
+ }
+} \ No newline at end of file
diff --git a/test/scaladoc/resources/SI-5558.scala b/test/scaladoc/resources/SI-5558.scala
new file mode 100644
index 0000000000..6523438b86
--- /dev/null
+++ b/test/scaladoc/resources/SI-5558.scala
@@ -0,0 +1,6 @@
+package test {
+ class T
+ object `package` {
+ def foo = ???
+ }
+}
diff --git a/test/scaladoc/resources/SI-5784.scala b/test/scaladoc/resources/SI-5784.scala
new file mode 100644
index 0000000000..3731d4998c
--- /dev/null
+++ b/test/scaladoc/resources/SI-5784.scala
@@ -0,0 +1,28 @@
+package test.templates {
+ object `package` {
+ /** @template */
+ type String = java.lang.String
+ val String = new StringCompanion
+ class StringCompanion { def boo = ??? }
+ }
+
+ /** @contentDiagram */
+ trait Base {
+ /** @documentable */
+ type String = test.templates.String
+ /** @template
+ * @inheritanceDiagram */
+ type T <: Foo
+ val T: FooExtractor
+ trait Foo { def foo: Int }
+ trait FooExtractor { def apply(foo: Int); def unapply(t: Foo): Option[Int] }
+ }
+
+ /** @contentDiagram */
+ trait Api extends Base {
+ /** @documentable
+ * @inheritanceDiagram */
+ override type T <: FooApi
+ trait FooApi extends Foo { def bar: String }
+ }
+}
diff --git a/test/scaladoc/resources/SI_4676.scala b/test/scaladoc/resources/SI_4676.scala
deleted file mode 100644
index 00c0fc7ea9..0000000000
--- a/test/scaladoc/resources/SI_4676.scala
+++ /dev/null
@@ -1,4 +0,0 @@
-class SI_4676 {
- type SS = (String,String)
- def x(ss: SS): Int = 3
-}
diff --git a/test/scaladoc/resources/Trac3484.scala b/test/scaladoc/resources/Trac3484.scala
deleted file mode 100644
index 9656ec268d..0000000000
--- a/test/scaladoc/resources/Trac3484.scala
+++ /dev/null
@@ -1,27 +0,0 @@
-class cbf[A, B, C]
-
-/**
- * @define Coll Traversable
- * @define bfreturn $Coll
- */
-class Collection[A] {
- /** What map does...
- *
- * $bfreturn
- * @usecase def map[B](f: A => B): $bfreturn[B]
- *
- */
- def map[B, That](f: A => B)(implicit fact: cbf[Collection[A], B, That]) =
- null
-}
-
-/**
- * @define b John
- * @define a Mister $b
- */
-class SR704 {
- /**
- * Hello $a.
- */
- def foo = 123
-}
diff --git a/test/scaladoc/resources/doc-root/AnyRef.scala b/test/scaladoc/resources/doc-root/AnyRef.scala
index 1eefb0c806..7d8b9f9e76 100644
--- a/test/scaladoc/resources/doc-root/AnyRef.scala
+++ b/test/scaladoc/resources/doc-root/AnyRef.scala
@@ -10,6 +10,7 @@ package scala
/** Class `AnyRef` is the root class of all ''reference types''.
* All types except the value types descend from this class.
+ * @template
*/
trait AnyRef extends Any {
diff --git a/test/scaladoc/resources/implicits-known-type-classes-res.scala b/test/scaladoc/resources/implicits-known-type-classes-res.scala
new file mode 100644
index 0000000000..9ad652947d
--- /dev/null
+++ b/test/scaladoc/resources/implicits-known-type-classes-res.scala
@@ -0,0 +1,38 @@
+/** Tests the "known type classes" feature of scaladoc implicits
+ * if the test fails, please update the correct qualified name of
+ * the type class in src/compiler/scala/tools/nsc/doc/Settings.scala
+ * in the knownTypeClasses map. Thank you! */
+package scala.test.scaladoc.implicits.typeclasses {
+ class A[T]
+ object A {
+ import language.implicitConversions
+ import scala.reflect.{ClassTag, TypeTag}
+ implicit def convertNumeric [T: Numeric] (a: A[T]) = new B(implicitly[Numeric[T]])
+ implicit def convertIntegral [T: Integral] (a: A[T]) = new B(implicitly[Integral[T]])
+ implicit def convertFractional [T: Fractional] (a: A[T]) = new B(implicitly[Fractional[T]])
+ implicit def convertManifest [T: Manifest] (a: A[T]) = new B(implicitly[Manifest[T]])
+ implicit def convertClassManifest [T: ClassManifest] (a: A[T]) = new B(implicitly[ClassManifest[T]])
+ implicit def convertOptManifest [T: OptManifest] (a: A[T]) = new B(implicitly[OptManifest[T]])
+ implicit def convertClassTag [T: ClassTag] (a: A[T]) = new B(implicitly[ClassTag[T]])
+ implicit def convertTypeTag [T: TypeTag] (a: A[T]) = new B(implicitly[TypeTag[T]])
+ type K[X] = Numeric[X]
+ type L[X] = Integral[X]
+ type M[X] = Fractional[X]
+ type N[X] = Manifest[X]
+ type O[X] = ClassManifest[X]
+ type P[X] = OptManifest[X]
+ type Q[X] = ClassTag[X]
+ type R[X] = TypeTag[X]
+ implicit def convertK [T: K] (a: A[T]) = new B(implicitly[K[T]])
+ implicit def convertL [T: L] (a: A[T]) = new B(implicitly[L[T]])
+ implicit def convertM [T: M] (a: A[T]) = new B(implicitly[M[T]])
+ implicit def convertN [T: N] (a: A[T]) = new B(implicitly[N[T]])
+ implicit def convertO [T: O] (a: A[T]) = new B(implicitly[O[T]])
+ implicit def convertP [T: P] (a: A[T]) = new B(implicitly[P[T]])
+ implicit def convertQ [T: Q] (a: A[T]) = new B(implicitly[Q[T]])
+ implicit def convertR [T: R] (a: A[T]) = new B(implicitly[R[T]])
+ }
+ class B[T](t: T) {
+ def typeClass: T = t
+ }
+} \ No newline at end of file
diff --git a/test/scaladoc/resources/implicits-scopes-res.scala b/test/scaladoc/resources/implicits-scopes-res.scala
index aaeb43f95b..c675a645bd 100644
--- a/test/scaladoc/resources/implicits-scopes-res.scala
+++ b/test/scaladoc/resources/implicits-scopes-res.scala
@@ -22,7 +22,7 @@ package test2 {
package classes {
class A
class B { def b = "" }
- object test { /* (new A).b won't compile */ }
+ object test { (new A).b }
}
}
diff --git a/test/scaladoc/resources/links.scala b/test/scaladoc/resources/links.scala
new file mode 100644
index 0000000000..679d0b0dce
--- /dev/null
+++ b/test/scaladoc/resources/links.scala
@@ -0,0 +1,57 @@
+// that would be:
+// SI-5079 "Scaladoc can't link to an object (only a class or trait)"
+// SI-4497 "Links in ScalaDoc - Spec and implementation unsufficient"
+// SI-4224 "Wiki-links should support method targets"
+// SI-3695 "support non-fully-qualified type links in scaladoc comments"
+package scala.test.scaladoc.links {
+ import language.higherKinds
+ class C
+
+ trait Target {
+ type T
+ type S = String
+ class C
+ def foo(i: Int) = 2
+ def foo(s: String) = 3
+ def foo[A[_]](x: A[String]) = 5
+ def foo[A[_[_]]](x: A[List]) = 6
+ val bar: Boolean
+ def baz(c: scala.test.scaladoc.links.C) = 7
+ }
+
+ object Target {
+ type T = Int => Int
+ type S = Int
+ class C
+ def foo(i: Int) = 2
+ def foo(z: String) = 3
+ def foo[A[_]](x: A[String]) = 5
+ def foo[A[_[_]]](x: A[List]) = 6
+ val bar: Boolean = false
+ val onlyInObject = 1
+ def baz(c: scala.test.scaladoc.links.C) = 7
+ }
+
+ /**
+ * Links to the trait:
+ * - [[scala.test.scaladoc.links.Target!.T trait Target -> type T]]
+ * - [[test.scaladoc.links.Target!.S trait Target -> type S]]
+ * - [[scaladoc.links.Target!.foo(Int)* trait Target -> def foo]]
+ * - [[links.Target!.bar trait Target -> def bar]]
+ * - [[[[Target!.foo[A[_[_]]]* trait Target -> def foo with 3 nested tparams]]]] (should exercise nested parens)
+ * - [[Target$.T object Target -> type T]]
+ * - [[Target$.S object Target -> type S]]
+ * - [[Target$.foo(Str* object Target -> def foo]]
+ * - [[Target$.bar object Target -> def bar]]
+ * - [[[[Target$.foo[A[_[_]]]* trait Target -> def foo with 3 nested tparams]]]] (should exercise nested parens)
+ * - [[Target.onlyInObject object Target -> def foo]] (should find the object)
+ * - [[Target$.C object Target -> class C]] (should link directly to C, not as a member)
+ * - [[Target!.C trait Target -> class C]] (should link directly to C, not as a member)
+ * - [[Target$.baz(links\.C)* object Target -> def baz]] (should use dots in prefix)
+ * - [[Target!.baz(links\.C)* trait Target -> def baz]] (should use dots in prefix)
+ * - [[localMethod object TEST -> localMethod]] (should use the current template to resolve link instead of inTpl, that's the package)
+ */
+ object TEST {
+ def localMethod = 3
+ }
+}
diff --git a/test/scaladoc/resources/package-object-res.scala b/test/scaladoc/resources/package-object-res.scala
index 17d5c0a499..f1f714dd1f 100644
--- a/test/scaladoc/resources/package-object-res.scala
+++ b/test/scaladoc/resources/package-object-res.scala
@@ -1,4 +1,4 @@
-/** This package have A and B.
+/** This package has A and B.
*/
package test {
trait A { def hi = "hello" }
diff --git a/test/scaladoc/run/SI-3314-diagrams.check b/test/scaladoc/run/SI-3314-diagrams.check
new file mode 100644
index 0000000000..619c56180b
--- /dev/null
+++ b/test/scaladoc/run/SI-3314-diagrams.check
@@ -0,0 +1 @@
+Done.
diff --git a/test/scaladoc/run/SI-3314-diagrams.scala b/test/scaladoc/run/SI-3314-diagrams.scala
new file mode 100644
index 0000000000..050c6e7f48
--- /dev/null
+++ b/test/scaladoc/run/SI-3314-diagrams.scala
@@ -0,0 +1,28 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+
+ override def resourceFile = "SI-3314-diagrams.scala"
+
+ // no need for special settings
+ def scaladocSettings = "-diagrams"
+
+ def testModel(rootPackage: Package) = {
+ // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s))
+ import access._
+
+ // just need to check the member exists, access methods will throw an error if there's a problem
+ val base = rootPackage._package("scala")._package("test")._package("scaladoc")
+
+ val diagrams = base._package("diagrams")
+ val templates = List(diagrams._trait("WeekDayTraitWithDiagram"), diagrams._class("WeekDayClassWithDiagram"), diagrams._object("WeekDayObjectWithDiagram"))
+
+ for (template <- templates) {
+ testDiagram(template, template.contentDiagram, 8, 7)
+ val subtemplates = List("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun").map(template._object(_))
+ for (subtemplate <- subtemplates)
+ testDiagram(subtemplate, subtemplate.inheritanceDiagram, 2, 1)
+ }
+ }
+} \ No newline at end of file
diff --git a/test/scaladoc/run/SI-3314.check b/test/scaladoc/run/SI-3314.check
new file mode 100644
index 0000000000..619c56180b
--- /dev/null
+++ b/test/scaladoc/run/SI-3314.check
@@ -0,0 +1 @@
+Done.
diff --git a/test/scaladoc/run/SI-3314.scala b/test/scaladoc/run/SI-3314.scala
new file mode 100644
index 0000000000..fe220b08af
--- /dev/null
+++ b/test/scaladoc/run/SI-3314.scala
@@ -0,0 +1,91 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+
+ override def resourceFile = "SI-3314.scala"
+
+ // no need for special settings
+ def scaladocSettings = "-feature"
+
+ def testModel(rootPackage: Package) = {
+ // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s))
+ import access._
+
+ // just need to check the member exists, access methods will throw an error if there's a problem
+ val base = rootPackage._package("scala")._package("test")._package("scaladoc")
+
+
+
+ // test1
+
+ val test1 = base._package("test1")
+ val test1Value = test1._class("Enum")._method("Value").resultType
+ assert(test1Value.name == "Value", test1Value.name + " == Value")
+ assert(test1Value.refEntity.size == 1, test1Value.refEntity.size + " == 1")
+
+ val test1Constants = test1._object("Constants")._method("a").resultType
+ assert(test1Constants.name == "Value", test1Constants.name + " == Value")
+ assert(test1Constants.refEntity.size == 1, test1Constants.refEntity.size + " == 1")
+ assert(test1Constants.refEntity(0)._1 == LinkToMember(test1._object("Constants")._class("Value"), test1._object("Constants")),
+ test1Constants.refEntity(0)._1 + " == LinkToMember(test1.Enum.Value)")
+
+
+ // test2
+
+ val test2 = base._package("test2")
+ def testDefinition(doc: DocTemplateEntity) = {
+ for (day <- List("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")) {
+ assert(doc._value(day).resultType.name == "Value",
+ doc._value(day).resultType.name + " == Value")
+ assert(doc._value(day).resultType.refEntity.size == 1,
+ doc._value(day).resultType.refEntity.size + " == 1")
+ assert(doc._value(day).resultType.refEntity(0)._1 == LinkToMember(doc._classMbr("Value"), doc),
+ doc._value(day).resultType.refEntity(0)._1 + " == LinkToMember(" + doc.qualifiedName + ".Value)")
+ }
+ }
+ testDefinition(test2._trait("WeekDayTrait"))
+ testDefinition(test2._class("WeekDayClass"))
+ testDefinition(test2._object("WeekDayObject"))
+
+ def testUsage(doc: DocTemplateEntity) = {
+ val ValueInClass = test2._class("WeekDayClass")._classMbr("Value")
+ val ValueInTrait = test2._trait("WeekDayTrait")._classMbr("Value")
+ val ValueInObject = test2._object("WeekDayObject")._classMbr("Value")
+ val WeekDayInObject = test2._object("WeekDayObject")._member("WeekDay")
+
+ val expected = List(
+ ("isWorkingDay1", "WeekDayClass.Value", ValueInClass),
+ ("isWorkingDay2", "WeekDayClass.Value", ValueInClass),
+ ("isWorkingDay3", "WeekDayTrait.Value", ValueInTrait),
+ ("isWorkingDay4", "WeekDayTrait.Value", ValueInTrait),
+ ("isWorkingDay5", "WeekDayObject.Value", ValueInObject),
+ ("isWorkingDay6", "WeekDay", WeekDayInObject),
+ ("isWorkingDay7", "WeekDayObject.Value", ValueInObject),
+ ("isWorkingDay8", "WeekDay", WeekDayInObject),
+ ("isWorkingDay9", "WeekDayObject.Value", ValueInObject))
+
+ for ((method, name, ref) <- expected) {
+ assert(doc._method(method).valueParams(0)(0).resultType.name == name,
+ doc._method(method).valueParams(0)(0).resultType.name + " == " + name + " (in " + doc + "." + method + ")")
+ assert(doc._method(method).valueParams(0)(0).resultType.refEntity.size == 1,
+ doc._method(method).valueParams(0)(0).resultType.refEntity.size + " == " + 1 + " (in " + doc + "." + method + ")")
+ assert(doc._method(method).valueParams(0)(0).resultType.refEntity(0)._1 == LinkToMember(ref, ref.inTemplate),
+ doc._method(method).valueParams(0)(0).resultType.refEntity(0)._1 + " == LinkToMember(" + ref.qualifiedName + ") (in " + doc + "." + method + ")")
+ }
+ }
+ testUsage(test2._object("UserObject"))
+ testUsage(test2._class("UserClass"))
+ testUsage(test2._trait("UserTrait"))
+
+
+ // test3
+ val test3 = base._package("test3")
+ val foo = test3._method("foo")
+ assert(foo.valueParams(0)(0).resultType.name == "T",
+ foo.valueParams(0)(0).resultType.name + " == T")
+ val bar = test3._method("bar")
+ assert(bar.valueParams(0)(0).resultType.name == "(AnyRef { type Lambda[X] <: Either[A,X] })#Lambda[String]",
+ bar.valueParams(0)(0).resultType.name + " == (AnyRef { type Lambda[X] <: Either[A,X] })#Lambda[String]")
+ }
+} \ No newline at end of file
diff --git a/test/scaladoc/run/SI-3448.check b/test/scaladoc/run/SI-3448.check
new file mode 100644
index 0000000000..619c56180b
--- /dev/null
+++ b/test/scaladoc/run/SI-3448.check
@@ -0,0 +1 @@
+Done.
diff --git a/test/scaladoc/run/SI-3448.scala b/test/scaladoc/run/SI-3448.scala
new file mode 100644
index 0000000000..a2d3f59596
--- /dev/null
+++ b/test/scaladoc/run/SI-3448.scala
@@ -0,0 +1,38 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+
+ // Working around the fact that usecases have the form Coll[T] and not Coll[T, U], as required by Map
+ override def code = """
+ /**
+ * @define Coll C[T]
+ */
+ class C[T] {
+ /**
+ * @usecase def foo[T]: $Coll[T]
+ */
+ def foo[T: Numeric]: C[T]
+ }
+
+
+ /**
+ * @define Coll D1[T]
+ */
+ class D[U, T] extends C[T] {
+ protected type D1[Z] = D[U, Z]
+ }
+ """
+
+ // no need for special settings
+ def scaladocSettings = ""
+
+ def testModel(rootPackage: Package) = {
+ // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s))
+ import access._
+
+ // just need to check the member exists, access methods will throw an error if there's a problem
+ assert(rootPackage._class("D")._method("foo").resultType.name == "D[U, T]",
+ rootPackage._class("D")._method("foo").resultType.name + " == D[U, T]")
+ }
+} \ No newline at end of file
diff --git a/test/scaladoc/run/SI-3484.check b/test/scaladoc/run/SI-3484.check
new file mode 100644
index 0000000000..619c56180b
--- /dev/null
+++ b/test/scaladoc/run/SI-3484.check
@@ -0,0 +1 @@
+Done.
diff --git a/test/scaladoc/run/SI-3484.scala b/test/scaladoc/run/SI-3484.scala
new file mode 100644
index 0000000000..297aebee8f
--- /dev/null
+++ b/test/scaladoc/run/SI-3484.scala
@@ -0,0 +1,52 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.nsc.doc.model.diagram._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+
+ override def code = """
+ class cbf[A, B, C]
+
+ /**
+ * @define Coll Collection
+ * @define bfreturn $Coll
+ */
+ class Collection[A] {
+ /** What map does...
+ *
+ * $bfreturn
+ * @usecase def map[B](f: A => B): $bfreturn[B]
+ *
+ */
+ def map[B, That](f: A => B)(implicit fact: cbf[Collection[A], B, That]) =
+ null
+ }
+
+ /**
+ * @define b John
+ * @define a Mister $b
+ */
+ class SR704 {
+ /**
+ * Hello $a.
+ */
+ def foo = 123
+ }
+ """
+
+ // diagrams must be started. In case there's an error with dot, it should not report anything
+ def scaladocSettings = ""
+
+ def testModel(rootPackage: Package) = {
+ // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s))
+ import access._
+
+ // check correct expansion of the use case signature
+ val map = rootPackage._class("Collection")._method("map")
+ assert(map.resultType.name == "Collection[B]", map.resultType.name + " == Traversable[B]")
+
+ val foo = rootPackage._class("SR704")._method("foo")
+ assert(extractCommentText(foo.comment.get).contains("Hello Mister John."),
+ extractCommentText(foo.comment.get) + ".contains(Hello Mister John.)")
+ }
+} \ No newline at end of file
diff --git a/test/scaladoc/run/SI-4324.check b/test/scaladoc/run/SI-4324.check
new file mode 100644
index 0000000000..619c56180b
--- /dev/null
+++ b/test/scaladoc/run/SI-4324.check
@@ -0,0 +1 @@
+Done.
diff --git a/test/scaladoc/run/SI-4324.scala b/test/scaladoc/run/SI-4324.scala
new file mode 100644
index 0000000000..686a133dc0
--- /dev/null
+++ b/test/scaladoc/run/SI-4324.scala
@@ -0,0 +1,24 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+
+ override def code = """
+ case class Test4324(arg11: String, arg12: Int)(arg21: String, arg22: Int)(arg31: Int, arg32: String)
+ """
+
+ // no need for special settings
+ def scaladocSettings = ""
+
+ def testModel(rootPackage: Package) = {
+ // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s))
+ import access._
+
+ // just need to check the member exists, access methods will throw an error if there's a problem
+ rootPackage._class("Test4324").asInstanceOf[Class].valueParams match {
+ case List(List(arg11, arg12), List(arg21, arg22), List(arg31, arg32)) => //yeeey, do nothing
+ case other =>
+ assert(false, "Incorrect valueParams generated: " + other + " instead of (arg11, arg12)(arg21, arg22)(arg31, arg32)")
+ }
+ }
+} \ No newline at end of file
diff --git a/test/scaladoc/run/SI-4360.check b/test/scaladoc/run/SI-4360.check
new file mode 100644
index 0000000000..619c56180b
--- /dev/null
+++ b/test/scaladoc/run/SI-4360.check
@@ -0,0 +1 @@
+Done.
diff --git a/test/scaladoc/run/SI-4360.scala b/test/scaladoc/run/SI-4360.scala
new file mode 100644
index 0000000000..3abc61c267
--- /dev/null
+++ b/test/scaladoc/run/SI-4360.scala
@@ -0,0 +1,48 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+
+ override def resourceFile = "SI-4360.scala"
+
+ // no need for special settings
+ def scaladocSettings = ""
+
+ def testModel(rootPackage: Package) = {
+ // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s))
+ import access._
+
+ // just need to check the member exists, access methods will throw an error if there's a problem
+ val base = rootPackage._package("scala")._package("test")._package("scaladoc")._package("prefix")
+
+ val TEST = base._package("pack1")._package("c")._class("TEST")
+ val fooCA = TEST._method("fooCA")
+ val fooCB = TEST._method("fooCB")
+ val fooCS = TEST._method("fooCS")
+ val fooCL = TEST._method("fooCL")
+ val fooPA = TEST._method("fooPA")
+ val fooPB = TEST._method("fooPB")
+ val fooPC = TEST._method("fooPC")
+
+ val expected = List(
+ (fooCA, "Z", 1),
+ (fooCB, "B.Z", 1),
+ (fooCS, "pack2.Z.Z", 1),
+ (fooCL, "L.Z", 1),
+ (fooPA, "a.C", 1),
+ (fooPB, "b.C", 1),
+ (fooPC, "C", 1)
+ )
+
+ for ((method, name, refs) <- expected) {
+ assert(method.valueParams(0)(0).resultType.name == name,
+ method.valueParams(0)(0).resultType.name + " == " + name + " (in " + method.qualifiedName + ")")
+ assert(method.valueParams(0)(0).resultType.refEntity.size == refs,
+ method.valueParams(0)(0).resultType.refEntity.size + " == " + refs + " (in " + method.qualifiedName + ")")
+ }
+
+ val A = base._package("pack1")._package("c")._class("A")
+ assert(A.linearizationTypes(0).name == "pack1.A", A.linearizationTypes(0).name + " == pack1.A")
+ assert(A.linearizationTypes(0).refEntity.size == 1, A.linearizationTypes(0).refEntity.size + " == 1")
+ }
+} \ No newline at end of file
diff --git a/test/scaladoc/run/SI-4676.check b/test/scaladoc/run/SI-4676.check
new file mode 100644
index 0000000000..619c56180b
--- /dev/null
+++ b/test/scaladoc/run/SI-4676.check
@@ -0,0 +1 @@
+Done.
diff --git a/test/scaladoc/run/SI-4676.scala b/test/scaladoc/run/SI-4676.scala
new file mode 100644
index 0000000000..b83a59a472
--- /dev/null
+++ b/test/scaladoc/run/SI-4676.scala
@@ -0,0 +1,26 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.nsc.doc.model.diagram._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+
+ override def code = """
+ class SI_4676 {
+ type SS = (String,String)
+ def x(ss: SS): Int = 3
+ }
+ class cbf[A, B, C]
+ """
+
+ // diagrams must be started. In case there's an error with dot, it should not report anything
+ def scaladocSettings = ""
+
+ def testModel(rootPackage: Package) = {
+ // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s))
+ import access._
+
+ // check correct expansion of the use case signature
+ val x = rootPackage._class("SI_4676")._method("x")
+ assert(x.valueParams(0)(0).resultType.name == "(String, String)", "parameter ss of method x has type (String, String")
+ }
+} \ No newline at end of file
diff --git a/test/scaladoc/run/SI-4887.check b/test/scaladoc/run/SI-4887.check
new file mode 100644
index 0000000000..619c56180b
--- /dev/null
+++ b/test/scaladoc/run/SI-4887.check
@@ -0,0 +1 @@
+Done.
diff --git a/test/scaladoc/run/SI-4887.scala b/test/scaladoc/run/SI-4887.scala
new file mode 100644
index 0000000000..af83344613
--- /dev/null
+++ b/test/scaladoc/run/SI-4887.scala
@@ -0,0 +1,46 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+
+ override def code = """
+ package scala.test.scaladoc.existentials {
+ import language.higherKinds
+ import language.existentials
+
+ class X[T, U, V]
+
+ trait TEST {
+ type T
+ type U
+ type A
+ def foo1(x: X[T, U, _]) = 3
+ def foo2(x: X[Z[_], U, z.type] forSome {type Z[_] <: { def z: String }; val z: Z[_ <: Int]}) = 4
+ def foo3(x: X[Z, Z, V] forSome { type Z <: T; type V <: T }) = 6
+ }
+ }
+ """
+
+ // no need for special settings
+ def scaladocSettings = "-feature"
+
+ def testModel(rootPackage: Package) = {
+ // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s))
+ import access._
+
+ val base = rootPackage._package("scala")._package("test")._package("scaladoc")._package("existentials")
+ val TEST = base._trait("TEST")
+
+ val foo1 = TEST._method("foo1")
+ assert(foo1.valueParams(0)(0).resultType.name == "X[T, U, _]",
+ foo1.valueParams(0)(0).resultType.name + " == X[T, U, _]")
+
+ val foo2 = TEST._method("foo2")
+ assert(foo2.valueParams(0)(0).resultType.name == "X[Z[_], U, _ <: [_]AnyRef { def z: String } with Singleton]",
+ foo2.valueParams(0)(0).resultType.name + " == X[Z[_], U, _ <: [_]AnyRef { def z: String } with Singleton]")
+
+ val foo3 = TEST._method("foo3")
+ assert(foo3.valueParams(0)(0).resultType.name == "X[Z, Z, V] forSome {type Z <: T, type V <: T}",
+ foo3.valueParams(0)(0).resultType.name + " == X[Z, Z, V] forSome {type Z <: T, type V <: T}")
+ }
+} \ No newline at end of file
diff --git a/test/scaladoc/run/SI-5235.check b/test/scaladoc/run/SI-5235.check
new file mode 100644
index 0000000000..d9acfd063b
--- /dev/null
+++ b/test/scaladoc/run/SI-5235.check
@@ -0,0 +1,4 @@
+newSource:10: warning: Could not find the type $Coll points to while expanding it for the usecase signature of method reverse in trait SpecificColl.In this context, $Coll = "BullSh".
+ * @usecase def reverse(): $Coll
+ ^
+Done.
diff --git a/test/scaladoc/run/SI-5235.scala b/test/scaladoc/run/SI-5235.scala
new file mode 100644
index 0000000000..6295fc7786
--- /dev/null
+++ b/test/scaladoc/run/SI-5235.scala
@@ -0,0 +1,87 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.nsc.doc.model.diagram._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+
+ override def code = """
+ package scala.test.scaladoc.SI5235 {
+ trait Builder[From, To]
+
+ /**
+ * @define Coll `GenericColl`
+ */
+ class GenericColl {
+ /**
+ * @usecase def reverse(): $Coll
+ * Returns the reversed $Coll.
+ */
+ def reverse[T](implicit something: Builder[GenericColl, T]): T
+ def foo1: GenericColl = ???
+ }
+
+ /** Nooo, don't point to this */
+ trait MyCollection
+
+ package specific {
+ /**
+ * @define Coll `BullSh`
+ */
+ trait SpecificColl extends GenericColl {
+ def foo2: SpecificColl = ???
+ }
+ }
+
+ package mycoll {
+ /**
+ * @define Coll `mycoll.MyCollection`
+ */
+ class MyCollection extends specific.SpecificColl {
+ def foo3: MyCollection = ???
+ }
+ }
+ }
+ """
+
+ // diagrams must be started. In case there's an error with dot, it should not report anything
+ def scaladocSettings = ""
+
+ def testModel(rootPackage: Package) = {
+ // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s))
+ import access._
+
+ val base = rootPackage._package("scala")._package("test")._package("scaladoc")._package("SI5235")
+
+ val GenericColl = base._class("GenericColl")
+ val SpecificColl = base._package("specific")._trait("SpecificColl")
+ val MyCollection = base._package("mycoll")._class("MyCollection")
+
+ // check comment text
+ val gcComment = extractCommentText(GenericColl._method("reverse").comment.get)
+ val scComment = extractCommentText(SpecificColl._method("reverse").comment.get)
+ val mcComment = extractCommentText(MyCollection._method("reverse").comment.get)
+ assert(gcComment.contains("Returns the reversed GenericColl."),
+ gcComment + ".contains(\"Returns the reversed GenericColl.\")")
+ assert(scComment.contains("Returns the reversed BullSh."),
+ scComment + ".contains(\"Returns the reversed BullSh.\")")
+ assert(mcComment.contains("Returns the reversed mycoll.MyCollection."),
+ mcComment + ".contains(\"Returns the reversed mycoll.MyCollection.\")")
+
+ // check signatures
+ val gcReverse = GenericColl._method("reverse")
+ val scReverse = SpecificColl._method("reverse")
+ val mcReverse = MyCollection._method("reverse")
+ val gcReverseType = gcReverse.resultType
+ val scReverseType = scReverse.resultType
+ val mcReverseType = mcReverse.resultType
+ assert(gcReverseType.name == "GenericColl", gcReverseType.name + " == GenericColl")
+ assert(scReverseType.name == "BullSh", scReverseType.name + " == BullSh")
+ assert(mcReverseType.name == "MyCollection",mcReverseType.name + " == MyCollection")
+ assert(gcReverseType.refEntity(0)._1 == LinkToTpl(GenericColl),
+ gcReverse.qualifiedName + "'s return type has a link to " + GenericColl.qualifiedName)
+ assert(scReverseType.refEntity(0)._1 == Tooltip("BullSh"),
+ scReverseType.refEntity(0)._1 + " == Tooltip(\"BullSh\")")
+ assert(mcReverseType.refEntity(0)._1 == LinkToTpl(MyCollection),
+ mcReverse.qualifiedName + "'s return type has a link to " + MyCollection.qualifiedName)
+ }
+} \ No newline at end of file
diff --git a/test/scaladoc/run/SI-5533.check b/test/scaladoc/run/SI-5533.check
new file mode 100644
index 0000000000..619c56180b
--- /dev/null
+++ b/test/scaladoc/run/SI-5533.check
@@ -0,0 +1 @@
+Done.
diff --git a/test/scaladoc/run/SI-5533.scala b/test/scaladoc/run/SI-5533.scala
new file mode 100644
index 0000000000..989d9aa13a
--- /dev/null
+++ b/test/scaladoc/run/SI-5533.scala
@@ -0,0 +1,39 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+
+ // Working around the fact that usecases have the form Coll[T] and not Coll[T, U], as required by Map
+ override def code = """
+ package a {
+ class A { class Z }
+ class C extends b.B { class X extends Y }
+ }
+
+ package b {
+ /** @contentDiagram */
+ class B extends a.A { class Y extends Z }
+ /** @contentDiagram */
+ class D extends a.C { class V extends X }
+ }
+ """
+
+ // no need for special settings
+ def scaladocSettings = "-diagrams -skip-packages a"
+
+ def testModel(rootPackage: Package) = {
+ // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s))
+ import access._
+
+ // just need to check the member exists, access methods will throw an error if there's a problem
+ assert(!rootPackage.templates.exists(_.name == "a"), "package a should not exist in the root package")
+ assert(rootPackage.templates.exists(_.name == "b"), "package b should exist in the root package")
+ val b = rootPackage._package("b")
+ val B = b._class("B")
+ val D = b._class("D")
+ testDiagram(B, B.contentDiagram, 2, 1)
+ // unfortunately not all packages, as B1 extends A.this.A1 and it gets the wrong member -- maybe we should model
+ // things as we do for symbols?
+ testDiagram(D, D.contentDiagram, 3, 2)
+ }
+} \ No newline at end of file
diff --git a/test/scaladoc/run/SI-5784.check b/test/scaladoc/run/SI-5784.check
new file mode 100644
index 0000000000..619c56180b
--- /dev/null
+++ b/test/scaladoc/run/SI-5784.check
@@ -0,0 +1 @@
+Done.
diff --git a/test/scaladoc/run/SI-5784.scala b/test/scaladoc/run/SI-5784.scala
new file mode 100644
index 0000000000..318eb78b2a
--- /dev/null
+++ b/test/scaladoc/run/SI-5784.scala
@@ -0,0 +1,44 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+
+ override def resourceFile: String = "SI-5784.scala"
+
+ // no need for special settings
+ def scaladocSettings = "-diagrams"
+
+ def testModel(rootPackage: Package) = {
+ // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s))
+ import access._
+
+ val main = rootPackage._package("test")._package("templates")
+
+ val String = main._aliasTypeTpl("String")
+ assert(String.companion.isDefined, "test.templates.String should have a pseudo-companion object")
+
+ val Base = main._trait("Base")
+ assert(Base.members.filter(_.inDefinitionTemplates.head == Base).length == 5, Base.members.filter(_.inDefinitionTemplates.head == Base).length + " == 5")
+ assert(Base.members.collect{case d: DocTemplateEntity => d}.length == 4, Base.members.collect{case d: DocTemplateEntity => d}.length == 4)
+ testDiagram(Base, Base.contentDiagram, 2, 1)
+
+ val BaseT = Base._absTypeTpl("T")
+ val Foo = Base._trait("Foo")
+ assert(BaseT.members.filter(_.inDefinitionTemplates.head == Base).length == 0, BaseT.members.filter(_.inDefinitionTemplates.head == Base).length + " == 0")
+ assert(BaseT.members.map(_.name).sorted == Foo.members.map(_.name).sorted, BaseT.members.map(_.name).sorted + " == " + Foo.members.map(_.name).sorted)
+ assert(BaseT.companion.isDefined, "test.templates.Base.T should have a pseudo-companion object")
+ testDiagram(BaseT, BaseT.inheritanceDiagram, 2, 1)
+
+ val Api = main._trait("Api")
+ assert(Api.members.filter(_.inDefinitionTemplates.head == Api).length == 2, Api.members.filter(_.inDefinitionTemplates.head == Api).length + " == 2") // FooApi and override type T
+ assert(Api.members.collect{case d: DocTemplateEntity => d}.length == 5, Api.members.collect{case d: DocTemplateEntity => d}.length == 5)
+ testDiagram(Api, Api.contentDiagram, 3, 2)
+
+ val ApiT = Api._absTypeTpl("T")
+ val FooApi = Api._trait("FooApi")
+ assert(ApiT.members.filter(_.inDefinitionTemplates.head == Api).length == 0, ApiT.members.filter(_.inDefinitionTemplates.head == Api).length + " == 0")
+ assert(ApiT.members.map(_.name).sorted == FooApi.members.map(_.name).sorted, ApiT.members.map(_.name).sorted + " == " + FooApi.members.map(_.name).sorted)
+ assert(ApiT.companion.isDefined, "test.templates.Api.T should have a pseudo-companion object")
+ testDiagram(ApiT, ApiT.inheritanceDiagram, 2, 1)
+ }
+} \ No newline at end of file
diff --git a/test/scaladoc/run/SI-5965.check b/test/scaladoc/run/SI-5965.check
new file mode 100644
index 0000000000..619c56180b
--- /dev/null
+++ b/test/scaladoc/run/SI-5965.check
@@ -0,0 +1 @@
+Done.
diff --git a/test/scaladoc/run/SI-5965.scala b/test/scaladoc/run/SI-5965.scala
new file mode 100644
index 0000000000..6f4540d239
--- /dev/null
+++ b/test/scaladoc/run/SI-5965.scala
@@ -0,0 +1,24 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+
+ override def code = """
+ abstract class Param
+ class Test
+ object Test {
+ def apply(i: Int): Test = new Test
+ def apply(i: Int, p: Param = new Param { }): Test = new Test
+ }
+ """
+
+ // no need for special settings
+ def scaladocSettings = ""
+
+ def testModel(rootPackage: Package) = {
+ import access._
+
+ // just need to make sure the model exists
+ val base = rootPackage._object("Test")
+ }
+} \ No newline at end of file
diff --git a/test/scaladoc/run/diagrams-base.scala b/test/scaladoc/run/diagrams-base.scala
index 38bed06502..b7aeed51d2 100644
--- a/test/scaladoc/run/diagrams-base.scala
+++ b/test/scaladoc/run/diagrams-base.scala
@@ -42,7 +42,7 @@ object Test extends ScaladocModelTest {
assert(diag.nodes.filter(_.isThisNode).length == 1)
// 1. check class E diagram
- assert(diag.isClassDiagram)
+ assert(diag.isInheritanceDiagram)
val (incoming, outgoing) = diag.edges.partition(!_._1.isThisNode)
assert(incoming.length == 5)
@@ -56,14 +56,14 @@ object Test extends ScaladocModelTest {
assert(incomingSubclass.length == 2)
assert(incomingImplicit.length == 3)
- val classDiag = diag.asInstanceOf[ClassDiagram]
+ val classDiag = diag.asInstanceOf[InheritanceDiagram]
assert(classDiag.incomingImplicits.length == 3)
assert(classDiag.outgoingImplicits.length == 1)
// 2. check package diagram
// NOTE: Z should be eliminated because it's isolated
val packDiag = base.contentDiagram.get
- assert(packDiag.isPackageDiagram)
+ assert(packDiag.isContentDiagram)
assert(packDiag.nodes.length == 8) // check singular object removal
assert(packDiag.edges.length == 4)
assert(packDiag.edges.foldLeft(0)(_ + _._2.length) == 6)
diff --git a/test/scaladoc/run/diagrams-determinism.scala b/test/scaladoc/run/diagrams-determinism.scala
index 6c8db05d78..2b6f8eecc7 100644
--- a/test/scaladoc/run/diagrams-determinism.scala
+++ b/test/scaladoc/run/diagrams-determinism.scala
@@ -49,19 +49,19 @@ object Test extends ScaladocModelTest {
assert(run2 == run3)
// 2. check the order in the diagram: this node, subclasses, and then implicit conversions
- def assertRightOrder(diagram: Diagram) = {
+ def assertRightOrder(template: DocTemplateEntity, diagram: Diagram) =
for ((node, subclasses) <- diagram.edges)
assert(subclasses == subclasses.filter(_.isThisNode) :::
- subclasses.filter(_.isNormalNode) :::
- subclasses.filter(_.isImplicitNode))
- }
+ subclasses.filter(node => node.isNormalNode || node.isOutsideNode) :::
+ subclasses.filter(_.isImplicitNode),
+ "Diagram order for " + template + ": " + subclasses)
val base = rootPackage._package("scala")._package("test")._package("scaladoc")._package("diagrams")
- assertRightOrder(base.contentDiagram.get)
- assertRightOrder(base._trait("A").inheritanceDiagram.get)
- assertRightOrder(base._trait("B").inheritanceDiagram.get)
- assertRightOrder(base._trait("C").inheritanceDiagram.get)
- assertRightOrder(base._trait("D").inheritanceDiagram.get)
- assertRightOrder(base._trait("E").inheritanceDiagram.get)
+ assertRightOrder(base, base.contentDiagram.get)
+ assertRightOrder(base._trait("A"), base._trait("A").inheritanceDiagram.get)
+ assertRightOrder(base._trait("B"), base._trait("B").inheritanceDiagram.get)
+ assertRightOrder(base._trait("C"), base._trait("C").inheritanceDiagram.get)
+ assertRightOrder(base._trait("D"), base._trait("D").inheritanceDiagram.get)
+ assertRightOrder(base._trait("E"), base._trait("E").inheritanceDiagram.get)
}
} \ No newline at end of file
diff --git a/test/scaladoc/run/diagrams-filtering.scala b/test/scaladoc/run/diagrams-filtering.scala
index 8cb32180a1..54e3e9ac63 100644
--- a/test/scaladoc/run/diagrams-filtering.scala
+++ b/test/scaladoc/run/diagrams-filtering.scala
@@ -65,7 +65,7 @@ object Test extends ScaladocModelTest {
assert(!C.inheritanceDiagram.isDefined)
// trait G
- val G = base._trait("G")
+ val G = base._class("G")
assert(!G.inheritanceDiagram.isDefined)
// trait E
diff --git a/test/scaladoc/run/groups.check b/test/scaladoc/run/groups.check
new file mode 100644
index 0000000000..619c56180b
--- /dev/null
+++ b/test/scaladoc/run/groups.check
@@ -0,0 +1 @@
+Done.
diff --git a/test/scaladoc/run/groups.scala b/test/scaladoc/run/groups.scala
new file mode 100644
index 0000000000..05324c2ec9
--- /dev/null
+++ b/test/scaladoc/run/groups.scala
@@ -0,0 +1,119 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+
+ override def code = """
+ package test.scaladoc.groups {
+
+ /**
+ * The trait A
+ * @groupdesc A Group A is the group that contains functions starting with f
+ * For example:
+ * {{{
+ * this is an example
+ * }}}
+ * @groupdesc B Group B is the group that contains functions starting with b
+ * @groupname B Group B has a nice new name and a high priority
+ * @groupprio B -10
+ * @group Traits
+ * @note This is a note
+ */
+ trait A {
+ /** foo description
+ * @group A */
+ def foo = 1
+
+ /** bar description
+ * @group B */
+ def bar = 2
+ }
+
+ /** The trait B
+ * @group Traits
+ * @groupdesc C Group C is introduced by B
+ */
+ trait B {
+ /** baz descriptopn
+ * @group C */
+ def baz = 3
+ }
+
+ /** The class C which inherits from both A and B
+ * @group Classes
+ * @groupdesc B Look ma, I'm overriding group descriptions!!!
+ * @groupname B And names
+ */
+ class C extends A with B {
+ /** Oh noes, I lost my group -- or did I?!? */
+ override def baz = 4
+ }
+ }
+ """
+
+ // no need for special settings
+ def scaladocSettings = "-feature"
+
+ def testModel(rootPackage: Package) = {
+ // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s))
+ import access._
+
+ // just need to check the member exists, access methods will throw an error if there's a problem
+ val base = rootPackage._package("test")._package("scaladoc")._package("groups")
+
+ def checkGroup(mbr: MemberEntity, grp: String) =
+ assert(mbr.group == grp, "Incorrect group for " + mbr.qualifiedName + ": " + mbr.group + " instead of " + grp)
+
+ def checkGroupDesc(dtpl: DocTemplateEntity, grp: String, grpDesc: String) = {
+ assert(dtpl.groupDescription(grp).isDefined,
+ "Group description for " + grp + " not defined in " + dtpl.qualifiedName)
+ assert(extractCommentText(dtpl.groupDescription(grp).get).contains(grpDesc),
+ "Group description for " + grp + " in " + dtpl.qualifiedName + " does not contain \"" + grpDesc + "\": \"" +
+ extractCommentText(dtpl.groupDescription(grp).get) + "\"")
+ }
+
+ def checkGroupName(dtpl: DocTemplateEntity, grp: String, grpName: String) =
+ // TODO: See why we need trim here, we already do trimming in the CommentFactory
+ assert(dtpl.groupName(grp) == grpName,
+ "Group name for " + grp + " in " + dtpl.qualifiedName + " does not equal \"" + grpName + "\": \"" + dtpl.groupName(grp) + "\"")
+
+ def checkGroupPrio(dtpl: DocTemplateEntity, grp: String, grpPrio: Int) =
+ assert(dtpl.groupPriority(grp) == grpPrio,
+ "Group priority for " + grp + " in " + dtpl.qualifiedName + " does not equal " + grpPrio + ": " + dtpl.groupPriority(grp))
+
+
+ val A = base._trait("A")
+ val B = base._trait("B")
+ val C = base._class("C")
+ checkGroup(A, "Traits")
+ checkGroup(B, "Traits")
+ checkGroup(C, "Classes")
+ checkGroup(A._method("foo"), "A")
+ checkGroup(A._method("bar"), "B")
+ checkGroup(B._method("baz"), "C")
+ checkGroup(C._method("foo"), "A")
+ checkGroup(C._method("bar"), "B")
+ checkGroup(C._method("baz"), "C")
+
+ checkGroupDesc(A, "A", "Group A is the group that contains functions starting with f")
+ checkGroupName(A, "A", "A")
+ checkGroupPrio(A, "A", 0)
+ checkGroupDesc(A, "B", "Group B is the group that contains functions starting with b")
+ checkGroupName(A, "B", "Group B has a nice new name and a high priority")
+ checkGroupPrio(A, "B", -10)
+
+ checkGroupDesc(B, "C", "Group C is introduced by B")
+ checkGroupName(B, "C", "C")
+ checkGroupPrio(B, "C", 0)
+
+ checkGroupDesc(C, "A", "Group A is the group that contains functions starting with f")
+ checkGroupName(C, "A", "A")
+ checkGroupPrio(C, "A", 0)
+ checkGroupDesc(C, "B", "Look ma, I'm overriding group descriptions!!!")
+ checkGroupName(C, "B", "And names")
+ checkGroupPrio(C, "B", -10)
+ checkGroupDesc(C, "C", "Group C is introduced by B")
+ checkGroupName(C, "C", "C")
+ checkGroupPrio(C, "C", 0)
+ }
+} \ No newline at end of file
diff --git a/test/scaladoc/run/implicits-ambiguating.scala b/test/scaladoc/run/implicits-ambiguating.scala
index 1420593b74..05daf1f805 100644
--- a/test/scaladoc/run/implicits-ambiguating.scala
+++ b/test/scaladoc/run/implicits-ambiguating.scala
@@ -17,7 +17,7 @@ object Test extends ScaladocModelTest {
mbr.byConversion.map(_.source.implicitsShadowing.get(mbr).map(_.isAmbiguous).getOrElse(false)).getOrElse(false)
// SEE THE test/resources/implicits-chaining-res.scala FOR THE EXPLANATION OF WHAT'S CHECKED HERE:
- val base = root._package("scala")._package("test")._package("scaladoc")._package("implicits")._object("ambiguating")
+ val base = root._package("scala")._package("test")._package("scaladoc")._package("implicits")._package("ambiguating")
var conv1: ImplicitConversion = null
var conv2: ImplicitConversion = null
diff --git a/test/scaladoc/run/implicits-known-type-classes.check b/test/scaladoc/run/implicits-known-type-classes.check
new file mode 100644
index 0000000000..619c56180b
--- /dev/null
+++ b/test/scaladoc/run/implicits-known-type-classes.check
@@ -0,0 +1 @@
+Done.
diff --git a/test/scaladoc/run/implicits-known-type-classes.scala b/test/scaladoc/run/implicits-known-type-classes.scala
new file mode 100644
index 0000000000..9f4ca372b0
--- /dev/null
+++ b/test/scaladoc/run/implicits-known-type-classes.scala
@@ -0,0 +1,33 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+import language._
+
+object Test extends ScaladocModelTest {
+
+ // test a file instead of a piece of code
+ override def resourceFile = "implicits-known-type-classes-res.scala"
+
+ // start implicits
+ def scaladocSettings = "-implicits"
+
+ def testModel(root: Package) = {
+ // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s))
+ import access._
+
+ /** Tests the "known type classes" feature of scaladoc implicits
+ * if the test fails, please update the correct qualified name of
+ * the type class in src/compiler/scala/tools/nsc/doc/Settings.scala
+ * in the knownTypeClasses map. Thank you! */
+
+ val base = root._package("scala")._package("test")._package("scaladoc")._package("implicits")._package("typeclasses")
+ var conv: ImplicitConversion = null
+
+ val A = base._class("A")
+
+ for (conversion <- A.conversions if !conversion.isCommonConversion) {
+ assert(conversion.constraints.length == 1, conversion.constraints.length + " == 1 (in " + conversion + ")")
+ assert(conversion.constraints.head.isInstanceOf[KnownTypeClassConstraint],
+ conversion.constraints.head + " is not a known type class constraint!")
+ }
+ }
+}
diff --git a/test/scaladoc/run/implicits-scopes.scala b/test/scaladoc/run/implicits-scopes.scala
index 7b9e80e148..d91deba326 100644
--- a/test/scaladoc/run/implicits-scopes.scala
+++ b/test/scaladoc/run/implicits-scopes.scala
@@ -24,7 +24,7 @@ object Test extends ScaladocModelTest {
val test1 = base._package("test1")
val A = test1._class("A")
- conv = A._conversion(test1.qualifiedName + ".package.toB") // the .package means it's the package object
+ conv = A._conversion(test1.qualifiedName + ".toB")
assert(conv.members.length == 1)
assert(conv.constraints.length == 0)
}
@@ -36,7 +36,9 @@ object Test extends ScaladocModelTest {
val classes = test2._package("classes")
val A = classes._class("A")
- assert(A._conversions(test2.qualifiedName + ".toB").isEmpty)
+ conv = A._conversion(test2.qualifiedName + ".toB")
+ assert(conv.members.length == 1)
+ assert(conv.constraints.length == 0)
}
//// test3 /////////////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/test/scaladoc/run/implicits-shadowing.scala b/test/scaladoc/run/implicits-shadowing.scala
index 2827d31122..6869b12a94 100644
--- a/test/scaladoc/run/implicits-shadowing.scala
+++ b/test/scaladoc/run/implicits-shadowing.scala
@@ -17,7 +17,7 @@ object Test extends ScaladocModelTest {
mbr.byConversion.map(_.source.implicitsShadowing.get(mbr).map(_.isShadowed).getOrElse(false)).getOrElse(false)
// SEE THE test/resources/implicits-chaining-res.scala FOR THE EXPLANATION OF WHAT'S CHECKED HERE:
- val base = root._package("scala")._package("test")._package("scaladoc")._package("implicits")._object("shadowing")
+ val base = root._package("scala")._package("test")._package("scaladoc")._package("implicits")._package("shadowing")
var conv: ImplicitConversion = null
//// class A ///////////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/test/scaladoc/run/implicits-var-exp.scala b/test/scaladoc/run/implicits-var-exp.scala
index 16569fe3c2..94d2990d29 100644
--- a/test/scaladoc/run/implicits-var-exp.scala
+++ b/test/scaladoc/run/implicits-var-exp.scala
@@ -6,25 +6,36 @@ object Test extends ScaladocModelTest {
override def code = """
package scala.test.scaladoc.variable.expansion {
- /**
- * Blah blah blah
- */
+ /** @define coll WROOOONG-A */
class A
object A {
import language.implicitConversions
- implicit def aToB(a: A) = new B
+ implicit def aToC(a: A) = new C
+ implicit def aToE(a: A) = new E with F
}
- /**
- * @define coll collection
- */
+ /** @define coll WROOOONG-B */
class B {
- /**
- * foo returns a $coll
- */
+ /** foo returns a $coll */
def foo: Nothing = ???
}
+
+ /** @define coll collection */
+ class C extends B
+
+ /** @define coll WROOOONG-D */
+ trait D {
+ /** bar returns a $coll */
+ def bar: Nothing = ???
+ }
+
+ /** @define coll result */
+ //trait E { self: D => override def bar: Nothing = ??? }
+ trait E extends D { override def bar: Nothing = ??? }
+
+ /** @define coll WROOOONG-F */
+ trait F
}
"""
@@ -37,7 +48,9 @@ object Test extends ScaladocModelTest {
val base = rootPackage._package("scala")._package("test")._package("scaladoc")._package("variable")._package("expansion")
val foo = base._class("A")._method("foo")
-
assert(foo.comment.get.body.toString.contains("foo returns a collection"), "\"" + foo.comment.get.body.toString + "\".contains(\"foo returns a collection\")")
+
+ val bar = base._class("A")._method("bar")
+ assert(bar.comment.get.body.toString.contains("bar returns a result"), "\"" + bar.comment.get.body.toString + "\".contains(\"bar returns a result\")")
}
} \ No newline at end of file
diff --git a/test/scaladoc/run/links.check b/test/scaladoc/run/links.check
new file mode 100644
index 0000000000..619c56180b
--- /dev/null
+++ b/test/scaladoc/run/links.check
@@ -0,0 +1 @@
+Done.
diff --git a/test/scaladoc/run/links.scala b/test/scaladoc/run/links.scala
new file mode 100644
index 0000000000..40ce6368ce
--- /dev/null
+++ b/test/scaladoc/run/links.scala
@@ -0,0 +1,28 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+// SI-5079 "Scaladoc can't link to an object (only a class or trait)"
+// SI-4497 "Links in ScalaDoc - Spec and implementation unsufficient"
+// SI-4224 "Wiki-links should support method targets"
+// SI-3695 "support non-fully-qualified type links in scaladoc comments"
+object Test extends ScaladocModelTest {
+
+ override def resourceFile = "links.scala"
+
+ // no need for special settings
+ def scaladocSettings = ""
+
+ def testModel(rootPackage: Package) = {
+ // get the quick access implicit defs in scope (_package(s), _class(es), _trait(s), object(s) _method(s), _value(s))
+ import access._
+
+ // just need to check the member exists, access methods will throw an error if there's a problem
+ val base = rootPackage._package("scala")._package("test")._package("scaladoc")._package("links")
+ val TEST = base._object("TEST")
+
+ val memberLinks = countLinks(TEST.comment.get, _.link.isInstanceOf[LinkToMember])
+ val templateLinks = countLinks(TEST.comment.get, _.link.isInstanceOf[LinkToTpl])
+ assert(memberLinks == 14, memberLinks + " == 14 (the member links in object TEST)")
+ assert(templateLinks == 2, templateLinks + " == 2 (the template links in object TEST)")
+ }
+} \ No newline at end of file
diff --git a/test/scaladoc/scalacheck/CommentFactoryTest.scala b/test/scaladoc/scalacheck/CommentFactoryTest.scala
index b576ba5544..5e3141bdc0 100644
--- a/test/scaladoc/scalacheck/CommentFactoryTest.scala
+++ b/test/scaladoc/scalacheck/CommentFactoryTest.scala
@@ -10,7 +10,13 @@ import scala.tools.nsc.doc.model.diagram._
class Factory(val g: Global, val s: doc.Settings)
extends doc.model.ModelFactory(g, s) {
- thisFactory: Factory with ModelFactoryImplicitSupport with DiagramFactory with CommentFactory with doc.model.TreeFactory =>
+ thisFactory: Factory
+ with ModelFactoryImplicitSupport
+ with ModelFactoryTypeSupport
+ with DiagramFactory
+ with CommentFactory
+ with doc.model.TreeFactory
+ with MemberLookup =>
def strip(c: Comment): Option[Inline] = {
c.body match {
@@ -31,7 +37,13 @@ object Test extends Properties("CommentFactory") {
val settings = new doc.Settings((str: String) => {})
val reporter = new scala.tools.nsc.reporters.ConsoleReporter(settings)
val g = new Global(settings, reporter)
- (new Factory(g, settings) with ModelFactoryImplicitSupport with DiagramFactory with CommentFactory with doc.model.TreeFactory)
+ (new Factory(g, settings)
+ with ModelFactoryImplicitSupport
+ with ModelFactoryTypeSupport
+ with DiagramFactory
+ with CommentFactory
+ with doc.model.TreeFactory
+ with MemberLookup)
}
def parse(src: String, dst: Inline) = {
diff --git a/test/scaladoc/scalacheck/HtmlFactoryTest.scala b/test/scaladoc/scalacheck/HtmlFactoryTest.scala
index 5b6f75426e..13eacf79a5 100644
--- a/test/scaladoc/scalacheck/HtmlFactoryTest.scala
+++ b/test/scaladoc/scalacheck/HtmlFactoryTest.scala
@@ -235,30 +235,6 @@ object Test extends Properties("HtmlFactory") {
}
}
- property("Trac #3484") = {
- val files = createTemplates("Trac3484.scala")
-
- files("Collection.html") match {
- case node: scala.xml.Node => {
- val s = node.toString
- s.contains("""<span class="result">: Traversable[B]</span>""")
- }
- case _ => false
- }
- }
-
- property("Trac #3484 - SR704") = {
- val files = createTemplates("Trac3484.scala")
-
- files("SR704.html") match {
- case node: scala.xml.Node => {
- val s = node.toString
- s.contains("Hello Mister John.")
- }
- case _ => false
- }
- }
-
property("Trac #4325 - files") = {
val files = createTemplates("Trac4325.scala")
@@ -303,7 +279,7 @@ object Test extends Properties("HtmlFactory") {
case _ => false
}
}
- //
+ //
// property("Trac #484 - refinements and existentials") = {
// val files = createTemplates("Trac484.scala")
// val lines = """
@@ -315,7 +291,7 @@ object Test extends Properties("HtmlFactory") {
// |def j(x: Int): Bar
// |def k(): AnyRef { type Dingus <: T forSome { type T <: String } }
// """.stripMargin.trim.lines map (_.trim)
- //
+ //
// files("RefinementAndExistentials.html") match {
// case node: scala.xml.Node => {
// val s = node.text.replaceAll("\\s+", " ")
@@ -397,26 +373,17 @@ object Test extends Properties("HtmlFactory") {
}
}
- property("Should decode symbolic type alias name.") = {
+ property("SI-4714: Should decode symbolic type alias name.") = {
createTemplate("SI_4715.scala") match {
case node: scala.xml.Node => {
val html = node.toString
- html.contains(">: :+:[<")
- }
- case _ => false
- }
- }
-
- property("Shouldn't drop type arguments to aliased tuple.") = {
- createTemplate("SI_4676.scala") match {
- case node: scala.xml.Node => {
- node.toString.contains(">ss: (String, String)<")
+ html.contains(">:+:<")
}
case _ => false
}
}
- property("Default arguments of synthesized constructor") = {
+ property("SI-4287: Default arguments of synthesized constructor") = {
val files = createTemplates("SI_4287.scala")
files("ClassWithSugar.html") match {
@@ -427,7 +394,7 @@ object Test extends Properties("HtmlFactory") {
}
}
- property("Default arguments of synthesized constructor") = {
+ property("SI-4507: Default arguments of synthesized constructor") = {
createTemplate("SI_4507.scala") match {
case node: scala.xml.Node =>
! node.toString.contains("<li>returns silently when evaluating true and true</li>")
@@ -435,40 +402,40 @@ object Test extends Properties("HtmlFactory") {
}
}
- property("Use cases and links should not crash scaladoc") = {
+ property("SI-4898: Use cases and links should not crash scaladoc") = {
createTemplate("SI_4898.scala")
true
}
- property("Use cases should override their original members") =
+ property("SI-5054: Use cases should override their original members") =
checkText("SI_5054_q1.scala")(
(None,"""def test(): Int""", true)
//Disabled because the full signature is now displayed
//(None,"""def test(implicit lost: Int): Int""", false)
)
- property("Use cases should keep their flags - final should not be lost") =
+ property("SI-5054: Use cases should keep their flags - final should not be lost") =
checkText("SI_5054_q2.scala")((None, """final def test(): Int""", true))
- property("Use cases should keep their flags - implicit should not be lost") =
+ property("SI-5054: Use cases should keep their flags - implicit should not be lost") =
checkText("SI_5054_q3.scala")((None, """implicit def test(): Int""", true))
- property("Use cases should keep their flags - real abstract should not be lost") =
+ property("SI-5054: Use cases should keep their flags - real abstract should not be lost") =
checkText("SI_5054_q4.scala")((None, """abstract def test(): Int""", true))
- property("Use cases should keep their flags - traits should not be affected") =
+ property("SI-5054: Use cases should keep their flags - traits should not be affected") =
checkText("SI_5054_q5.scala")((None, """def test(): Int""", true))
- property("Use cases should keep their flags - traits should not be affected") =
+ property("SI-5054: Use cases should keep their flags - traits should not be affected") =
checkText("SI_5054_q6.scala")((None, """abstract def test(): Int""", true))
- property("Use case individual signature test") =
+ property("SI-5054: Use case individual signature test") =
checkText("SI_5054_q7.scala")(
(None, """abstract def test2(explicit: Int): Int [use case] This takes the explicit value passed.""", true),
(None, """abstract def test1(): Int [use case] This takes the implicit value in scope.""", true)
)
- property("Display correct \"Definition classes\"") =
+ property("SI-5287: Display correct \"Definition classes\"") =
checkText("SI_5287.scala")(
(None,
"""def method(): Int
@@ -477,7 +444,7 @@ object Test extends Properties("HtmlFactory") {
Definition Classes SI_5287 SI_5287_B SI_5287_A""", true)
) // the explanation appears twice, as small comment and full comment
- property("Correct comment inheritance for overriding") =
+ property("Comment inheritance: Correct comment inheritance for overriding") =
checkText("implicit-inheritance-override.scala")(
(Some("Base"),
"""def function[T](arg1: T, arg2: String): Double
@@ -521,7 +488,7 @@ object Test extends Properties("HtmlFactory") {
)
for (useCaseFile <- List("UseCaseInheritance", "UseCaseOverrideInheritance")) {
- property("Correct comment inheritance for usecases") =
+ property("Comment inheritance: Correct comment inheritance for usecases") =
checkText("implicit-inheritance-usecase.scala")(
(Some(useCaseFile),
"""def missing_arg[T](arg1: T): Double
@@ -588,7 +555,7 @@ object Test extends Properties("HtmlFactory") {
)
}
- property("Correct explicit inheritance for override") =
+ property("Comment inheritance: Correct explicit inheritance for override") =
checkText("explicit-inheritance-override.scala")(
(Some("InheritDocDerived"),
"""def function[T](arg1: T, arg2: String): Double
@@ -614,7 +581,7 @@ object Test extends Properties("HtmlFactory") {
See also StartSee The Manual EndSee
""", true))
- property("Correct explicit inheritance for usecase") =
+ property("Comment inheritance: Correct explicit inheritance for usecase") =
checkText("explicit-inheritance-usecase.scala")(
(Some("UseCaseInheritDoc"),
"""def function[T](arg1: T, arg2: String): Double
@@ -639,7 +606,7 @@ object Test extends Properties("HtmlFactory") {
See also StartSee The Manual EndSee
""", true))
- property("Correct explicit inheritance in corner cases") =
+ property("Comment inheritance: Correct explicit inheritance in corner cases") =
checkText("inheritdoc-corner-cases.scala")(
(Some("D"),
"""def hello1: Int
diff --git a/test/scaladoc/scalacheck/IndexTest.scala b/test/scaladoc/scalacheck/IndexTest.scala
index 29e337da2b..bf385898fc 100644
--- a/test/scaladoc/scalacheck/IndexTest.scala
+++ b/test/scaladoc/scalacheck/IndexTest.scala
@@ -16,7 +16,7 @@ object Test extends Properties("Index") {
val morepaths = Thread.currentThread.getContextClassLoader.getParent.asInstanceOf[URLClassLoader].getURLs.map(u => URLDecoder.decode(u.getPath))
(paths ++ morepaths).mkString(java.io.File.pathSeparator)
}
-
+
val docFactory = {
val settings = new doc.Settings({Console.err.println(_)})
@@ -27,9 +27,9 @@ object Test extends Properties("Index") {
new doc.DocFactory(reporter, settings)
}
-
+
val indexModelFactory = doc.model.IndexModelFactory
-
+
def createIndex(path: String): Option[Index] = {
val maybeUniverse = {
@@ -79,4 +79,11 @@ object Test extends Properties("Index") {
case None => false
}
}
+ property("package objects in index") = {
+ createIndex("test/scaladoc/resources/SI-5558.scala") match {
+ case Some(index) =>
+ index.index.firstLetterIndex('f') isDefinedAt "foo"
+ case None => false
+ }
+ }
}