diff options
Diffstat (limited to 'test')
22 files changed, 215 insertions, 47 deletions
diff --git a/test/files/neg/t5031.check b/test/files/neg/t5031.check index 8983d8daf9..2f1090c321 100644 --- a/test/files/neg/t5031.check +++ b/test/files/neg/t5031.check @@ -1,5 +1,5 @@ -Id.scala:3: error: Companions 'class Test' and 'object Test' must be defined in same file: +package.scala:2: error: Companions 'class Test' and 'object Test' must be defined in same file: Found in t5031/package.scala and t5031/Id.scala -object Test - ^ + class Test + ^ one error found diff --git a/test/files/neg/t5031b.check b/test/files/neg/t5031b.check new file mode 100644 index 0000000000..3bc2284a4d --- /dev/null +++ b/test/files/neg/t5031b.check @@ -0,0 +1,5 @@ +b.scala:3: error: Companions 'class Bippy' and 'object Bippy' must be defined in same file: + Found in t5031b/a.scala and t5031b/b.scala +object Bippy + ^ +one error found diff --git a/test/files/neg/t5031b/a.scala b/test/files/neg/t5031b/a.scala new file mode 100644 index 0000000000..0ab9aa9769 --- /dev/null +++ b/test/files/neg/t5031b/a.scala @@ -0,0 +1,3 @@ +package foo + +class Bippy diff --git a/test/files/neg/t5031b/b.scala b/test/files/neg/t5031b/b.scala new file mode 100644 index 0000000000..bdef237af5 --- /dev/null +++ b/test/files/neg/t5031b/b.scala @@ -0,0 +1,3 @@ +package foo + +object Bippy diff --git a/test/files/neg/t6258.check b/test/files/neg/t6258.check new file mode 100644 index 0000000000..73363d8280 --- /dev/null +++ b/test/files/neg/t6258.check @@ -0,0 +1,16 @@ +t6258.scala:2: error: missing parameter type for expanded function +The argument types of an anonymous function must be fully known. (SLS 8.5) +Expected type was: PartialFunction[?, Int] + val f : PartialFunction[_, Int] = { case a : Int => a } // undefined param + ^ +t6258.scala:5: error: missing parameter type for expanded function +The argument types of an anonymous function must be fully known. (SLS 8.5) +Expected type was: PartialFunction[?,Int] + foo { case a : Int => a } // undefined param + ^ +t6258.scala:22: error: missing parameter type for expanded function +The argument types of an anonymous function must be fully known. (SLS 8.5) +Expected type was: PartialFunction[?,Any] + bar[M[Any]] (foo { // undefined param + ^ +three errors found diff --git a/test/files/neg/t6258.scala b/test/files/neg/t6258.scala new file mode 100644 index 0000000000..5046a4750a --- /dev/null +++ b/test/files/neg/t6258.scala @@ -0,0 +1,25 @@ +object Test { + val f : PartialFunction[_, Int] = { case a : Int => a } // undefined param + + def foo[A](pf: PartialFunction[A, Int]) {}; + foo { case a : Int => a } // undefined param + + val g : PartialFunction[Int, _] = { case a : Int => a } // okay +} + + +// Another variation, seen in the wild with Specs2. +class X { + trait Matcher[-T] + + def bar[T](m: Matcher[T]) = null + def bar[T](i: Int) = null + + def foo[T](p: PartialFunction[T, Any]): Matcher[T] = null + + case class M[X](a: X) + + bar[M[Any]] (foo { // undefined param + case M(_) => null + }) +} diff --git a/test/files/run/classtags_core.check b/test/files/run/classtags_core.check index 6519db2178..5a9b41fd6d 100644 --- a/test/files/run/classtags_core.check +++ b/test/files/run/classtags_core.check @@ -1,30 +1,30 @@ true
-ClassTag[byte]
+Byte
true
-ClassTag[short]
+Short
true
-ClassTag[char]
+Char
true
-ClassTag[int]
+Int
true
-ClassTag[long]
+Long
true
-ClassTag[float]
+Float
true
-ClassTag[double]
+Double
true
-ClassTag[boolean]
+Boolean
true
-ClassTag[void]
+Unit
true
-ClassTag[class java.lang.Object]
+Any
true
-ClassTag[class java.lang.Object]
+AnyVal
true
-ClassTag[class java.lang.Object]
+Object
true
-ClassTag[class java.lang.Object]
+Object
true
-ClassTag[class scala.runtime.Null$]
+Null
true
-ClassTag[class scala.runtime.Nothing$]
+Nothing
diff --git a/test/files/run/classtags_multi.check b/test/files/run/classtags_multi.check index 3a7f16c3a0..68cee4841d 100644 --- a/test/files/run/classtags_multi.check +++ b/test/files/run/classtags_multi.check @@ -1,5 +1,5 @@ -ClassTag[int]
-ClassTag[class [I]
-ClassTag[class [[I]
-ClassTag[class [[[I]
-ClassTag[class [[[[I]
+Int
+Array[int]
+Array[Array[int]]
+Array[Array[Array[int]]]
+Array[Array[Array[Array[int]]]]
diff --git a/test/files/run/interop_classtags_are_classmanifests.check b/test/files/run/interop_classtags_are_classmanifests.check index 7a0a829af2..c07ed0e657 100644 --- a/test/files/run/interop_classtags_are_classmanifests.check +++ b/test/files/run/interop_classtags_are_classmanifests.check @@ -1,3 +1,3 @@ -ClassTag[int]
-ClassTag[class java.lang.String]
-ClassTag[class [I]
+Int
+java.lang.String
+Array[int]
diff --git a/test/files/run/macro-expand-tparams-implicit.check b/test/files/run/macro-expand-tparams-implicit.check index 80c6b826ba..1c1a785706 100644 --- a/test/files/run/macro-expand-tparams-implicit.check +++ b/test/files/run/macro-expand-tparams-implicit.check @@ -1,2 +1,2 @@ TypeTag[Int]
-TypeTag[String]
+AbsTypeTag[String]
diff --git a/test/files/run/macro-expand-tparams-prefix-a.check b/test/files/run/macro-expand-tparams-prefix-a.check index 6c23b47d64..6a7f9c5f52 100644 --- a/test/files/run/macro-expand-tparams-prefix-a.check +++ b/test/files/run/macro-expand-tparams-prefix-a.check @@ -1,4 +1,4 @@ TypeTag[Int]
TypeTag[Int]
-TypeTag[String]
+AbsTypeTag[String]
TypeTag[Boolean]
diff --git a/test/files/run/macro-expand-tparams-prefix-b.check b/test/files/run/macro-expand-tparams-prefix-b.check index 67dabff11e..daae32bd0a 100644 --- a/test/files/run/macro-expand-tparams-prefix-b.check +++ b/test/files/run/macro-expand-tparams-prefix-b.check @@ -1,2 +1,2 @@ TypeTag[Boolean] TypeTag[Int]
-TypeTag[Boolean] TypeTag[String]
+TypeTag[Boolean] AbsTypeTag[String]
diff --git a/test/files/run/macro-expand-tparams-prefix-c1.check b/test/files/run/macro-expand-tparams-prefix-c1.check index 8d1c4e3416..5356b3e6d1 100644 --- a/test/files/run/macro-expand-tparams-prefix-c1.check +++ b/test/files/run/macro-expand-tparams-prefix-c1.check @@ -1,3 +1,3 @@ TypeTag[Int]
-TypeTag[String]
+AbsTypeTag[String]
TypeTag[Boolean]
diff --git a/test/files/run/macro-expand-tparams-prefix-c2.check b/test/files/run/macro-expand-tparams-prefix-c2.check index 8d1c4e3416..5356b3e6d1 100644 --- a/test/files/run/macro-expand-tparams-prefix-c2.check +++ b/test/files/run/macro-expand-tparams-prefix-c2.check @@ -1,3 +1,3 @@ TypeTag[Int]
-TypeTag[String]
+AbsTypeTag[String]
TypeTag[Boolean]
diff --git a/test/files/run/macro-undetparams-macroitself.check b/test/files/run/macro-undetparams-macroitself.check index 80c6b826ba..1c1a785706 100644 --- a/test/files/run/macro-undetparams-macroitself.check +++ b/test/files/run/macro-undetparams-macroitself.check @@ -1,2 +1,2 @@ TypeTag[Int]
-TypeTag[String]
+AbsTypeTag[String]
diff --git a/test/files/run/t5881.check b/test/files/run/t5881.check index 477fb935a8..8e596e9323 100644 --- a/test/files/run/t5881.check +++ b/test/files/run/t5881.check @@ -1,2 +1,2 @@ -ClassTag[class scala.collection.immutable.List]
-ClassTag[class scala.collection.immutable.List]
+scala.collection.immutable.List
+scala.collection.immutable.List
diff --git a/test/files/run/t6246.check b/test/files/run/t6246.check new file mode 100644 index 0000000000..9532185ead --- /dev/null +++ b/test/files/run/t6246.check @@ -0,0 +1,90 @@ +runtimeClass = byte, toString = Byte +true +true +true +false +true +false +false +false +false +runtimeClass = short, toString = Short +true +true +true +false +true +false +false +false +false +runtimeClass = char, toString = Char +true +true +true +false +true +false +false +false +false +runtimeClass = int, toString = Int +true +true +true +false +true +false +false +false +false +runtimeClass = long, toString = Long +true +true +true +false +true +false +false +false +false +runtimeClass = float, toString = Float +true +true +true +false +true +false +false +false +false +runtimeClass = double, toString = Double +true +true +true +false +true +false +false +false +false +runtimeClass = void, toString = Unit +true +true +true +false +true +false +false +false +false +runtimeClass = boolean, toString = Boolean +true +true +true +false +true +false +false +false +false
\ No newline at end of file diff --git a/test/files/run/t6246.scala b/test/files/run/t6246.scala new file mode 100644 index 0000000000..28765e1adf --- /dev/null +++ b/test/files/run/t6246.scala @@ -0,0 +1,26 @@ +import scala.reflect.{ClassTag, classTag} + +object Test extends App { + def testValueClass(tag: ClassTag[_]) { + println(s"runtimeClass = ${tag.runtimeClass}, toString = ${tag.toString}") + println(tag <:< tag) + println(tag <:< ClassTag.AnyVal) + println(tag <:< ClassTag.Any) + println(tag <:< ClassTag.Nothing) + println(ClassTag.Nothing <:< tag) + println(tag <:< ClassTag.Null) + println(ClassTag.Null <:< tag) + println(tag <:< ClassTag.Object) + println(ClassTag.Object <:< tag) + } + + testValueClass(ClassTag.Byte) + testValueClass(ClassTag.Short) + testValueClass(ClassTag.Char) + testValueClass(ClassTag.Int) + testValueClass(ClassTag.Long) + testValueClass(ClassTag.Float) + testValueClass(ClassTag.Double) + testValueClass(ClassTag.Unit) + testValueClass(ClassTag.Boolean) +}
\ No newline at end of file diff --git a/test/files/run/valueclasses-classtag-basic.check b/test/files/run/valueclasses-classtag-basic.check index 0c13986b32..554c75e074 100644 --- a/test/files/run/valueclasses-classtag-basic.check +++ b/test/files/run/valueclasses-classtag-basic.check @@ -1 +1 @@ -ClassTag[class Foo]
+Foo
diff --git a/test/files/run/valueclasses-classtag-existential.check b/test/files/run/valueclasses-classtag-existential.check index 95e94e7aee..15ac02630f 100644 --- a/test/files/run/valueclasses-classtag-existential.check +++ b/test/files/run/valueclasses-classtag-existential.check @@ -1 +1 @@ -ClassTag[class java.lang.Object]
+Object
diff --git a/test/files/run/valueclasses-classtag-generic.check b/test/files/run/valueclasses-classtag-generic.check index 0c13986b32..554c75e074 100644 --- a/test/files/run/valueclasses-classtag-generic.check +++ b/test/files/run/valueclasses-classtag-generic.check @@ -1 +1 @@ -ClassTag[class Foo]
+Foo
diff --git a/test/files/run/virtpatmat_typetag.check b/test/files/run/virtpatmat_typetag.check index f9800b84d0..eaa9f3361f 100644 --- a/test/files/run/virtpatmat_typetag.check +++ b/test/files/run/virtpatmat_typetag.check @@ -1,10 +1,10 @@ -1 is not a ClassTag[int]; it's a class java.lang.Integer -1 is a ClassTag[class java.lang.Integer] -1 is not a ClassTag[class java.lang.String]; it's a class java.lang.Integer -true is a ClassTag[class java.lang.Object] -woele is a ClassTag[class java.lang.String] -1 is not a ClassTag[int]; it's a class java.lang.Integer -1 is a ClassTag[class java.lang.Integer] -1 is not a ClassTag[class java.lang.String]; it's a class java.lang.Integer -true is a ClassTag[class java.lang.Object] -woele is a ClassTag[class java.lang.String] +1 is not a Int; it's a class java.lang.Integer
+1 is a java.lang.Integer
+1 is not a java.lang.String; it's a class java.lang.Integer
+true is a Any
+woele is a java.lang.String
+1 is not a Int; it's a class java.lang.Integer
+1 is a java.lang.Integer
+1 is not a java.lang.String; it's a class java.lang.Integer
+true is a Any
+woele is a java.lang.String
|