summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-09-26 23:49:03 +0000
committerPaul Phillips <paulp@improving.org>2011-09-26 23:49:03 +0000
commite412524fee20da975954c929893e88db17dbdd9a (patch)
treee7c491b8d303879b49426d98f714d81c672d885f /test
parent660d80f682317eaf3d55a9b63bb95396ac417cdd (diff)
downloadscala-e412524fee20da975954c929893e88db17dbdd9a.tar.gz
scala-e412524fee20da975954c929893e88db17dbdd9a.tar.bz2
scala-e412524fee20da975954c929893e88db17dbdd9a.zip
ProductN, and method synthesis toolbox.
- Finished giving case classes a ProductN parent, and flipped it on. The "finish" part involved not breaking existing code where case classes manually extend the appropriate ProductN. (Like, Tuple 1-22.) - Generalized most of SyntheticMethods to ease method creation and class manipulation in general. - Fixed bugs related to the above, like the fact that this used to be a compile error: scala> case class Foo() extends Serializable <console>:28: error: trait Serializable is inherited twice case class Foo() extends Serializable ^ It feels like there's a better way to eliminate the duplicate parents, but after spending a lot of time chasing my tail in that peril-fraught zone between namer and typer, I don't see an easy path to improve on it. Closes SI-1799. For that modification to Typers, review by odersky.
Diffstat (limited to 'test')
-rw-r--r--test/files/pos/caseclass-parents.flags1
-rw-r--r--test/files/pos/caseclass-parents.scala11
-rw-r--r--test/files/run/inline-ex-handlers.check141
-rw-r--r--test/files/scalap/caseClass/result.test13
-rw-r--r--test/files/scalap/caseObject/result.test11
5 files changed, 90 insertions, 87 deletions
diff --git a/test/files/pos/caseclass-parents.flags b/test/files/pos/caseclass-parents.flags
new file mode 100644
index 0000000000..e1b37447c9
--- /dev/null
+++ b/test/files/pos/caseclass-parents.flags
@@ -0,0 +1 @@
+-Xexperimental \ No newline at end of file
diff --git a/test/files/pos/caseclass-parents.scala b/test/files/pos/caseclass-parents.scala
new file mode 100644
index 0000000000..d4bc52154b
--- /dev/null
+++ b/test/files/pos/caseclass-parents.scala
@@ -0,0 +1,11 @@
+case class Foo() extends Serializable
+case object Bar extends Serializable
+
+case class Bippy[T, U](x: T, y: U) extends Product2[T, U] { }
+
+case class Bounded[T <: util.Random, U <: util.Random](x: T, y: U) { }
+
+class A {
+ def f(x: Bounded[_, _]) = x.productIterator foreach g
+ def g(rand: util.Random) = ()
+} \ No newline at end of file
diff --git a/test/files/run/inline-ex-handlers.check b/test/files/run/inline-ex-handlers.check
index 29daca3471..0c65d8d6b3 100644
--- a/test/files/run/inline-ex-handlers.check
+++ b/test/files/run/inline-ex-handlers.check
@@ -1,49 +1,36 @@
-268c268
-< locals: value x$1, value temp1
----
-> locals: value x$1, value temp1, variable boxed1
-270c270
-< blocks: [1,2,3,4]
----
-> blocks: [1,2,3]
-283,285d282
-< 92 JUMP 4
-<
-< 4:
-291a289,290
-> 92 STORE_LOCAL(variable boxed1)
-> 92 LOAD_LOCAL(variable boxed1)
-372c371
+422c422
< blocks: [1,2,3,4,5,7,8,10]
---
> blocks: [1,2,3,4,5,7,8,10,11]
-396c395,404
+446c446,447
< 103 THROW(MyException)
---
> ? STORE_LOCAL(value ex$1)
> ? JUMP 11
->
+447a449,456
> 11:
> 101 LOAD_LOCAL(value ex$1)
-> 101 STORE_LOCAL(value temp2)
-> 101 SCOPE_ENTER value temp2
-> 101 LOAD_LOCAL(value temp2)
+> 101 STORE_LOCAL(value temp1)
+> 101 SCOPE_ENTER value temp1
+> 101 LOAD_LOCAL(value temp1)
> 101 IS_INSTANCE REF(class MyException)
> 101 CZJUMP (BOOL)NE ? 4 : 5
-487c495
+>
+537c546
< blocks: [1,2,3,4,6,7,8,9,10]
---
> blocks: [1,2,3,4,6,7,8,9,10,11,12,13]
-516c524,529
+566c575
< 306 THROW(MyException)
---
> ? JUMP 11
->
+567a577,581
> 11:
> ? LOAD_LOCAL(variable monitor4)
> 305 MONITOR_EXIT
> ? JUMP 12
-522c535,541
+>
+572c586,592
< ? THROW(Throwable)
---
> ? JUMP 12
@@ -53,7 +40,7 @@
> 304 MONITOR_EXIT
> ? STORE_LOCAL(value t)
> ? JUMP 13
-528c547,560
+578c598,611
< ? THROW(Throwable)
---
> ? STORE_LOCAL(value t)
@@ -70,19 +57,19 @@
> 310 CALL_PRIMITIVE(EndConcat)
> 310 CALL_METHOD scala.Predef.println (dynamic)
> 310 JUMP 2
-552c584
+602c635
< catch (Throwable) in ArrayBuffer(7, 8, 9, 10) starting at: 6
---
> catch (Throwable) in ArrayBuffer(7, 8, 9, 10, 11) starting at: 6
-555c587
+605c638
< catch (Throwable) in ArrayBuffer(4, 6, 7, 8, 9, 10) starting at: 3
---
> catch (Throwable) in ArrayBuffer(4, 6, 7, 8, 9, 10, 11, 12) starting at: 3
-587c619
+637c670
< blocks: [1,2,3,4,5,6,7,9,10]
---
> blocks: [1,2,3,4,5,6,7,9,10,11,12]
-611c643,649
+661c694,700
< 78 THROW(IllegalArgumentException)
---
> ? STORE_LOCAL(value e)
@@ -92,7 +79,7 @@
> 81 LOAD_LOCAL(value e)
> ? STORE_LOCAL(variable exc1)
> ? JUMP 12
-640c678,692
+690c729,743
< 81 THROW(Exception)
---
> ? STORE_LOCAL(variable exc1)
@@ -110,33 +97,34 @@
> 84 STORE_LOCAL(variable result)
> 84 LOAD_LOCAL(variable exc1)
> 84 THROW(Throwable)
-662c714
+712c765
< catch (<none>) in ArrayBuffer(4, 6, 7, 9) starting at: 3
---
> catch (<none>) in ArrayBuffer(4, 6, 7, 9, 11) starting at: 3
-688c740
+738c791
< blocks: [1,2,3,4,5,6,7,8,11,12,13,14,15,16,18,19]
---
> blocks: [1,2,3,4,5,6,7,8,11,12,13,14,15,16,18,19,20,21,22]
-712c764,773
+762c815,816
< 172 THROW(MyException)
---
> ? STORE_LOCAL(value ex$4)
> ? JUMP 20
->
+763a818,825
> 20:
> 170 LOAD_LOCAL(value ex$4)
-> 170 STORE_LOCAL(value temp11)
-> 170 SCOPE_ENTER value temp11
-> 170 LOAD_LOCAL(value temp11)
+> 170 STORE_LOCAL(value temp10)
+> 170 SCOPE_ENTER value temp10
+> 170 LOAD_LOCAL(value temp10)
> 170 IS_INSTANCE REF(class MyException)
> 170 CZJUMP (BOOL)NE ? 12 : 13
-766c827,828
+>
+816c878,879
< 177 THROW(MyException)
---
> ? STORE_LOCAL(value ex$5)
> ? JUMP 21
-770c832,841
+820c883,892
< 170 THROW(Throwable)
---
> ? STORE_LOCAL(value ex$5)
@@ -144,22 +132,22 @@
>
> 21:
> 169 LOAD_LOCAL(value ex$5)
-> 169 STORE_LOCAL(value temp14)
-> 169 SCOPE_ENTER value temp14
-> 169 LOAD_LOCAL(value temp14)
+> 169 STORE_LOCAL(value temp13)
+> 169 SCOPE_ENTER value temp13
+> 169 LOAD_LOCAL(value temp13)
> 169 IS_INSTANCE REF(class MyException)
> 169 CZJUMP (BOOL)NE ? 5 : 6
-801c872,873
+851c923,924
< 182 THROW(MyException)
---
> ? STORE_LOCAL(variable exc2)
> ? JUMP 22
-805c877,891
+855c928,929
< 169 THROW(Throwable)
---
> ? STORE_LOCAL(variable exc2)
> ? JUMP 22
->
+856a931,943
> 22:
> 184 LOAD_MODULE object Predef
> 184 CONSTANT("finally")
@@ -172,19 +160,20 @@
> 185 STORE_LOCAL(variable result)
> 185 LOAD_LOCAL(variable exc2)
> 185 THROW(Throwable)
-827c913
+>
+877c964
< catch (Throwable) in ArrayBuffer(11, 12, 13, 14, 15, 16, 18) starting at: 4
---
> catch (Throwable) in ArrayBuffer(11, 12, 13, 14, 15, 16, 18, 20) starting at: 4
-830c916
+880c967
< catch (<none>) in ArrayBuffer(4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 18) starting at: 3
---
> catch (<none>) in ArrayBuffer(4, 5, 6, 7, 11, 12, 13, 14, 15, 16, 18, 20, 21) starting at: 3
-856c942
+906c993
< blocks: [1,2,3,6,7,8,10,11,13]
---
> blocks: [1,2,3,6,7,8,10,11,13,14]
-880c966,975
+930c1017,1026
< 124 THROW(MyException)
---
> ? STORE_LOCAL(value ex$2)
@@ -192,20 +181,20 @@
>
> 14:
> 122 LOAD_LOCAL(value ex$2)
-> 122 STORE_LOCAL(value temp5)
-> 122 SCOPE_ENTER value temp5
-> 122 LOAD_LOCAL(value temp5)
+> 122 STORE_LOCAL(value temp4)
+> 122 SCOPE_ENTER value temp4
+> 122 LOAD_LOCAL(value temp4)
> 122 IS_INSTANCE REF(class MyException)
> 122 CZJUMP (BOOL)NE ? 7 : 8
-928c1023
+978c1074
< catch (IllegalArgumentException) in ArrayBuffer(6, 7, 8, 10, 11, 13) starting at: 3
---
> catch (IllegalArgumentException) in ArrayBuffer(6, 7, 8, 10, 11, 13, 14) starting at: 3
-954c1049
+1004c1100
< blocks: [1,2,3,4,5,9,10,11,13]
---
> blocks: [1,2,3,4,5,9,10,11,13,14]
-978c1073,1082
+1028c1124,1133
< 148 THROW(MyException)
---
> ? STORE_LOCAL(value ex$3)
@@ -213,16 +202,16 @@
>
> 14:
> 145 LOAD_LOCAL(value ex$3)
-> 145 STORE_LOCAL(value temp8)
-> 145 SCOPE_ENTER value temp8
-> 145 LOAD_LOCAL(value temp8)
+> 145 STORE_LOCAL(value temp7)
+> 145 SCOPE_ENTER value temp7
+> 145 LOAD_LOCAL(value temp7)
> 145 IS_INSTANCE REF(class MyException)
> 145 CZJUMP (BOOL)NE ? 4 : 5
-1222c1326
+1272c1377
< blocks: [1,2,3,4,5,7]
---
> blocks: [1,2,3,4,5,7,8]
-1246c1350,1357
+1296c1401,1408
< 38 THROW(IllegalArgumentException)
---
> ? STORE_LOCAL(value e)
@@ -233,16 +222,16 @@
> 42 CONSTANT("IllegalArgumentException")
> 42 CALL_METHOD scala.Predef.println (dynamic)
> 42 JUMP 2
-1295c1406
+1345c1457
< blocks: [1,2,3,4,5,7,8,10,11,13]
---
> blocks: [1,2,3,4,5,7,8,10,11,13,14]
-1319c1430,1431
+1369c1481,1482
< 203 THROW(MyException)
---
> ? STORE_LOCAL(value ex$6)
> ? JUMP 14
-1339c1451,1460
+1389c1502,1511
< 209 THROW(MyException)
---
> ? STORE_LOCAL(value ex$6)
@@ -250,16 +239,16 @@
>
> 14:
> 200 LOAD_LOCAL(value ex$6)
-> 200 STORE_LOCAL(value temp17)
-> 200 SCOPE_ENTER value temp17
-> 200 LOAD_LOCAL(value temp17)
+> 200 STORE_LOCAL(value temp16)
+> 200 SCOPE_ENTER value temp16
+> 200 LOAD_LOCAL(value temp16)
> 200 IS_INSTANCE REF(class MyException)
> 200 CZJUMP (BOOL)NE ? 4 : 5
-1402c1523
+1452c1574
< blocks: [1,2,3,4,5,7]
---
> blocks: [1,2,3,4,5,7,8]
-1426c1547,1554
+1476c1598,1605
< 58 THROW(IllegalArgumentException)
---
> ? STORE_LOCAL(value e)
@@ -270,11 +259,11 @@
> 62 CONSTANT("RuntimeException")
> 62 CALL_METHOD scala.Predef.println (dynamic)
> 62 JUMP 2
-1475c1603
+1525c1654
< blocks: [1,2,3,4]
---
> blocks: [1,2,3,4,5]
-1495c1623,1628
+1545c1674,1679
< 229 THROW(MyException)
---
> ? JUMP 5
@@ -283,19 +272,19 @@
> ? LOAD_LOCAL(variable monitor1)
> 228 MONITOR_EXIT
> 228 THROW(Throwable)
-1501c1634
+1551c1685
< ? THROW(Throwable)
---
> 228 THROW(Throwable)
-1529c1662
+1579c1713
< locals: value args, variable result, variable monitor2, variable monitorResult1
---
> locals: value exception$1, value args, variable result, variable monitor2, variable monitorResult1
-1531c1664
+1581c1715
< blocks: [1,2,3,4]
---
> blocks: [1,2,3,4,5]
-1554c1687,1695
+1604c1738,1746
< 245 THROW(MyException)
---
> ? STORE_LOCAL(value exception$1)
@@ -307,7 +296,7 @@
> ? LOAD_LOCAL(variable monitor2)
> 244 MONITOR_EXIT
> 244 THROW(Throwable)
-1560c1701
+1610c1752
< ? THROW(Throwable)
---
> 244 THROW(Throwable)
diff --git a/test/files/scalap/caseClass/result.test b/test/files/scalap/caseClass/result.test
index 9b65be4b48..d243ae640b 100644
--- a/test/files/scalap/caseClass/result.test
+++ b/test/files/scalap/caseClass/result.test
@@ -1,13 +1,14 @@
-case class CaseClass[A <: scala.Seq[scala.Int]](i : A, s : scala.Predef.String) extends java.lang.Object with scala.ScalaObject with scala.Product with scala.Serializable {
+case class CaseClass[A <: scala.Seq[scala.Int]](i : A, s : scala.Predef.String) extends java.lang.Object with scala.ScalaObject with scala.Product with scala.Serializable with scala.Product2[A, scala.Predef.String] {
val i : A = { /* compiled code */ }
val s : scala.Predef.String = { /* compiled code */ }
def foo : scala.Int = { /* compiled code */ }
def copy[A <: scala.Seq[scala.Int]](i : A, s : scala.Predef.String) : CaseClass[A] = { /* compiled code */ }
+ override def productPrefix : java.lang.String = { /* compiled code */ }
+ override def productIterator : scala.collection.Iterator[scala.Any] = { /* compiled code */ }
+ def canEqual(x$1 : scala.Any) : scala.Boolean = { /* compiled code */ }
+ def _1 : A = { /* compiled code */ }
+ def _2 : scala.Predef.String = { /* compiled code */ }
override def hashCode() : scala.Int = { /* compiled code */ }
- override def toString() : scala.Predef.String = { /* compiled code */ }
+ override def toString() : java.lang.String = { /* compiled code */ }
override def equals(x$1 : scala.Any) : scala.Boolean = { /* compiled code */ }
- override def productPrefix : java.lang.String = { /* compiled code */ }
- override def productArity : scala.Int = { /* compiled code */ }
- override def productElement(x$1 : scala.Int) : scala.Any = { /* compiled code */ }
- override def canEqual(x$1 : scala.Any) : scala.Boolean = { /* compiled code */ }
}
diff --git a/test/files/scalap/caseObject/result.test b/test/files/scalap/caseObject/result.test
index 556c5554a2..8f8da7d9bd 100644
--- a/test/files/scalap/caseObject/result.test
+++ b/test/files/scalap/caseObject/result.test
@@ -1,10 +1,11 @@
case object CaseObject extends java.lang.Object with scala.ScalaObject with scala.Product with scala.Serializable {
def bar : scala.Int = { /* compiled code */ }
- final override def hashCode() : scala.Int = { /* compiled code */ }
- final override def toString() : java.lang.String = { /* compiled code */ }
override def productPrefix : java.lang.String = { /* compiled code */ }
- override def productArity : scala.Int = { /* compiled code */ }
- override def productElement(x$1 : scala.Int) : scala.Any = { /* compiled code */ }
- override def canEqual(x$1 : scala.Any) : scala.Boolean = { /* compiled code */ }
+ def productArity : scala.Int = { /* compiled code */ }
+ def productElement(x$1 : scala.Int) : scala.Any = { /* compiled code */ }
+ override def productIterator : scala.collection.Iterator[scala.Any] = { /* compiled code */ }
+ def canEqual(x$1 : scala.Any) : scala.Boolean = { /* compiled code */ }
+ override def hashCode() : scala.Int = { /* compiled code */ }
+ override def toString() : java.lang.String = { /* compiled code */ }
protected def readResolve() : java.lang.Object = { /* compiled code */ }
}