diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2016-02-03 22:06:42 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2016-02-04 09:19:19 +1000 |
commit | da46355a90442636ee7634c31a69eae8e8b9cd42 (patch) | |
tree | eec9abbf057e3c5fd4566df6628f9693835cc536 /test | |
parent | 74e53cb4930fc3e02222d8be0f065ce8aaa71230 (diff) | |
parent | cc6fea6d30609b8879db1ecdbc288e4cdaa5b8d4 (diff) | |
download | scala-da46355a90442636ee7634c31a69eae8e8b9cd42.tar.gz scala-da46355a90442636ee7634c31a69eae8e8b9cd42.tar.bz2 scala-da46355a90442636ee7634c31a69eae8e8b9cd42.zip |
Merge commit 'cc6fea6' into merge/2.11.x-to-2.12.x-20160203
Conflicts:
build.sbt
scripts/jobs/integrate/bootstrap
Diffstat (limited to 'test')
-rw-r--r-- | test/files/jvm/future-spec/FutureTests.scala | 2 | ||||
-rw-r--r-- | test/files/neg/t9572.check | 7 | ||||
-rw-r--r-- | test/files/neg/t9572.scala | 6 | ||||
-rw-r--r-- | test/junit/scala/reflect/ClassTagTest.scala | 12 | ||||
-rw-r--r-- | test/scaladoc/run/tag-requirements.check | 16 | ||||
-rw-r--r-- | test/scaladoc/run/tag-requirements.scala | 53 |
6 files changed, 94 insertions, 2 deletions
diff --git a/test/files/jvm/future-spec/FutureTests.scala b/test/files/jvm/future-spec/FutureTests.scala index abcf1b4cbc..d0de2f5542 100644 --- a/test/files/jvm/future-spec/FutureTests.scala +++ b/test/files/jvm/future-spec/FutureTests.scala @@ -238,7 +238,7 @@ class FutureTests extends MinimalScalaTest { "support pattern matching within a for-comprehension" in { case class Req[T](req: T) case class Res[T](res: T) - def async[T](req: Req[T]) = req match { + def async[T](req: Req[T]) = (req: @unchecked) match { case Req(s: String) => Future { Res(s.length) } case Req(i: Int) => Future { Res((i * 2).toString) } } diff --git a/test/files/neg/t9572.check b/test/files/neg/t9572.check new file mode 100644 index 0000000000..b95bd015cf --- /dev/null +++ b/test/files/neg/t9572.check @@ -0,0 +1,7 @@ +t9572.scala:3: error: too many elements for tuple: 23, allowed: 22 + val term23 = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23) + ^ +t9572.scala:5: error: too many elements for tuple: 23, allowed: 22 + val type23: (Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int) = null + ^ +two errors found diff --git a/test/files/neg/t9572.scala b/test/files/neg/t9572.scala new file mode 100644 index 0000000000..32b2db320e --- /dev/null +++ b/test/files/neg/t9572.scala @@ -0,0 +1,6 @@ +class T9572 { + val term22 = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22) + val term23 = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23) + val type22: (Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int) = null + val type23: (Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int,Int) = null +} diff --git a/test/junit/scala/reflect/ClassTagTest.scala b/test/junit/scala/reflect/ClassTagTest.scala index 90cc981fc1..49022dccda 100644 --- a/test/junit/scala/reflect/ClassTagTest.scala +++ b/test/junit/scala/reflect/ClassTagTest.scala @@ -26,4 +26,14 @@ class ClassTagTest { @Test def checkDouble = assertTrue(checkNotInt[Double] (0.toDouble)) @Test def checkBoolean = assertTrue(checkNotInt[Boolean](false)) @Test def checkUnit = assertTrue(checkNotInt[Unit] ({})) -}
\ No newline at end of file + + @Test def t9534: Unit = { + val ct = implicitly[scala.reflect.ClassTag[Unit]] + val a1 = ct.newArray(1) + a1(0) = () + val a2 = ct.wrap.newArray(1) + a2(0) = a1 + val a3 = ct.newArray2(1) + a3(0) = a1 + } +} diff --git a/test/scaladoc/run/tag-requirements.check b/test/scaladoc/run/tag-requirements.check new file mode 100644 index 0000000000..184273b883 --- /dev/null +++ b/test/scaladoc/run/tag-requirements.check @@ -0,0 +1,16 @@ +newSource:3: warning: Only one '@version' tag is allowed + /** + ^ +newSource:9: warning: Tag '@param' must be followed by a symbol name + /** + ^ +newSource:9: warning: Tag '@param' is not recognised + /** + ^ +newSource:14: warning: Only one '@param' tag for symbol b is allowed + /** + ^ +newSource:20: warning: Tag '@unrecognised' is not recognised + /** + ^ +Done. diff --git a/test/scaladoc/run/tag-requirements.scala b/test/scaladoc/run/tag-requirements.scala new file mode 100644 index 0000000000..24f1fab761 --- /dev/null +++ b/test/scaladoc/run/tag-requirements.scala @@ -0,0 +1,53 @@ +import scala.tools.nsc.doc.base._ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + + override def code = + """ + package scala.test.scaladoc.tagrequirements + /** + * object comment + * @version 1.0 + * @version 2.0 + */ + object Test { + /** + * foo comment + * @param + */ + def foo(b: Any) = ??? + /** + * bar comment + * @param b A value + * @param b A value + */ + def bar(b: Any) = ??? + /** + * baz comment + * @unrecognised + */ + def baz() = ??? + } + """ + + def scaladocSettings = "" + + 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._ + + val base = root._package("scala")._package("test")._package("scaladoc")._package("tagrequirements") + + val test = base._object("Test") + /* + * We only care about the warnings which are side effects but we assert on the comment to + * avoid static code analysis noise about unused values. + */ + assert(extractCommentText(test.comment.get) == "object comment") + assert(extractCommentText(test._method("foo").comment.get) == "foo comment") + assert(extractCommentText(test._method("bar").comment.get) == "bar comment") + assert(extractCommentText(test._method("baz").comment.get) == "baz comment") + } +} |