summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-09-26 23:16:25 -0700
committerJason Zaugg <jzaugg@gmail.com>2013-09-26 23:16:25 -0700
commit738405a9aae7c117d3974c05269f6bbd2ac2ae3e (patch)
tree24744678d1772b3404aedc9e96b7f4ed326f47ac /test
parent052f1a7b1f7d6e63f5d83a89ffba9dbc56645112 (diff)
parentc11d98822e86b23b7c31429433fbb15cf94792c8 (diff)
downloadscala-738405a9aae7c117d3974c05269f6bbd2ac2ae3e.tar.gz
scala-738405a9aae7c117d3974c05269f6bbd2ac2ae3e.tar.bz2
scala-738405a9aae7c117d3974c05269f6bbd2ac2ae3e.zip
Merge pull request #2990 from retronym/ticket/7876
Scaladoc regression with Function / Tuple type constructors
Diffstat (limited to 'test')
-rw-r--r--test/files/run/t7876.scala26
-rw-r--r--test/scaladoc/run/SI-4676.scala3
-rw-r--r--test/scaladoc/run/t7876.check1
-rw-r--r--test/scaladoc/run/t7876.scala19
-rw-r--r--test/scaladoc/run/t7876b.check3
-rw-r--r--test/scaladoc/run/t7876b.scala24
6 files changed, 75 insertions, 1 deletions
diff --git a/test/files/run/t7876.scala b/test/files/run/t7876.scala
new file mode 100644
index 0000000000..aeec8c8cce
--- /dev/null
+++ b/test/files/run/t7876.scala
@@ -0,0 +1,26 @@
+import scala.tools.partest._
+
+// Type constructors for FunctionN and TupleN should not be considered as function type / tuple types.
+object Test extends DirectTest {
+ override def extraSettings: String = "-usejavacp"
+
+ def code = ""
+
+ def show() {
+ val global = newCompiler()
+ new global.Run()
+ import global._, definitions._
+ val function0TC = FunctionClass(0).typeConstructor
+ val tuple1TC = TupleClass(1).typeConstructor
+ FunctionClass.seq.foreach { sym =>
+ val tc = sym.typeConstructor
+ assert(!isFunctionType(tc), s"$tc")
+ assert(!isFunctionTypeDirect(tc), s"$tc (direct)")
+ }
+ TupleClass.seq.foreach { sym =>
+ val tc = sym.typeConstructor
+ assert(!isTupleType(tc), s"$sym")
+ assert(!isTupleTypeDirect(tc), s"$tc (direct)")
+ }
+ }
+}
diff --git a/test/scaladoc/run/SI-4676.scala b/test/scaladoc/run/SI-4676.scala
index b83a59a472..99b3c5568a 100644
--- a/test/scaladoc/run/SI-4676.scala
+++ b/test/scaladoc/run/SI-4676.scala
@@ -21,6 +21,7 @@ object Test extends ScaladocModelTest {
// 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")
+ val resultType = x.valueParams(0)(0).resultType.name
+ assert(resultType == "SS", s"parameter ss of method x has type $resultType, expected SS!")
}
} \ No newline at end of file
diff --git a/test/scaladoc/run/t7876.check b/test/scaladoc/run/t7876.check
new file mode 100644
index 0000000000..619c56180b
--- /dev/null
+++ b/test/scaladoc/run/t7876.check
@@ -0,0 +1 @@
+Done.
diff --git a/test/scaladoc/run/t7876.scala b/test/scaladoc/run/t7876.scala
new file mode 100644
index 0000000000..63c63f8a0c
--- /dev/null
+++ b/test/scaladoc/run/t7876.scala
@@ -0,0 +1,19 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+
+ override def code = """
+ import language.higherKinds
+ trait T[M[_]]
+ class C extends T[Function0]
+ class D extends T[Tuple1]
+ """
+
+ def scaladocSettings = ""
+
+ def testModel(rootPackage: Package) = {
+ import access._
+ // did not crash
+ }
+}
diff --git a/test/scaladoc/run/t7876b.check b/test/scaladoc/run/t7876b.check
new file mode 100644
index 0000000000..21aaf3b295
--- /dev/null
+++ b/test/scaladoc/run/t7876b.check
@@ -0,0 +1,3 @@
+foo: FInt
+foo: TInt
+Done.
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)
+ }
+ }
+}