summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-08-29 08:25:26 -0700
committerPaul Phillips <paulp@improving.org>2012-08-29 10:20:43 -0700
commitd3f879a6b0165310bb756b811ea3f97685533948 (patch)
tree759f4ff95bc81c10a654d4f6d4c5c9d3ce82cbce /test
parente03a5b766be27a1f43c9151a611b04519a2b15df (diff)
downloadscala-d3f879a6b0165310bb756b811ea3f97685533948.tar.gz
scala-d3f879a6b0165310bb756b811ea3f97685533948.tar.bz2
scala-d3f879a6b0165310bb756b811ea3f97685533948.zip
Expanded the reach of value classes.
Now extending AnyVal: - RichInt, RichDouble, etc. - ArrayOps.ofRef, ofBoolean, etc - StringAdd - StringFormat The rest of it is the changes necessary to enable those.
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/t900.check4
-rw-r--r--test/files/neg/unit2anyref.check2
-rw-r--r--test/files/run/richWrapperEquals.scala4
-rw-r--r--test/files/run/t5356.check8
-rw-r--r--test/files/run/t5356.scala6
5 files changed, 7 insertions, 17 deletions
diff --git a/test/files/neg/t900.check b/test/files/neg/t900.check
index 4611ceba8c..ff5304a135 100644
--- a/test/files/neg/t900.check
+++ b/test/files/neg/t900.check
@@ -1,10 +1,6 @@
t900.scala:4: error: type mismatch;
found : Foo.this.x.type (with underlying type Foo.this.bar)
required: AnyRef
-Note that implicit conversions are not applicable because they are ambiguous:
- both method any2stringfmt in object Predef of type (x: Any)scala.runtime.StringFormat
- and method any2stringadd in object Predef of type (x: Any)scala.runtime.StringAdd
- are possible conversion functions from Foo.this.x.type to AnyRef
def break(): x.type
^
one error found
diff --git a/test/files/neg/unit2anyref.check b/test/files/neg/unit2anyref.check
index 10fe1861f5..6d11461700 100644
--- a/test/files/neg/unit2anyref.check
+++ b/test/files/neg/unit2anyref.check
@@ -1,8 +1,6 @@
unit2anyref.scala:2: error: type mismatch;
found : Unit
required: AnyRef
-Note: Unit is not implicitly converted to AnyRef. You can safely
-pattern match `x: AnyRef` or cast `x.asInstanceOf[AnyRef]` to do so.
val x: AnyRef = () // this should not succeed.
^
one error found
diff --git a/test/files/run/richWrapperEquals.scala b/test/files/run/richWrapperEquals.scala
index 44beb133b3..4a43617cde 100644
--- a/test/files/run/richWrapperEquals.scala
+++ b/test/files/run/richWrapperEquals.scala
@@ -1,10 +1,6 @@
object Test {
def main(args: Array[String]): Unit = {
- assert(intWrapper(5) == 5)
- assert(5 == intWrapper(5))
assert(5 == (5: java.lang.Integer))
assert((5: java.lang.Integer) == 5)
- assert((5: java.lang.Integer) == intWrapper(5))
- assert(intWrapper(5) == (5: java.lang.Integer))
}
}
diff --git a/test/files/run/t5356.check b/test/files/run/t5356.check
index 21c4aef07b..7522e7ea74 100644
--- a/test/files/run/t5356.check
+++ b/test/files/run/t5356.check
@@ -1,6 +1,6 @@
-1 scala.runtime.RichInt
-1 scala.runtime.RichInt
+1 java.lang.Integer
+1 java.lang.Integer
1 scala.math.BigInt
-1 scala.runtime.RichDouble
-1 scala.runtime.RichFloat
+1 java.lang.Double
+1 java.lang.Float
1
diff --git a/test/files/run/t5356.scala b/test/files/run/t5356.scala
index f7696c6088..ec17e036ad 100644
--- a/test/files/run/t5356.scala
+++ b/test/files/run/t5356.scala
@@ -1,12 +1,12 @@
object Test {
- def f(x: { def toInt: Int }) = println(x.toInt + " " + x.getClass.getName)
-
+ def f(x: Any { def toInt: Int }) = println(x.toInt + " " + x.getClass.getName)
+
def main(args: Array[String]): Unit = {
f(1)
f(1.toInt)
f(BigInt(1))
f(1d)
f(1f)
- println((1: { def toInt: Int }).toInt)
+ println((1: (Any { def toInt: Int })).toInt)
}
}