diff options
author | Paul Phillips <paulp@improving.org> | 2012-10-31 07:15:01 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-10-31 07:54:24 -0700 |
commit | 202a949afeb4877318432ffff8e3ffdc14df9615 (patch) | |
tree | 4021376fcbcfe5d8bc5066ec6d9039fdd2097f88 /test/scaladoc/run/SI-191.scala | |
parent | b480d991072e6e68ed46574d87e4483da778ff0e (diff) | |
parent | 8aec78470637f42f50981f8034215a709602dbad (diff) | |
download | scala-202a949afeb4877318432ffff8e3ffdc14df9615.tar.gz scala-202a949afeb4877318432ffff8e3ffdc14df9615.tar.bz2 scala-202a949afeb4877318432ffff8e3ffdc14df9615.zip |
Merge branch 'merge-2.10.0-wip' into merge-2.10.x
* merge-2.10.0-wip:
Use Typed rather than .setType
Wider use and a new variant of typedPos.
SI-6575 Plug inference leak of AbstractPartialFun
Remove compiler phases that don't influence scaladoc generation.
Disabled generation of _1, _2, etc. methods.
SI-6526 Additional test case.
Fix SI-6552, regression with self types.
avoid single-art assert where harmful in duration-tck
Fix for SI-6537, inaccurate unchecked warning.
Crash on missing accessor (internal bug in the lazy vals implementation) instead of trying to recover from the bug
Incorporated changes suggested in code review
Added one more test for SI-6358
Closes SI-6358. Move accessor generation for lazy vals to typers.
SI-6526 Tail call elimination should descend deeper.
Remove unneeded calls to substring()
Changes Tree and Type members from vals to defs.
Scaladoc knows the package structure of the libraries, so don't include them in external documentation setting.
Fixes SI-6170: issue with dragging scaladoc splitter over central iframe
Added a Swing ColorChooser wrapper
Added a Swing PopupMenu wrapper
Conflicts:
src/compiler/scala/reflect/reify/phases/Reshape.scala
src/compiler/scala/tools/nsc/typechecker/Duplicators.scala
src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSTransform.scala
src/reflect/scala/reflect/internal/Types.scala
test/files/neg/unchecked-knowable.check
Diffstat (limited to 'test/scaladoc/run/SI-191.scala')
-rwxr-xr-x | test/scaladoc/run/SI-191.scala | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/test/scaladoc/run/SI-191.scala b/test/scaladoc/run/SI-191.scala new file mode 100755 index 0000000000..0fb28145c3 --- /dev/null +++ b/test/scaladoc/run/SI-191.scala @@ -0,0 +1,76 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.nsc.doc.model.comment._ +import scala.tools.partest.ScaladocModelTest +import java.net.{URI, URL} +import java.io.File + +object Test extends ScaladocModelTest { + + override def code = + """ + /** See: + * - [[scala.collection.Map]] Simple linking + * - [[scala.collection.immutable.::]] Linking with symbolic name + * - [[scala.Int]].toLong Linking to a class + * - [[scala.Predef]] Linking to an object + * - [[scala.Int.toLong]] Linking to a method + * - [[scala]] Linking to a package + * - [[scala.AbstractMethodError]] Linking to a member in the package object + * - [[scala.Predef.String]] Linking to a member in an object + * + * Don't look at: + * - [[scala.NoLink]] Not linking :) + */ + object Test { + def foo(param: Any) {} + def barr(l: scala.collection.immutable.List[Any]) {} + def bar(l: List[String]) {} // TODO: Should be able to link to type aliases + def baz(d: java.util.Date) {} // Should not be resolved + } + """ + + def scalaURL = "http://bog.us" + + override def scaladocSettings = { + val scalaLibUri = getClass.getClassLoader.getResource("scala/Function1.class").toURI.getSchemeSpecificPart.split("!")(0) + val scalaLib = new File(new URL(scalaLibUri).getPath).getPath + val extArg = new URI("file", scalaLib, scalaURL).toString + "-no-link-warnings -doc-external-uris " + extArg + } + + def testModel(rootPackage: Package) { + import access._ + val test = rootPackage._object("Test") + + def check(memberDef: Def, expected: Int) { + val externals = memberDef.valueParams(0)(0).resultType.refEntity collect { + case (_, (LinkToExternal(name, url), _)) => assert(url.contains(scalaURL)); name + } + assert(externals.size == expected) + } + + check(test._method("foo"), 1) + check(test._method("bar"), 0) + check(test._method("barr"), 2) + check(test._method("baz"), 0) + + val expectedUrls = collection.mutable.Set[String]( + "scala.collection.Map", + "scala.collection.immutable.::", + "scala.Int", + "scala.Predef$", + "scala.Int@toLong:Long", + "scala.package", + "scala.package@AbstractMethodError=AbstractMethodError", + "scala.Predef$@String=String" + ).map(scalaURL + "/index.html#" + _) + + def isExpectedExternalLink(l: EntityLink) = l.link match { + case LinkToExternal(name, url) => assert(expectedUrls contains url, url); true + case _ => false + } + + assert(countLinks(test.comment.get, isExpectedExternalLink) == 8, + countLinks(test.comment.get, isExpectedExternalLink) + " == 8") + } +} |