summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-10-07 15:20:51 -0700
committerPaul Phillips <paulp@improving.org>2012-10-07 15:20:51 -0700
commita5a1f01b7d458b94e37407681abb3334a543fb03 (patch)
tree93ddf4e9ed05e4108f1b9d82a0960c516b1c3e77 /test
parent7be1652cbf1300fe5fea44681a480c33467c2296 (diff)
parent65a321c63e5ddb77fa87de098c4f7d6f9ce8baa6 (diff)
downloadscala-a5a1f01b7d458b94e37407681abb3334a543fb03.tar.gz
scala-a5a1f01b7d458b94e37407681abb3334a543fb03.tar.bz2
scala-a5a1f01b7d458b94e37407681abb3334a543fb03.zip
Merge remote-tracking branch 'origin/2.10.0-wip' into merge-2.10
* origin/2.10.0-wip: MethodSymbol.params => MethodSymbol.paramss SI-6471 Update jquery from 1.4.2 to 1.8.2 undeprecates manifests for 2.10.0 SI-6451: Rename classes in `unchecked-abstract.scala` test. Put more implementation restrictions on value classes. Fixed problem in SI-6408 Revised restrictions for value classes and unversal traits SI-6436 Handle ambiguous string processors fixes a bug in a weak cache in runtime reflection Conflicts: test/files/neg/classmanifests_new_deprecations.check test/files/neg/unchecked-abstract.check
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/anytrait.check4
-rw-r--r--test/files/neg/classmanifests_new_deprecations.check32
-rw-r--r--test/files/neg/t3692-old.check8
-rw-r--r--test/files/neg/t5799.check2
-rw-r--r--test/files/neg/t5882.check18
-rw-r--r--test/files/neg/t5882.scala5
-rw-r--r--test/files/neg/t6359.check6
-rw-r--r--test/files/neg/t6436.check10
-rw-r--r--test/files/neg/t6436.scala9
-rw-r--r--test/files/neg/t6436b.check10
-rw-r--r--test/files/neg/t6436b.scala9
-rw-r--r--test/files/neg/unchecked-abstract.check32
-rw-r--r--test/files/neg/unchecked-abstract.scala96
-rw-r--r--test/files/neg/valueclasses-impl-restrictions.check21
-rw-r--r--test/files/neg/valueclasses-impl-restrictions.scala28
-rw-r--r--test/files/neg/valueclasses.check4
-rw-r--r--test/files/run/manifests-undeprecated-in-2.10.0.flags1
-rw-r--r--test/files/run/manifests-undeprecated-in-2.10.0.scala15
-rw-r--r--test/files/run/reflection-implicit.scala2
-rw-r--r--test/files/run/reflection-methodsymbol-params.scala16
-rw-r--r--test/files/run/reflection-valueclasses-magic.scala6
-rw-r--r--test/pending/run/t5882.scala14
-rw-r--r--test/pending/run/t6408.scala11
23 files changed, 224 insertions, 135 deletions
diff --git a/test/files/neg/anytrait.check b/test/files/neg/anytrait.check
index 9dd970b58c..fabe74d379 100644
--- a/test/files/neg/anytrait.check
+++ b/test/files/neg/anytrait.check
@@ -1,7 +1,7 @@
-anytrait.scala:3: error: this statement is not allowed in universal trait extending from class Any: private[this] var x: Int = 1
+anytrait.scala:3: error: field definition is not allowed in universal trait extending from class Any
var x = 1
^
-anytrait.scala:5: error: this statement is not allowed in universal trait extending from class Any: T.this.x_=(T.this.x.+(1))
+anytrait.scala:5: error: this statement is not allowed in universal trait extending from class Any
{ x += 1 }
^
two errors found
diff --git a/test/files/neg/classmanifests_new_deprecations.check b/test/files/neg/classmanifests_new_deprecations.check
index 2301947b04..fddd6bf5b4 100644
--- a/test/files/neg/classmanifests_new_deprecations.check
+++ b/test/files/neg/classmanifests_new_deprecations.check
@@ -28,36 +28,6 @@ classmanifests_new_deprecations.scala:10: warning: type ClassManifest in object
classmanifests_new_deprecations.scala:15: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead
type RCM[T] = scala.reflect.ClassManifest[T]
^
-classmanifests_new_deprecations.scala:20: warning: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- def m1[T: Manifest] = ???
- ^
-classmanifests_new_deprecations.scala:21: warning: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- def m2[T](implicit evidence$1: Manifest[T]) = ???
- ^
-classmanifests_new_deprecations.scala:22: warning: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- val m3: Manifest[Int] = null
- ^
-classmanifests_new_deprecations.scala:22: warning: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- val m3: Manifest[Int] = null
- ^
-classmanifests_new_deprecations.scala:24: warning: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- def rm1[T: scala.reflect.Manifest] = ???
- ^
-classmanifests_new_deprecations.scala:25: warning: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- def rm2[T](implicit evidence$1: scala.reflect.Manifest[T]) = ???
- ^
-classmanifests_new_deprecations.scala:26: warning: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- val rm3: scala.reflect.Manifest[Int] = null
- ^
-classmanifests_new_deprecations.scala:26: warning: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- val rm3: scala.reflect.Manifest[Int] = null
- ^
-classmanifests_new_deprecations.scala:28: warning: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- type M[T] = Manifest[T]
- ^
-classmanifests_new_deprecations.scala:33: warning: trait Manifest in package reflect is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- type RM[T] = scala.reflect.Manifest[T]
- ^
error: No warnings can be incurred under -Xfatal-warnings.
-20 warnings found
+10 warnings found
one error found
diff --git a/test/files/neg/t3692-old.check b/test/files/neg/t3692-old.check
index 950f82951c..9f3ae516aa 100644
--- a/test/files/neg/t3692-old.check
+++ b/test/files/neg/t3692-old.check
@@ -7,14 +7,8 @@ t3692-old.scala:14: warning: non-variable type argument Int in type pattern Map[
t3692-old.scala:15: warning: non-variable type argument Int in type pattern Map[T,Int] is unchecked since it is eliminated by erasure
case m2: Map[T, Int] => new java.util.HashMap[T, Integer]
^
-t3692-old.scala:11: warning: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = {
- ^
-t3692-old.scala:11: warning: type Manifest in object Predef is deprecated: Use scala.reflect.ClassTag (to capture erasures) or scala.reflect.runtime.universe.TypeTag (to capture types) or both instead
- private final def toJavaMap[T, V](map: Map[T, V])(implicit m1: Manifest[T], m2: Manifest[V]): java.util.Map[_, _] = {
- ^
t3692-old.scala:15: error: unreachable code
case m2: Map[T, Int] => new java.util.HashMap[T, Integer]
^
-5 warnings found
+three warnings found
one error found
diff --git a/test/files/neg/t5799.check b/test/files/neg/t5799.check
index 10e2658d56..3b43d06a94 100644
--- a/test/files/neg/t5799.check
+++ b/test/files/neg/t5799.check
@@ -1,4 +1,4 @@
-t5799.scala:2: error: value class may not have secondary constructors
+t5799.scala:2: error: secondary constructor is not allowed in value class
def this(s: String) = this(s.toDouble)
^
one error found
diff --git a/test/files/neg/t5882.check b/test/files/neg/t5882.check
index df01c7bc0a..e0958e19d9 100644
--- a/test/files/neg/t5882.check
+++ b/test/files/neg/t5882.check
@@ -1,15 +1,9 @@
-t5882.scala:2: warning: case classes without a parameter list have been deprecated;
-use either case objects or case classes with `()' as parameter list.
- case class Scope
- ^
-t5882.scala:2: error: value class may not have nested class definitions
- case class Scope
+t5882.scala:4: error: implementation restriction: nested class is not allowed in value class
+This restriction is planned to be removed in subsequent releases.
+ case class Scope()
^
-t5882.scala:3: error: value class may not have nested class definitions
- class Foo
- ^
-t5882.scala:4: error: value class may not have nested module definitions
+t5882.scala:5: error: implementation restriction: nested object is not allowed in value class
+This restriction is planned to be removed in subsequent releases.
object Bar
^
-one warning found
-three errors found
+two errors found
diff --git a/test/files/neg/t5882.scala b/test/files/neg/t5882.scala
index 1233eb636f..3a55abdc9a 100644
--- a/test/files/neg/t5882.scala
+++ b/test/files/neg/t5882.scala
@@ -1,5 +1,6 @@
+// SIP-15 was changed to allow nested classes. See run/t5882.scala
+
class NodeOps(val n: Any) extends AnyVal {
- case class Scope
- class Foo
+ case class Scope()
object Bar
}
diff --git a/test/files/neg/t6359.check b/test/files/neg/t6359.check
index 2aa1ac5035..5bcdc57331 100644
--- a/test/files/neg/t6359.check
+++ b/test/files/neg/t6359.check
@@ -1,7 +1,9 @@
-t6359.scala:3: error: value class may not have nested module definitions
+t6359.scala:3: error: implementation restriction: nested object is not allowed in value class
+This restriction is planned to be removed in subsequent releases.
object X
^
-t6359.scala:4: error: value class may not have nested class definitions
+t6359.scala:4: error: implementation restriction: nested class is not allowed in value class
+This restriction is planned to be removed in subsequent releases.
class Y
^
two errors found
diff --git a/test/files/neg/t6436.check b/test/files/neg/t6436.check
new file mode 100644
index 0000000000..ecb28f9100
--- /dev/null
+++ b/test/files/neg/t6436.check
@@ -0,0 +1,10 @@
+t6436.scala:8: error: type mismatch;
+ found : StringContext
+ required: ?{def q: ?}
+Note that implicit conversions are not applicable because they are ambiguous:
+ both method foo1 in object quasiquotes of type (ctx: StringContext)Object{def q: Nothing}
+ and method foo2 in object quasiquotes of type (ctx: StringContext)Object{def q: Nothing}
+ are possible conversion functions from StringContext to ?{def q: ?}
+ println(q"a")
+ ^
+one error found
diff --git a/test/files/neg/t6436.scala b/test/files/neg/t6436.scala
new file mode 100644
index 0000000000..2c40502538
--- /dev/null
+++ b/test/files/neg/t6436.scala
@@ -0,0 +1,9 @@
+object quasiquotes {
+ implicit def foo1(ctx: StringContext) = new { def q = ??? }
+ implicit def foo2(ctx: StringContext) = new { def q = ??? }
+}
+
+object Test extends App {
+ import quasiquotes._
+ println(q"a")
+}
diff --git a/test/files/neg/t6436b.check b/test/files/neg/t6436b.check
new file mode 100644
index 0000000000..b3c2d73739
--- /dev/null
+++ b/test/files/neg/t6436b.check
@@ -0,0 +1,10 @@
+t6436b.scala:8: error: type mismatch;
+ found : StringContext
+ required: ?{def q: ?}
+Note that implicit conversions are not applicable because they are ambiguous:
+ both method foo1 in object quasiquotes of type (ctx: StringContext)Object{def q: Nothing}
+ and method foo2 in object quasiquotes of type (ctx: StringContext)Object{def q: Nothing}
+ are possible conversion functions from StringContext to ?{def q: ?}
+ println(StringContext("a").q())
+ ^
+one error found
diff --git a/test/files/neg/t6436b.scala b/test/files/neg/t6436b.scala
new file mode 100644
index 0000000000..8023329e90
--- /dev/null
+++ b/test/files/neg/t6436b.scala
@@ -0,0 +1,9 @@
+object quasiquotes {
+ implicit def foo1(ctx: StringContext) = new { def q = ??? }
+ implicit def foo2(ctx: StringContext) = new { def q = ??? }
+}
+
+object Test extends App {
+ import quasiquotes._
+ println(StringContext("a").q())
+}
diff --git a/test/files/neg/unchecked-abstract.check b/test/files/neg/unchecked-abstract.check
index 762859574b..72019082ac 100644
--- a/test/files/neg/unchecked-abstract.check
+++ b/test/files/neg/unchecked-abstract.check
@@ -1,26 +1,26 @@
-unchecked-abstract.scala:16: warning: abstract type H in type Con[M.this.H] is unchecked since it is eliminated by erasure
- /* warn */ println(x.isInstanceOf[Con[H]])
+unchecked-abstract.scala:16: warning: abstract type H in type Contravariant[M.this.H] is unchecked since it is eliminated by erasure
+ /* warn */ println(x.isInstanceOf[Contravariant[H]])
^
-unchecked-abstract.scala:21: warning: abstract type H in type Con[M.this.H] is unchecked since it is eliminated by erasure
- /* warn */ println(x.isInstanceOf[Con[H]])
+unchecked-abstract.scala:21: warning: abstract type H in type Contravariant[M.this.H] is unchecked since it is eliminated by erasure
+ /* warn */ println(x.isInstanceOf[Contravariant[H]])
^
-unchecked-abstract.scala:27: warning: abstract type T in type Inv[M.this.T] is unchecked since it is eliminated by erasure
- /* warn */ println(x.isInstanceOf[Inv[T]])
+unchecked-abstract.scala:27: warning: abstract type T in type Invariant[M.this.T] is unchecked since it is eliminated by erasure
+ /* warn */ println(x.isInstanceOf[Invariant[T]])
^
-unchecked-abstract.scala:28: warning: abstract type L in type Inv[M.this.L] is unchecked since it is eliminated by erasure
- /* warn */ println(x.isInstanceOf[Inv[L]])
+unchecked-abstract.scala:28: warning: abstract type L in type Invariant[M.this.L] is unchecked since it is eliminated by erasure
+ /* warn */ println(x.isInstanceOf[Invariant[L]])
^
-unchecked-abstract.scala:31: warning: abstract type H in type Inv[M.this.H] is unchecked since it is eliminated by erasure
- /* warn */ println(x.isInstanceOf[Inv[H]])
+unchecked-abstract.scala:31: warning: abstract type H in type Invariant[M.this.H] is unchecked since it is eliminated by erasure
+ /* warn */ println(x.isInstanceOf[Invariant[H]])
^
-unchecked-abstract.scala:33: warning: abstract type L in type Inv[M.this.L] is unchecked since it is eliminated by erasure
- /* warn */ println(x.isInstanceOf[Inv[L]])
+unchecked-abstract.scala:33: warning: abstract type L in type Invariant[M.this.L] is unchecked since it is eliminated by erasure
+ /* warn */ println(x.isInstanceOf[Invariant[L]])
^
-unchecked-abstract.scala:36: warning: abstract type H in type Inv[M.this.H] is unchecked since it is eliminated by erasure
- /* warn */ println(x.isInstanceOf[Inv[H]])
+unchecked-abstract.scala:36: warning: abstract type H in type Invariant[M.this.H] is unchecked since it is eliminated by erasure
+ /* warn */ println(x.isInstanceOf[Invariant[H]])
^
-unchecked-abstract.scala:37: warning: abstract type T in type Inv[M.this.T] is unchecked since it is eliminated by erasure
- /* warn */ println(x.isInstanceOf[Inv[T]])
+unchecked-abstract.scala:37: warning: abstract type T in type Invariant[M.this.T] is unchecked since it is eliminated by erasure
+ /* warn */ println(x.isInstanceOf[Invariant[T]])
^
error: No warnings can be incurred under -Xfatal-warnings.
8 warnings found
diff --git a/test/files/neg/unchecked-abstract.scala b/test/files/neg/unchecked-abstract.scala
index 5b915755f4..23c8281ca8 100644
--- a/test/files/neg/unchecked-abstract.scala
+++ b/test/files/neg/unchecked-abstract.scala
@@ -1,56 +1,56 @@
-trait Con[-X]
-trait Inv[X]
-trait Cov[+X]
+trait Contravariant[-X]
+trait Invariant[X]
+trait Covariant[+X]
abstract class M {
type H
type L <: H
type T >: L <: H
- def h1(x: Con[H]) = {
- /* nowarn */ println(x.isInstanceOf[Con[H]])
- /* nowarn */ println(x.isInstanceOf[Con[T]])
- /* nowarn */ println(x.isInstanceOf[Con[L]])
+ def h1(x: Contravariant[H]) = {
+ /* nowarn */ println(x.isInstanceOf[Contravariant[H]])
+ /* nowarn */ println(x.isInstanceOf[Contravariant[T]])
+ /* nowarn */ println(x.isInstanceOf[Contravariant[L]])
}
- def h2(x: Con[T]) = {
- /* warn */ println(x.isInstanceOf[Con[H]])
- /* nowarn */ println(x.isInstanceOf[Con[T]])
- /* nowarn */ println(x.isInstanceOf[Con[L]])
+ def h2(x: Contravariant[T]) = {
+ /* warn */ println(x.isInstanceOf[Contravariant[H]])
+ /* nowarn */ println(x.isInstanceOf[Contravariant[T]])
+ /* nowarn */ println(x.isInstanceOf[Contravariant[L]])
}
- def h3(x: Con[L]) = {
- /* warn */ println(x.isInstanceOf[Con[H]])
- /* warn */ println(x.isInstanceOf[Con[T]])
- /* nowarn */ println(x.isInstanceOf[Con[L]])
+ def h3(x: Contravariant[L]) = {
+ /* warn */ println(x.isInstanceOf[Contravariant[H]])
+ /* warn */ println(x.isInstanceOf[Contravariant[T]])
+ /* nowarn */ println(x.isInstanceOf[Contravariant[L]])
}
- def h4(x: Inv[H]) = {
- /* nowarn */ println(x.isInstanceOf[Inv[H]])
- /* warn */ println(x.isInstanceOf[Inv[T]])
- /* warn */ println(x.isInstanceOf[Inv[L]])
+ def h4(x: Invariant[H]) = {
+ /* nowarn */ println(x.isInstanceOf[Invariant[H]])
+ /* warn */ println(x.isInstanceOf[Invariant[T]])
+ /* warn */ println(x.isInstanceOf[Invariant[L]])
}
- def h5(x: Inv[T]) = {
- /* warn */ println(x.isInstanceOf[Inv[H]])
- /* nowarn */ println(x.isInstanceOf[Inv[T]])
- /* warn */ println(x.isInstanceOf[Inv[L]])
+ def h5(x: Invariant[T]) = {
+ /* warn */ println(x.isInstanceOf[Invariant[H]])
+ /* nowarn */ println(x.isInstanceOf[Invariant[T]])
+ /* warn */ println(x.isInstanceOf[Invariant[L]])
}
- def h6(x: Inv[L]) = {
- /* warn */ println(x.isInstanceOf[Inv[H]])
- /* warn */ println(x.isInstanceOf[Inv[T]])
- /* nowarn */ println(x.isInstanceOf[Inv[L]])
+ def h6(x: Invariant[L]) = {
+ /* warn */ println(x.isInstanceOf[Invariant[H]])
+ /* warn */ println(x.isInstanceOf[Invariant[T]])
+ /* nowarn */ println(x.isInstanceOf[Invariant[L]])
}
- def h7(x: Cov[H]) = {
- /* nowarn */ println(x.isInstanceOf[Cov[H]])
- /* warn */ println(x.isInstanceOf[Cov[T]])
- /* warn */ println(x.isInstanceOf[Cov[L]])
+ def h7(x: Covariant[H]) = {
+ /* nowarn */ println(x.isInstanceOf[Covariant[H]])
+ /* warn */ println(x.isInstanceOf[Covariant[T]])
+ /* warn */ println(x.isInstanceOf[Covariant[L]])
}
- def h8(x: Cov[T]) = {
- /* nowarn */ println(x.isInstanceOf[Cov[H]])
- /* nowarn */ println(x.isInstanceOf[Cov[T]])
- /* warn */ println(x.isInstanceOf[Cov[L]])
+ def h8(x: Covariant[T]) = {
+ /* nowarn */ println(x.isInstanceOf[Covariant[H]])
+ /* nowarn */ println(x.isInstanceOf[Covariant[T]])
+ /* warn */ println(x.isInstanceOf[Covariant[L]])
}
- def h9(x: Cov[L]) = {
- /* nowarn */ println(x.isInstanceOf[Cov[H]])
- /* nowarn */ println(x.isInstanceOf[Cov[T]])
- /* nowarn */ println(x.isInstanceOf[Cov[L]])
+ def h9(x: Covariant[L]) = {
+ /* nowarn */ println(x.isInstanceOf[Covariant[H]])
+ /* nowarn */ println(x.isInstanceOf[Covariant[T]])
+ /* nowarn */ println(x.isInstanceOf[Covariant[L]])
}
}
@@ -59,17 +59,17 @@ object Test extends M {
type T = Int
type L = Nothing
- val conh = new Con[H] { }
- val cont = new Con[T] { }
- val conl = new Con[L] { }
+ val conh = new Contravariant[H] { }
+ val cont = new Contravariant[T] { }
+ val conl = new Contravariant[L] { }
- val invh = new Inv[H] { }
- val invt = new Inv[T] { }
- val invl = new Inv[L] { }
+ val invh = new Invariant[H] { }
+ val invt = new Invariant[T] { }
+ val invl = new Invariant[L] { }
- val covh = new Cov[H] { }
- val covt = new Cov[T] { }
- val covl = new Cov[L] { }
+ val covh = new Covariant[H] { }
+ val covt = new Covariant[T] { }
+ val covl = new Covariant[L] { }
def main(args: Array[String]): Unit = {
h1(conh)
diff --git a/test/files/neg/valueclasses-impl-restrictions.check b/test/files/neg/valueclasses-impl-restrictions.check
new file mode 100644
index 0000000000..17d07ba960
--- /dev/null
+++ b/test/files/neg/valueclasses-impl-restrictions.check
@@ -0,0 +1,21 @@
+valueclasses-impl-restrictions.scala:3: error: implementation restriction: nested object is not allowed in value class
+This restriction is planned to be removed in subsequent releases.
+ object X
+ ^
+valueclasses-impl-restrictions.scala:4: error: implementation restriction: lazy val is not allowed in value class
+This restriction is planned to be removed in subsequent releases.
+ lazy val y = 1
+ ^
+valueclasses-impl-restrictions.scala:10: error: implementation restriction: nested trait is not allowed in value class
+This restriction is planned to be removed in subsequent releases.
+ trait I2 {
+ ^
+valueclasses-impl-restrictions.scala:16: error: implementation restriction: nested class is not allowed in value class
+This restriction is planned to be removed in subsequent releases.
+ val i2 = new I2 { val q = x.s }
+ ^
+valueclasses-impl-restrictions.scala:22: error: implementation restriction: nested class is not allowed in value class
+This restriction is planned to be removed in subsequent releases.
+ private[this] class I2(val q: String)
+ ^
+5 errors found
diff --git a/test/files/neg/valueclasses-impl-restrictions.scala b/test/files/neg/valueclasses-impl-restrictions.scala
new file mode 100644
index 0000000000..53396db958
--- /dev/null
+++ b/test/files/neg/valueclasses-impl-restrictions.scala
@@ -0,0 +1,28 @@
+class M(val t: Int) extends AnyVal {
+ def lazyString = {
+ object X
+ lazy val y = 1
+ () => X
+ }
+}
+
+class X1(val s: String) extends AnyVal {
+ trait I2 {
+ val q: String
+ def z = s + q
+ }
+
+ def y(x: X1) = {
+ val i2 = new I2 { val q = x.s }
+ i2.z
+ }
+}
+
+class X2(val s: String) extends AnyVal {
+ private[this] class I2(val q: String)
+
+ def y(i: Int) = {
+ val i2 = new I2(i.toString)
+ i2.q + s
+ }
+}
diff --git a/test/files/neg/valueclasses.check b/test/files/neg/valueclasses.check
index 4f042faded..3b82a8358c 100644
--- a/test/files/neg/valueclasses.check
+++ b/test/files/neg/valueclasses.check
@@ -25,13 +25,13 @@ class V5(private val x: Int) extends AnyVal // fail
valueclasses.scala:19: error: value class needs to have exactly one public val parameter
class V6(val x: Int, val y: String) extends AnyVal // fail
^
-valueclasses.scala:20: error: illegal parameter for value class
+valueclasses.scala:20: error: field definition is not allowed in value class
class V7(val x: Int, private[this] val y: String) extends AnyVal // fail
^
valueclasses.scala:21: error: value class needs to have exactly one public val parameter
class V8(var x: Int) extends AnyVal // fail
^
-valueclasses.scala:24: error: this statement is not allowed in value class: private[this] val y: Int = V9.this.x
+valueclasses.scala:24: error: field definition is not allowed in value class
val y = x // fail
^
valueclasses.scala:29: error: type parameter of value class may not be specialized
diff --git a/test/files/run/manifests-undeprecated-in-2.10.0.flags b/test/files/run/manifests-undeprecated-in-2.10.0.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/run/manifests-undeprecated-in-2.10.0.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/run/manifests-undeprecated-in-2.10.0.scala b/test/files/run/manifests-undeprecated-in-2.10.0.scala
new file mode 100644
index 0000000000..82e90b3a89
--- /dev/null
+++ b/test/files/run/manifests-undeprecated-in-2.10.0.scala
@@ -0,0 +1,15 @@
+object Test extends App {
+ def m1a: scala.reflect.Manifest[Int] = scala.reflect.Manifest.Int
+ def m2a: scala.reflect.OptManifest[Int] = ???
+ def m3a = scala.reflect.NoManifest
+
+ def m1b: Manifest[Int] = Manifest.Int
+ def m2b: OptManifest[Int] = ???
+ def m3b = NoManifest
+
+ val m4a = manifest[Int]
+ val m5a = optManifest[Int]
+
+ val m4b = implicitly[Manifest[Int]]
+ val m5b = implicitly[OptManifest[Int]]
+} \ No newline at end of file
diff --git a/test/files/run/reflection-implicit.scala b/test/files/run/reflection-implicit.scala
index 637ef24e14..0bcb0bc3a0 100644
--- a/test/files/run/reflection-implicit.scala
+++ b/test/files/run/reflection-implicit.scala
@@ -9,7 +9,7 @@ class C {
object Test extends App {
val decls = typeOf[C].typeSymbol.typeSignature.declarations.sorted.toList.filter(sym => !sym.isTerm || (sym.isMethod && !sym.asMethod.isConstructor))
println(decls map (_.isImplicit))
- val param = decls.find(_.name.toString == "d").get.asMethod.params.last.head
+ val param = decls.find(_.name.toString == "d").get.asMethod.paramss.last.head
param.typeSignature
println(param.isImplicit)
} \ No newline at end of file
diff --git a/test/files/run/reflection-methodsymbol-params.scala b/test/files/run/reflection-methodsymbol-params.scala
index 7174c6f49b..45b1f9628f 100644
--- a/test/files/run/reflection-methodsymbol-params.scala
+++ b/test/files/run/reflection-methodsymbol-params.scala
@@ -13,12 +13,12 @@ class C {
}
object Test extends App {
- println(typeOf[C].member(newTermName("x1")).asMethod.params)
- println(typeOf[C].member(newTermName("x2")).asMethod.params)
- println(typeOf[C].member(newTermName("x3")).asMethod.params)
- println(typeOf[C].member(newTermName("x4")).asMethod.params)
- println(typeOf[C].member(newTermName("y1")).asMethod.params)
- println(typeOf[C].member(newTermName("y2")).asMethod.params)
- println(typeOf[C].member(newTermName("y3")).asMethod.params)
- println(typeOf[C].member(newTermName("y4")).asMethod.params)
+ println(typeOf[C].member(newTermName("x1")).asMethod.paramss)
+ println(typeOf[C].member(newTermName("x2")).asMethod.paramss)
+ println(typeOf[C].member(newTermName("x3")).asMethod.paramss)
+ println(typeOf[C].member(newTermName("x4")).asMethod.paramss)
+ println(typeOf[C].member(newTermName("y1")).asMethod.paramss)
+ println(typeOf[C].member(newTermName("y2")).asMethod.paramss)
+ println(typeOf[C].member(newTermName("y3")).asMethod.paramss)
+ println(typeOf[C].member(newTermName("y4")).asMethod.paramss)
} \ No newline at end of file
diff --git a/test/files/run/reflection-valueclasses-magic.scala b/test/files/run/reflection-valueclasses-magic.scala
index f9feb2d504..a40b570774 100644
--- a/test/files/run/reflection-valueclasses-magic.scala
+++ b/test/files/run/reflection-valueclasses-magic.scala
@@ -7,7 +7,7 @@ object Test extends App {
def key(sym: Symbol) = {
sym match {
// initialize parameter symbols
- case meth: MethodSymbol => meth.params.flatten.map(_.typeSignature)
+ case meth: MethodSymbol => meth.paramss.flatten.map(_.typeSignature)
}
sym + ": " + sym.typeSignature
}
@@ -41,8 +41,8 @@ object Test extends App {
val meth = tpe.declaration(newTermName(method).encodedName.toTermName)
val testees = if (meth.isMethod) List(meth.asMethod) else meth.asTerm.alternatives.map(_.asMethod)
testees foreach (testee => {
- val convertedArgs = args.zipWithIndex.map { case (arg, i) => convert(arg, testee.params.flatten.apply(i).typeSignature) }
- print(s"testing ${tpe.typeSymbol.name}.$method(${testee.params.flatten.map(_.typeSignature).mkString(','.toString)}) with receiver = $receiver and args = ${convertedArgs.map(arg => arg + ' '.toString + arg.getClass).toList}: ")
+ val convertedArgs = args.zipWithIndex.map { case (arg, i) => convert(arg, testee.paramss.flatten.apply(i).typeSignature) }
+ print(s"testing ${tpe.typeSymbol.name}.$method(${testee.paramss.flatten.map(_.typeSignature).mkString(','.toString)}) with receiver = $receiver and args = ${convertedArgs.map(arg => arg + ' '.toString + arg.getClass).toList}: ")
wrap(cm.reflect(receiver).reflectMethod(testee)(convertedArgs: _*))
})
}
diff --git a/test/pending/run/t5882.scala b/test/pending/run/t5882.scala
new file mode 100644
index 0000000000..47996d3068
--- /dev/null
+++ b/test/pending/run/t5882.scala
@@ -0,0 +1,14 @@
+// SIP-15 was revised to allow nested classes in value classes.
+// This test checks that their basic functionality.
+
+class NodeOps(val n: Any) extends AnyVal { self =>
+ class Foo() { def show = self.show(n) }
+ def show(x: Any) = x.toString
+}
+
+
+object Test extends App {
+
+ val n = new NodeOps("abc")
+ assert(new n.Foo().show == "abc")
+}
diff --git a/test/pending/run/t6408.scala b/test/pending/run/t6408.scala
new file mode 100644
index 0000000000..ff17480b35
--- /dev/null
+++ b/test/pending/run/t6408.scala
@@ -0,0 +1,11 @@
+class X(val i: Int) extends AnyVal {
+ class Inner(val q: Int) {
+ def plus = i + q
+ }
+}
+
+object Test extends App {
+ val x = new X(11)
+ val i = new x.Inner(22)
+ assert(i.plus == 33)
+}