diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-09-26 12:05:47 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-09-26 12:05:47 +0200 |
commit | c11d98822e86b23b7c31429433fbb15cf94792c8 (patch) | |
tree | 13320a4863bef1a09107cbfa95173c3076ee5d55 /test/scaladoc/run/t7876b.scala | |
parent | 001132d842f0d1962a0264307610aa805de4d338 (diff) | |
download | scala-c11d98822e86b23b7c31429433fbb15cf94792c8.tar.gz scala-c11d98822e86b23b7c31429433fbb15cf94792c8.tar.bz2 scala-c11d98822e86b23b7c31429433fbb15cf94792c8.zip |
SI-7876 Less dealiasing in Scaladoc's type printing.
Scaladoc renders tuple and function types with the syntactic sugar.
To do so, it was using `isFunctionType` and `isTupleType`. Internally,
these methods dealias, so one can't simply take the type arguments
from the given type to get the element types of the tuple.
In ac96200c92, a Scaladoc crasher in this area was resolved by
normalizing a type before extracting Tuple type arguments.
Similar code already existed in the handling of FunctionTypes.
This commit goes in the opposite direction, and instead queries
the `direct` versions of those methods, which do not perform
dealiasing.
Conseqeuently, the type aliases that appear in the source code
signatures for members will be rendered as such in Scaladoc.
Which seems like an improvement.
Diffstat (limited to 'test/scaladoc/run/t7876b.scala')
-rw-r--r-- | test/scaladoc/run/t7876b.scala | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/scaladoc/run/t7876b.scala b/test/scaladoc/run/t7876b.scala new file mode 100644 index 0000000000..4d5b8c22cf --- /dev/null +++ b/test/scaladoc/run/t7876b.scala @@ -0,0 +1,24 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +// Don't dealias just to print a Function or Tuple type. +object Test extends ScaladocModelTest { + + override def code = """ + class Test { + type FInt = Function0[Int] + type TInt = Tuple1[Int] + def foo: FInt + def bar: TInt + } + """ + + def scaladocSettings = "" + + def testModel(rootPackage: Package) = { + import access._ + List("foo", "bar").foreach { name => + println("foo: " + rootPackage._class("Test")._method(name).resultType.name) + } + } +} |