diff options
author | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-10-16 10:59:52 -0700 |
---|---|---|
committer | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-10-16 10:59:52 -0700 |
commit | 87c5895d4bae62f1b5bacbd145f2e0fddcccf423 (patch) | |
tree | 2c5c23a6e6299d667856920857492c7f3ed59e45 /test | |
parent | b9aff6d5e419d3d77681b953036586d59eda1d7b (diff) | |
parent | 5b87e21b7ae100b6a217be3aed1aa1f9a6c404ce (diff) | |
download | scala-87c5895d4bae62f1b5bacbd145f2e0fddcccf423.tar.gz scala-87c5895d4bae62f1b5bacbd145f2e0fddcccf423.tar.bz2 scala-87c5895d4bae62f1b5bacbd145f2e0fddcccf423.zip |
Merge pull request #1505 from paulp/merge-210-wip-210
Merge 2.10.0-wip into 2.10.x.
Diffstat (limited to 'test')
30 files changed, 323 insertions, 108 deletions
diff --git a/test/files/neg/classmanifests_new_deprecations.check b/test/files/neg/classmanifests_new_deprecations.check index e10308a66f..12428c7626 100644 --- a/test/files/neg/classmanifests_new_deprecations.check +++ b/test/files/neg/classmanifests_new_deprecations.check @@ -28,34 +28,4 @@ classmanifests_new_deprecations.scala:10: error: type ClassManifest in object Pr classmanifests_new_deprecations.scala:15: error: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead type RCM[T] = scala.reflect.ClassManifest[T] ^ -classmanifests_new_deprecations.scala:20: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - def m1[T: Manifest] = ??? - ^ -classmanifests_new_deprecations.scala:21: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - def m2[T](implicit evidence$1: Manifest[T]) = ??? - ^ -classmanifests_new_deprecations.scala:22: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - val m3: Manifest[Int] = null - ^ -classmanifests_new_deprecations.scala:22: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - val m3: Manifest[Int] = null - ^ -classmanifests_new_deprecations.scala:24: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - def rm1[T: scala.reflect.Manifest] = ??? - ^ -classmanifests_new_deprecations.scala:25: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - def rm2[T](implicit evidence$1: scala.reflect.Manifest[T]) = ??? - ^ -classmanifests_new_deprecations.scala:26: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - val rm3: scala.reflect.Manifest[Int] = null - ^ -classmanifests_new_deprecations.scala:26: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - val rm3: scala.reflect.Manifest[Int] = null - ^ -classmanifests_new_deprecations.scala:28: error: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - type M[T] = Manifest[T] - ^ -classmanifests_new_deprecations.scala:33: error: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - type RM[T] = scala.reflect.Manifest[T] - ^ -20 errors found +10 errors found diff --git a/test/files/neg/t3692-old.check b/test/files/neg/t3692-old.check index 950f82951c..9f3ae516aa 100644 --- a/test/files/neg/t3692-old.check +++ b/test/files/neg/t3692-old.check @@ -7,14 +7,8 @@ t3692-old.scala:14: warning: non-variable type argument Int in type pattern Map[ t3692-old.scala:15: warning: non-variable type argument Int in type pattern Map[T,Int] is unchecked since it is eliminated by erasure case m2: Map[T, Int] => new java.util.HashMap[T, Integer] ^ -t3692-old.scala:11: warning: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = { - ^ -t3692-old.scala:11: warning: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead - private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = { - ^ t3692-old.scala:15: error: unreachable code case m2: Map[T, Int] => new java.util.HashMap[T, Integer] ^ -5 warnings found +three warnings found one error found diff --git a/test/files/neg/t6483.check b/test/files/neg/t6483.check new file mode 100644 index 0000000000..66e3507107 --- /dev/null +++ b/test/files/neg/t6483.check @@ -0,0 +1,9 @@ +t6483.scala:7: error: implementation restriction: qualified super reference is not allowed in value class +This restriction is planned to be removed in subsequent releases. + override def foo = super[T].foo // error + ^ +t6483.scala:20: error: implementation restriction: nested class is not allowed in value class +This restriction is planned to be removed in subsequent releases. + class Inner extends T { + ^ +two errors found diff --git a/test/files/neg/t6483.scala b/test/files/neg/t6483.scala new file mode 100644 index 0000000000..bd99f68fa4 --- /dev/null +++ b/test/files/neg/t6483.scala @@ -0,0 +1,24 @@ +trait T extends Any { + def foo = 1 + type X +} + +class C1(val a: Any) extends AnyVal with T { + override def foo = super[T].foo // error +} + +class C2(val a: Int) extends AnyVal with T { + override def foo = super.foo + a // okay +} + +class C3(val a: Int) extends AnyVal with T { + override def foo = C3.super.foo + a // okay +} + +class C4(val a: Int) extends AnyVal with T { + def foo { + class Inner extends T { + override def foo = super[T].foo + a // no (direct) error, other than that a nested class is currently illegal. + } + } +} diff --git a/test/files/pos/t6215.scala b/test/files/pos/t6215.scala new file mode 100644 index 0000000000..2f66892b69 --- /dev/null +++ b/test/files/pos/t6215.scala @@ -0,0 +1 @@ +class Foo(val v: String) extends AnyVal { private def len = v.length ; def f = len } diff --git a/test/files/pos/t6485a/Macros_1.scala b/test/files/pos/t6485a/Macros_1.scala new file mode 100644 index 0000000000..85c2d5dbdb --- /dev/null +++ b/test/files/pos/t6485a/Macros_1.scala @@ -0,0 +1,5 @@ +import scala.reflect.macros.Context + +object Macros { + def crash(c: Context): c.Expr[Unit] = c.universe.reify(()) +}
\ No newline at end of file diff --git a/test/files/pos/t6485a/Test_2.scala b/test/files/pos/t6485a/Test_2.scala new file mode 100644 index 0000000000..54e260ac74 --- /dev/null +++ b/test/files/pos/t6485a/Test_2.scala @@ -0,0 +1,5 @@ +import scala.language.experimental.macros + +final class Ops[T](val x: T) extends AnyVal { + def f = macro Macros.crash +} diff --git a/test/files/pos/t6485b/Test.scala b/test/files/pos/t6485b/Test.scala new file mode 100644 index 0000000000..382df1c453 --- /dev/null +++ b/test/files/pos/t6485b/Test.scala @@ -0,0 +1,10 @@ +import scala.language.experimental.macros +import scala.reflect.macros.Context + +final class Ops[T](val x: T) extends AnyVal { + def f = macro Macros.crash +} + +object Macros { + def crash(c: Context): c.Expr[Unit] = c.universe.reify(()) +}
\ No newline at end of file diff --git a/test/files/pos/t6499.scala b/test/files/pos/t6499.scala new file mode 100644 index 0000000000..db376572ee --- /dev/null +++ b/test/files/pos/t6499.scala @@ -0,0 +1,3 @@ +object Test { + Map(): Map[_, Int] with Map[_, Int] +} diff --git a/test/files/presentation/forgotten-ask.scala b/test/files/presentation/forgotten-ask.scala new file mode 100644 index 0000000000..358dd75e98 --- /dev/null +++ b/test/files/presentation/forgotten-ask.scala @@ -0,0 +1,33 @@ +import scala.tools.nsc.interactive._ +import tests._ + +/** Test that no ask calls are left unanswered after a compiler has shut down. */ +object Test extends InteractiveTest { + import compiler._ + + def askItem(): Response[Unit] = { + compiler.askForResponse { () => + Thread.sleep(100) + } + } + + final val Timeout = 5000 //ms + + override def main(args: Array[String]) { + val item1 = askItem() + + compiler.askShutdown() + + Thread.sleep(1000) // wait a bit, the compiler is shutting down + val item2 = askItem() + + item1.get(Timeout) match { + case None => println("TIMEOUT") + case _ => + } + item2.get(Timeout) match { + case None => println("TIMEOUT") + case _ => + } + } +}
\ No newline at end of file diff --git a/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala b/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala index 089f30f389..adecfcff17 100644 --- a/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala +++ b/test/files/run/macro-reflective-mamd-normal-mi/Macros_Test_2.scala @@ -11,7 +11,7 @@ object Test extends App { val macrobody = Select(Ident(newTermName("Impls")), newTermName("foo")) val macroparam = ValDef(NoMods, newTermName("x"), TypeTree(definitions.IntClass.toType), EmptyTree) val macrodef = DefDef(Modifiers(MACRO), newTermName("foo"), Nil, List(List(macroparam)), TypeTree(), macrobody) - val modulector = DefDef(NoMods, nme.CONSTRUCTOR, Nil, List(List()), TypeTree(), Block(Apply(Select(Super(This(EmptyTypeName), EmptyTypeName), nme.CONSTRUCTOR), List()))) + val modulector = DefDef(NoMods, nme.CONSTRUCTOR, Nil, List(List()), TypeTree(), Block(Apply(Select(Super(This(tpnme.EMPTY), tpnme.EMPTY), nme.CONSTRUCTOR), List()))) val module = ModuleDef(NoMods, newTermName("Macros"), Template(Nil, emptyValDef, List(modulector, macrodef))) val macroapp = Apply(Select(Ident("Macros"), newTermName("foo")), List(Literal(Constant(42)))) val tree = Block(macrodef, module, macroapp) diff --git a/test/files/run/macro-typecheck-implicitsdisabled.check b/test/files/run/macro-typecheck-implicitsdisabled.check index 6cf25076a7..c4fa2c5c28 100644 --- a/test/files/run/macro-typecheck-implicitsdisabled.check +++ b/test/files/run/macro-typecheck-implicitsdisabled.check @@ -1,2 +1,2 @@ scala.this.Predef.any2ArrowAssoc[Int](1).->[Int](2) -scala.reflect.internal.Types$TypeError: value -> is not a member of Int +scala.reflect.macros.TypecheckException: value -> is not a member of Int diff --git a/test/files/run/manifests-undeprecated-in-2.10.0.flags b/test/files/run/manifests-undeprecated-in-2.10.0.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/run/manifests-undeprecated-in-2.10.0.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/run/manifests-undeprecated-in-2.10.0.scala b/test/files/run/manifests-undeprecated-in-2.10.0.scala new file mode 100644 index 0000000000..82e90b3a89 --- /dev/null +++ b/test/files/run/manifests-undeprecated-in-2.10.0.scala @@ -0,0 +1,15 @@ +object Test extends App { + def m1a: scala.reflect.Manifest[Int] = scala.reflect.Manifest.Int + def m2a: scala.reflect.OptManifest[Int] = ??? + def m3a = scala.reflect.NoManifest + + def m1b: Manifest[Int] = Manifest.Int + def m2b: OptManifest[Int] = ??? + def m3b = NoManifest + + val m4a = manifest[Int] + val m5a = optManifest[Int] + + val m4b = implicitly[Manifest[Int]] + val m5b = implicitly[OptManifest[Int]] +}
\ No newline at end of file diff --git a/test/files/run/reflection-implicit.scala b/test/files/run/reflection-implicit.scala index 637ef24e14..0bcb0bc3a0 100644 --- a/test/files/run/reflection-implicit.scala +++ b/test/files/run/reflection-implicit.scala @@ -9,7 +9,7 @@ class C { object Test extends App { val decls = typeOf[C].typeSymbol.typeSignature.declarations.sorted.toList.filter(sym => !sym.isTerm || (sym.isMethod && !sym.asMethod.isConstructor)) println(decls map (_.isImplicit)) - val param = decls.find(_.name.toString == "d").get.asMethod.params.last.head + val param = decls.find(_.name.toString == "d").get.asMethod.paramss.last.head param.typeSignature println(param.isImplicit) }
\ No newline at end of file diff --git a/test/files/run/reflection-magicsymbols-invoke.scala b/test/files/run/reflection-magicsymbols-invoke.scala index b38d1be7b2..5f39370708 100644 --- a/test/files/run/reflection-magicsymbols-invoke.scala +++ b/test/files/run/reflection-magicsymbols-invoke.scala @@ -2,6 +2,12 @@ import scala.reflect.runtime.universe._ import scala.reflect.runtime.universe.definitions._ import scala.reflect.runtime.{currentMirror => cm} +package scala { + object ExceptionUtils { + def unwrapThrowable(ex: Throwable): Throwable = scala.reflect.runtime.ReflectionUtils.unwrapThrowable(ex) + } +} + object Test extends App { def key(sym: Symbol) = sym + ": " + sym.typeSignature def test(tpe: Type, receiver: Any, method: String, args: Any*) { @@ -13,7 +19,7 @@ object Test extends App { println(result) } catch { case ex: Throwable => - val realex = scala.reflect.runtime.ReflectionUtils.unwrapThrowable(ex) + val realex = scala.ExceptionUtils.unwrapThrowable(ex) println(realex.getClass + ": " + realex.getMessage) } print(s"testing ${tpe.typeSymbol.name}.$method: ") diff --git a/test/files/run/reflection-methodsymbol-params.scala b/test/files/run/reflection-methodsymbol-params.scala index 7174c6f49b..45b1f9628f 100644 --- a/test/files/run/reflection-methodsymbol-params.scala +++ b/test/files/run/reflection-methodsymbol-params.scala @@ -13,12 +13,12 @@ class C { } object Test extends App { - println(typeOf[C].member(newTermName("x1")).asMethod.params) - println(typeOf[C].member(newTermName("x2")).asMethod.params) - println(typeOf[C].member(newTermName("x3")).asMethod.params) - println(typeOf[C].member(newTermName("x4")).asMethod.params) - println(typeOf[C].member(newTermName("y1")).asMethod.params) - println(typeOf[C].member(newTermName("y2")).asMethod.params) - println(typeOf[C].member(newTermName("y3")).asMethod.params) - println(typeOf[C].member(newTermName("y4")).asMethod.params) + println(typeOf[C].member(newTermName("x1")).asMethod.paramss) + println(typeOf[C].member(newTermName("x2")).asMethod.paramss) + println(typeOf[C].member(newTermName("x3")).asMethod.paramss) + println(typeOf[C].member(newTermName("x4")).asMethod.paramss) + println(typeOf[C].member(newTermName("y1")).asMethod.paramss) + println(typeOf[C].member(newTermName("y2")).asMethod.paramss) + println(typeOf[C].member(newTermName("y3")).asMethod.paramss) + println(typeOf[C].member(newTermName("y4")).asMethod.paramss) }
\ No newline at end of file diff --git a/test/files/run/reflection-valueclasses-magic.scala b/test/files/run/reflection-valueclasses-magic.scala index f9feb2d504..c4a26e460a 100644 --- a/test/files/run/reflection-valueclasses-magic.scala +++ b/test/files/run/reflection-valueclasses-magic.scala @@ -3,11 +3,17 @@ import scala.reflect.runtime.universe.definitions._ import scala.reflect.runtime.{currentMirror => cm} import scala.reflect.ClassTag +package scala { + object ExceptionUtils { + def unwrapThrowable(ex: Throwable): Throwable = scala.reflect.runtime.ReflectionUtils.unwrapThrowable(ex) + } +} + object Test extends App { def key(sym: Symbol) = { sym match { // initialize parameter symbols - case meth: MethodSymbol => meth.params.flatten.map(_.typeSignature) + case meth: MethodSymbol => meth.paramss.flatten.map(_.typeSignature) } sym + ": " + sym.typeSignature } @@ -35,14 +41,14 @@ object Test extends App { println(s"[${result.getClass}] =======> $result") } catch { case ex: Throwable => - val realex = scala.reflect.runtime.ReflectionUtils.unwrapThrowable(ex) + val realex = scala.ExceptionUtils.unwrapThrowable(ex) println(realex.getClass + ": " + realex.getMessage) } val meth = tpe.declaration(newTermName(method).encodedName.toTermName) val testees = if (meth.isMethod) List(meth.asMethod) else meth.asTerm.alternatives.map(_.asMethod) testees foreach (testee => { - val convertedArgs = args.zipWithIndex.map { case (arg, i) => convert(arg, testee.params.flatten.apply(i).typeSignature) } - print(s"testing ${tpe.typeSymbol.name}.$method(${testee.params.flatten.map(_.typeSignature).mkString(','.toString)}) with receiver = $receiver and args = ${convertedArgs.map(arg => arg + ' '.toString + arg.getClass).toList}: ") + val convertedArgs = args.zipWithIndex.map { case (arg, i) => convert(arg, testee.paramss.flatten.apply(i).typeSignature) } + print(s"testing ${tpe.typeSymbol.name}.$method(${testee.paramss.flatten.map(_.typeSignature).mkString(','.toString)}) with receiver = $receiver and args = ${convertedArgs.map(arg => arg + ' '.toString + arg.getClass).toList}: ") wrap(cm.reflect(receiver).reflectMethod(testee)(convertedArgs: _*)) }) } diff --git a/test/files/run/t6344.check b/test/files/run/t6344.check index 5ac04d0320..8d9adac849 100644 --- a/test/files/run/t6344.check +++ b/test/files/run/t6344.check @@ -101,14 +101,14 @@ public int ValueInt.x() public int ValueInt.x() public java.lang.Object ValueInt.x() public java.lang.Object ValueInt.x() -public static Gen ValueInt.extension$plus(int,Gen,Gen) -public static Gen<java.lang.Object> ValueInt.extension$plus(int,Gen<java.lang.Object>,Gen<java.lang.Object>) -public static boolean ValueInt.extension$equals(int,java.lang.Object) -public static boolean ValueInt.extension$equals(int,java.lang.Object) -public static int ValueInt.extension$hashCode(int) -public static int ValueInt.extension$hashCode(int) -public static int ValueInt.extension$iplus(int,int,int) -public static int ValueInt.extension$iplus(int,int,int) +public static Gen ValueInt.plus$extension(int,Gen,Gen) +public static Gen<java.lang.Object> ValueInt.plus$extension(int,Gen<java.lang.Object>,Gen<java.lang.Object>) +public static boolean ValueInt.equals$extension(int,java.lang.Object) +public static boolean ValueInt.equals$extension(int,java.lang.Object) +public static int ValueInt.hashCode$extension(int) +public static int ValueInt.hashCode$extension(int) +public static int ValueInt.iplus$extension(int,int,int) +public static int ValueInt.iplus$extension(int,int,int) RefInt public Gen RefInt.plus(Gen,Gen) diff --git a/test/files/run/t6440.check b/test/files/run/t6440.check new file mode 100644 index 0000000000..b5684daee4 --- /dev/null +++ b/test/files/run/t6440.check @@ -0,0 +1 @@ +Stream((), ?) diff --git a/test/files/run/t6440.scala b/test/files/run/t6440.scala new file mode 100644 index 0000000000..2b690f31e1 --- /dev/null +++ b/test/files/run/t6440.scala @@ -0,0 +1,7 @@ +object Test { + + def main(args: Array[String]): Unit = { + println(Stream.continually(()).filterNot(_ => false).take(2)) + } + +} diff --git a/test/scaladoc/resources/SI-6509.scala b/test/scaladoc/resources/SI-6509.scala new file mode 100644 index 0000000000..540ba243bd --- /dev/null +++ b/test/scaladoc/resources/SI-6509.scala @@ -0,0 +1,24 @@ +package test.scaladoc.template.owners + +trait X { + /** @template */ + type Symbol >: Null <: SymbolApi + + /** @template */ + type TypeSymbol >: Null <: Symbol with TypeSymbolApi + + /** @template */ + type TermSymbol >: Null <: Symbol with TermSymbolApi + + /** @template */ + type MethodSymbol >: Null <: TermSymbol with MethodSymbolApi + + trait SymbolApi { this: Symbol => def x: Int} + trait TermSymbolApi extends SymbolApi { this: TermSymbol => def y: Int} + trait TypeSymbolApi extends SymbolApi { this: TypeSymbol => def z: Int} + trait MethodSymbolApi extends TermSymbolApi { this: MethodSymbol => def t: Int } +} + +trait Y extends X +trait Z extends Y +trait T extends Z diff --git a/test/scaladoc/resources/SI-6511.scala b/test/scaladoc/resources/SI-6511.scala new file mode 100644 index 0000000000..1f153caeb0 --- /dev/null +++ b/test/scaladoc/resources/SI-6511.scala @@ -0,0 +1,24 @@ +package test.scaladoc.template.diagrams + +/** @contentDiagram hideNodes "*Api" */ +trait X { + /** @template */ + type Symbol >: Null <: SymbolApi + + /** @template */ + type TypeSymbol >: Null <: Symbol with TypeSymbolApi + + /** @template */ + type TermSymbol >: Null <: Symbol with TermSymbolApi + + /** @template */ + type MethodSymbol >: Null <: TermSymbol with MethodSymbolApi + + trait SymbolApi { this: Symbol => def x: Int} + trait TermSymbolApi extends SymbolApi { this: TermSymbol => def y: Int} + trait TypeSymbolApi extends SymbolApi { this: TypeSymbol => def z: Int} + trait MethodSymbolApi extends TermSymbolApi { this: MethodSymbol => def t: Int } +} + +/** @contentDiagram hideNodes "*Api" */ +trait Y extends X diff --git a/test/scaladoc/resources/links.scala b/test/scaladoc/resources/links.scala index 09a52a4334..bd69665357 100644 --- a/test/scaladoc/resources/links.scala +++ b/test/scaladoc/resources/links.scala @@ -3,6 +3,9 @@ // 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" +// SI-6487 "Scaladoc can't link to inner classes" +// SI-6495 "Scaladoc won't pick up group name, priority and description from owner chain" +// SI-6501 "Scaladoc won't link to a @template type T as a template but as a member" package scala.test.scaladoc.links { import language.higherKinds class C @@ -54,9 +57,18 @@ package scala.test.scaladoc.links { * - [[localMethod object TEST -> localMethod]] (should use the current template to resolve link instead of inTpl, that's the package) * - [[#localMethod object TEST -> localMethod]] (should exercise Java-style links to empty members) * - [[ImOutside class ImOutside (check correct lookup in EmptyPackage)]] + * - [[ImOutside.Inner#foo class ImOutside#class Inner#method foo (check correct lookup in EmptyPackage)]] + * - [[ImOutside.T class ImOutside#type T (check correct linking to templates)]] + * - [[ImOutside.T#foo class ImOutside#type T#method foo (check correct interaction between @template and links)]] */ object TEST { def localMethod = 3 } } -class ImOutside
\ No newline at end of file +trait ImOutside { + /** @template */ + type T <: Inner + class Inner { + def foo: Any + } +} diff --git a/test/scaladoc/run/SI-6509.check b/test/scaladoc/run/SI-6509.check new file mode 100644 index 0000000000..3925a0d464 --- /dev/null +++ b/test/scaladoc/run/SI-6509.check @@ -0,0 +1 @@ +Done.
\ No newline at end of file diff --git a/test/scaladoc/run/SI-6509.scala b/test/scaladoc/run/SI-6509.scala new file mode 100644 index 0000000000..3857949d14 --- /dev/null +++ b/test/scaladoc/run/SI-6509.scala @@ -0,0 +1,30 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + + override def resourceFile: String = "SI-6509.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._ + + val main = rootPackage._package("test")._package("scaladoc")._package("template")._package("owners") + val X = main._trait("X") + val Y = main._trait("Y") + val Z = main._trait("Z") + val T = main._trait("T") + + def checkTemplateOwner(d: DocTemplateEntity) = + for (mbr <- List("Symbol", "TypeSymbol", "TermSymbol", "MethodSymbol")) { + val tpl = d._absTypeTpl(mbr).inTemplate + assert(tpl == X, tpl + " == X") + } + + for (tpl <- List(X, Y, Z, T)) + checkTemplateOwner(tpl) + } +}
\ No newline at end of file diff --git a/test/scaladoc/run/SI-6511.check b/test/scaladoc/run/SI-6511.check new file mode 100644 index 0000000000..3925a0d464 --- /dev/null +++ b/test/scaladoc/run/SI-6511.check @@ -0,0 +1 @@ +Done.
\ No newline at end of file diff --git a/test/scaladoc/run/SI-6511.scala b/test/scaladoc/run/SI-6511.scala new file mode 100644 index 0000000000..cc950a98d6 --- /dev/null +++ b/test/scaladoc/run/SI-6511.scala @@ -0,0 +1,22 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + + override def resourceFile: String = "SI-6511.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("scaladoc")._package("template")._package("diagrams") + val X = main._trait("X") + val Y = main._trait("Y") + + testDiagram(X, X.contentDiagram, nodes = 4, edges = 3) + testDiagram(Y, Y.contentDiagram, nodes = 4, edges = 3) + } +}
\ No newline at end of file diff --git a/test/scaladoc/run/groups.scala b/test/scaladoc/run/groups.scala index 05324c2ec9..c9e4a8679b 100644 --- a/test/scaladoc/run/groups.scala +++ b/test/scaladoc/run/groups.scala @@ -4,49 +4,54 @@ 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 + package test.scaladoc { + + /** @groupname Z From owner chain */ + package object `groups` + + package 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 + } } } """ @@ -101,10 +106,12 @@ object Test extends ScaladocModelTest { 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) + checkGroupName(A, "Z", "From owner chain") checkGroupDesc(B, "C", "Group C is introduced by B") checkGroupName(B, "C", "C") checkGroupPrio(B, "C", 0) + checkGroupName(B, "Z", "From owner chain") checkGroupDesc(C, "A", "Group A is the group that contains functions starting with f") checkGroupName(C, "A", "A") @@ -115,5 +122,6 @@ object Test extends ScaladocModelTest { checkGroupDesc(C, "C", "Group C is introduced by B") checkGroupName(C, "C", "C") checkGroupPrio(C, "C", 0) + checkGroupName(C, "Z", "From owner chain") } }
\ No newline at end of file diff --git a/test/scaladoc/run/links.scala b/test/scaladoc/run/links.scala index de359539cf..0c67857e1c 100644 --- a/test/scaladoc/run/links.scala +++ b/test/scaladoc/run/links.scala @@ -5,6 +5,9 @@ import scala.tools.partest.ScaladocModelTest // 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" +// SI-6487 "Scaladoc can't link to inner classes" +// SI-6495 "Scaladoc won't pick up group name, priority and description from owner chain" +// SI-6501 "Scaladoc won't link to a @template type T as a template but as a member" object Test extends ScaladocModelTest { override def resourceFile = "links.scala" @@ -22,7 +25,7 @@ object Test extends ScaladocModelTest { val memberLinks = countLinks(TEST.comment.get, _.link.isInstanceOf[LinkToMember]) val templateLinks = countLinks(TEST.comment.get, _.link.isInstanceOf[LinkToTpl]) - assert(memberLinks == 15, memberLinks + " == 15 (the member links in object TEST)") - assert(templateLinks == 5, templateLinks + " == 5 (the template links in object TEST)") + assert(memberLinks == 17, memberLinks + " == 17 (the member links in object TEST)") + assert(templateLinks == 6, templateLinks + " == 6 (the template links in object TEST)") } }
\ No newline at end of file |