summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-10-31 07:15:01 -0700
committerPaul Phillips <paulp@improving.org>2012-10-31 07:54:24 -0700
commit202a949afeb4877318432ffff8e3ffdc14df9615 (patch)
tree4021376fcbcfe5d8bc5066ec6d9039fdd2097f88 /test
parentb480d991072e6e68ed46574d87e4483da778ff0e (diff)
parent8aec78470637f42f50981f8034215a709602dbad (diff)
downloadscala-202a949afeb4877318432ffff8e3ffdc14df9615.tar.gz
scala-202a949afeb4877318432ffff8e3ffdc14df9615.tar.bz2
scala-202a949afeb4877318432ffff8e3ffdc14df9615.zip
Merge branch 'merge-2.10.0-wip' into merge-2.10.x
* merge-2.10.0-wip: Use Typed rather than .setType Wider use and a new variant of typedPos. SI-6575 Plug inference leak of AbstractPartialFun Remove compiler phases that don't influence scaladoc generation. Disabled generation of _1, _2, etc. methods. SI-6526 Additional test case. Fix SI-6552, regression with self types. avoid single-art assert where harmful in duration-tck Fix for SI-6537, inaccurate unchecked warning. Crash on missing accessor (internal bug in the lazy vals implementation) instead of trying to recover from the bug Incorporated changes suggested in code review Added one more test for SI-6358 Closes SI-6358. Move accessor generation for lazy vals to typers. SI-6526 Tail call elimination should descend deeper. Remove unneeded calls to substring() Changes Tree and Type members from vals to defs. Scaladoc knows the package structure of the libraries, so don't include them in external documentation setting. Fixes SI-6170: issue with dragging scaladoc splitter over central iframe Added a Swing ColorChooser wrapper Added a Swing PopupMenu wrapper Conflicts: src/compiler/scala/reflect/reify/phases/Reshape.scala src/compiler/scala/tools/nsc/typechecker/Duplicators.scala src/continuations/plugin/scala/tools/selectivecps/SelectiveCPSTransform.scala src/reflect/scala/reflect/internal/Types.scala test/files/neg/unchecked-knowable.check
Diffstat (limited to 'test')
-rw-r--r--test/files/jvm/duration-tck.scala11
-rw-r--r--test/files/neg/t6526.check16
-rw-r--r--test/files/neg/t6526.scala41
-rw-r--r--test/files/neg/unchecked-knowable.check7
-rw-r--r--test/files/neg/unchecked-knowable.scala4
-rw-r--r--test/files/pos/t6537.flags1
-rw-r--r--test/files/pos/t6537.scala16
-rw-r--r--test/files/pos/t6552.scala8
-rw-r--r--test/files/pos/t6575a.scala15
-rw-r--r--test/files/pos/t6575b.scala17
-rw-r--r--test/files/run/inline-ex-handlers.check130
-rw-r--r--test/files/run/t1195-new.check4
-rw-r--r--test/files/run/virtpatmat_extends_product.scala7
-rw-r--r--test/files/scalap/caseClass/result.test2
-rwxr-xr-xtest/scaladoc/run/SI-191-deprecated.check1
-rwxr-xr-xtest/scaladoc/run/SI-191-deprecated.scala71
-rwxr-xr-xtest/scaladoc/run/SI-191.check1
-rwxr-xr-xtest/scaladoc/run/SI-191.scala76
18 files changed, 350 insertions, 78 deletions
diff --git a/test/files/jvm/duration-tck.scala b/test/files/jvm/duration-tck.scala
index df1052fed3..d0f13816a6 100644
--- a/test/files/jvm/duration-tck.scala
+++ b/test/files/jvm/duration-tck.scala
@@ -170,11 +170,14 @@ object Test extends App {
// test Deadline
val dead = 2.seconds.fromNow
val dead2 = 2 seconds fromNow
- assert(dead.timeLeft > 1.second)
- assert(dead2.timeLeft > 1.second)
+
+ { val l = dead.timeLeft; assert(l > 1.second, s"$l <= 1.second") }
+ { val l = dead2.timeLeft; assert(l > 1.second, s"$l <= 1.second") }
+
Thread.sleep(1.second.toMillis)
- assert(dead.timeLeft < 1.second)
- assert(dead2.timeLeft < 1.second)
+
+ { val l = dead.timeLeft; assert(l <= 1.second, s"$l > 1.second") }
+ { val l = dead2.timeLeft; assert(l <= 1.second, s"$l > 1.second") }
// test integer mul/div
diff --git a/test/files/neg/t6526.check b/test/files/neg/t6526.check
new file mode 100644
index 0000000000..606c18c301
--- /dev/null
+++ b/test/files/neg/t6526.check
@@ -0,0 +1,16 @@
+t6526.scala:8: error: could not optimize @tailrec annotated method inner: it contains a recursive call not in tail position
+ @tailrec def inner(i: Int): Int = 1 + inner(i)
+ ^
+t6526.scala:14: error: could not optimize @tailrec annotated method inner: it contains a recursive call not in tail position
+ @tailrec def inner(i: Int): Int = 1 + inner(i)
+ ^
+t6526.scala:20: error: could not optimize @tailrec annotated method inner: it contains a recursive call not in tail position
+ @tailrec def inner(i: Int): Int = 1 + inner(i)
+ ^
+t6526.scala:30: error: could not optimize @tailrec annotated method inner: it contains a recursive call not in tail position
+ @tailrec def inner(i: Int): Int = 1 + inner(i)
+ ^
+t6526.scala:39: error: could not optimize @tailrec annotated method inner: it contains a recursive call not in tail position
+ def inner(i: Int): Int = 1 + inner(i)
+ ^
+5 errors found
diff --git a/test/files/neg/t6526.scala b/test/files/neg/t6526.scala
new file mode 100644
index 0000000000..0bc249aa98
--- /dev/null
+++ b/test/files/neg/t6526.scala
@@ -0,0 +1,41 @@
+import scala.annotation.tailrec
+
+class TailRec {
+ def bar(f: => Any) = ""
+
+ // transform the qualifier of a Select
+ bar {
+ @tailrec def inner(i: Int): Int = 1 + inner(i)
+ inner(0)
+ }.length
+
+ // transform the body of a function
+ () => {
+ @tailrec def inner(i: Int): Int = 1 + inner(i)
+ inner(0)
+ }
+
+ // transform the qualifier of a Select
+ {
+ @tailrec def inner(i: Int): Int = 1 + inner(i)
+ inner(0)
+ ""
+ }.length
+
+ // The receiver of a tail recursive call must itself be transformed
+ object X {
+ @tailrec // okay, all other annotated methods should fail.
+ def foo: Any = {
+ {
+ @tailrec def inner(i: Int): Int = 1 + inner(i)
+ inner(0)
+ this
+ }.foo
+ }
+ }
+
+ Some(new AnyRef) map { phooie =>
+ @tailrec
+ def inner(i: Int): Int = 1 + inner(i)
+ } getOrElse 42
+}
diff --git a/test/files/neg/unchecked-knowable.check b/test/files/neg/unchecked-knowable.check
index 28e2d67920..327a5f202d 100644
--- a/test/files/neg/unchecked-knowable.check
+++ b/test/files/neg/unchecked-knowable.check
@@ -1,6 +1,9 @@
-unchecked-knowable.scala:17: warning: fruitless type test: a value of type Bippy cannot also be a A1
+unchecked-knowable.scala:18: warning: fruitless type test: a value of type Bippy cannot also be a A1
/* warn */ (new Bippy).isInstanceOf[A1]
^
+unchecked-knowable.scala:19: warning: fruitless type test: a value of type Bippy cannot also be a B1
+ /* warn */ (new Bippy).isInstanceOf[B1]
+ ^
error: No warnings can be incurred under -Xfatal-warnings.
-one warning found
+two warnings found
one error found
diff --git a/test/files/neg/unchecked-knowable.scala b/test/files/neg/unchecked-knowable.scala
index 667b47f504..21624c4fb4 100644
--- a/test/files/neg/unchecked-knowable.scala
+++ b/test/files/neg/unchecked-knowable.scala
@@ -7,6 +7,7 @@ final class A4 extends A2
/** Unknowable */
sealed abstract class B1
sealed abstract class B2 extends B1
+sealed trait B2B extends B1
final class B3 extends B1
trait B4 extends B2
@@ -15,6 +16,7 @@ trait Dingus
class A {
/* warn */ (new Bippy).isInstanceOf[A1]
- /* nowarn */ (new Bippy).isInstanceOf[B1]
+ /* warn */ (new Bippy).isInstanceOf[B1]
+ /* nowarn */ (null: Dingus).isInstanceOf[B1]
/* nowarn */ ((new Bippy): Any).isInstanceOf[A1]
}
diff --git a/test/files/pos/t6537.flags b/test/files/pos/t6537.flags
new file mode 100644
index 0000000000..85d8eb2ba2
--- /dev/null
+++ b/test/files/pos/t6537.flags
@@ -0,0 +1 @@
+-Xfatal-warnings
diff --git a/test/files/pos/t6537.scala b/test/files/pos/t6537.scala
new file mode 100644
index 0000000000..d0ca3ba435
--- /dev/null
+++ b/test/files/pos/t6537.scala
@@ -0,0 +1,16 @@
+package tester
+
+object PatMatWarning {
+
+ sealed trait X
+ sealed trait Y
+
+ def f(x: X) = x match {
+ case _: Y => false
+ case _ => true
+ }
+
+ class X1 extends X
+ class Y1 extends Y
+ class Z1 extends X with Y
+}
diff --git a/test/files/pos/t6552.scala b/test/files/pos/t6552.scala
new file mode 100644
index 0000000000..98e686a1ae
--- /dev/null
+++ b/test/files/pos/t6552.scala
@@ -0,0 +1,8 @@
+object Repros {
+ class Bar {}
+ class Baz(val myFoo: Foo) { }
+ trait Foo {
+ this: Bar =>
+ val thing = new Baz(this)
+ }
+}
diff --git a/test/files/pos/t6575a.scala b/test/files/pos/t6575a.scala
new file mode 100644
index 0000000000..f128714dab
--- /dev/null
+++ b/test/files/pos/t6575a.scala
@@ -0,0 +1,15 @@
+trait X { def foo: PartialFunction[Int, Int] }
+
+trait Y extends X {
+ // Inferred type was AbstractPartialFunction[Int, Int] with Serializable
+ abstract override def foo = { case i => super.foo(i) * 2 }
+}
+trait Z extends X {
+ // ditto
+ abstract override def foo = { case i => super.foo(i) + 3 }
+}
+
+trait Comb extends Y with Z {
+ // ... which led to a type error here.
+ abstract override def foo: PartialFunction[Int, Int] = { case i => super.foo(i) - 2 }
+}
diff --git a/test/files/pos/t6575b.scala b/test/files/pos/t6575b.scala
new file mode 100644
index 0000000000..d3e58b2a16
--- /dev/null
+++ b/test/files/pos/t6575b.scala
@@ -0,0 +1,17 @@
+// inferred types were okay here as Function nodes aren't
+// translated into anoymous subclasses of AbstractFunctionN
+// until after the typer.
+//
+// So this test is just confirmation.
+trait X { def foo: Function1[Int, Int] }
+
+trait Y extends X {
+ abstract override def foo = { case i => super.foo(i) * 2 }
+}
+trait Z extends X {
+ abstract override def foo = { case i => super.foo(i) + 3 }
+}
+
+trait Comb extends Y with Z {
+ abstract override def foo: Function1[Int, Int] = { case i => super.foo(i) - 2 }
+}
diff --git a/test/files/run/inline-ex-handlers.check b/test/files/run/inline-ex-handlers.check
index 2bc72893e7..e786c780d6 100644
--- a/test/files/run/inline-ex-handlers.check
+++ b/test/files/run/inline-ex-handlers.check
@@ -13,15 +13,15 @@
< 92 JUMP 2
<
< 2:
-383c382
+370c369
< locals: value args, variable result, value ex6, value x4, value x5, value message, value x
---
> locals: value args, variable result, value ex6, value x4, value x5, value x
-385c384
+372c371
< blocks: [1,2,3,4,5,8,11,13,14,16]
---
> blocks: [1,2,3,5,8,11,13,14,16,17]
-409c408,417
+396c395,404
< 103 THROW(MyException)
---
> ? STORE_LOCAL(value ex6)
@@ -34,25 +34,25 @@
> 106 LOAD_LOCAL(value x4)
> 106 IS_INSTANCE REF(class MyException)
> 106 CZJUMP (BOOL)NE ? 5 : 11
-422,424d429
+409,411d416
< 101 JUMP 4
<
< 4:
-438,441d442
+425,428d429
< 106 LOAD_LOCAL(value x5)
< 106 CALL_METHOD MyException.message (dynamic)
< 106 STORE_LOCAL(value message)
< 106 SCOPE_ENTER value message
-443c444,445
+430c431,432
< 106 LOAD_LOCAL(value message)
---
> ? LOAD_LOCAL(value x5)
> ? CALL_METHOD MyException.message (dynamic)
-515c517
+502c504
< blocks: [1,2,3,4,6,7,8,9,10]
---
> blocks: [1,2,3,4,6,7,8,9,10,11,12,13]
-544c546,551
+531c533,538
< 306 THROW(MyException)
---
> ? JUMP 11
@@ -61,11 +61,11 @@
> ? LOAD_LOCAL(variable monitor4)
> 305 MONITOR_EXIT
> ? JUMP 12
-550c557
+537c544
< ? THROW(Throwable)
---
> ? JUMP 12
-556c563,570
+543c550,557
< ? THROW(Throwable)
---
> ? STORE_LOCAL(value t)
@@ -76,7 +76,7 @@
> 304 MONITOR_EXIT
> ? STORE_LOCAL(value t)
> ? JUMP 13
-571a586,597
+558a573,584
> 13:
> 310 LOAD_MODULE object Predef
> 310 CALL_PRIMITIVE(StartConcat)
@@ -89,19 +89,19 @@
> 310 CALL_METHOD scala.Predef.println (dynamic)
> 310 JUMP 2
>
-580c606
+567c593
< catch (Throwable) in ArrayBuffer(7, 8, 9, 10) starting at: 6
---
> catch (Throwable) in ArrayBuffer(7, 8, 9, 10, 11) starting at: 6
-583c609
+570c596
< 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
-615c641
+602c628
< blocks: [1,2,3,4,5,6,7,9,10]
---
> blocks: [1,2,3,4,5,6,7,9,10,11,12]
-639c665,671
+626c652,658
< 78 THROW(IllegalArgumentException)
---
> ? STORE_LOCAL(value e)
@@ -111,12 +111,12 @@
> 81 LOAD_LOCAL(value e)
> ? STORE_LOCAL(variable exc1)
> ? JUMP 12
-668c700,701
+655c687,688
< 81 THROW(Exception)
---
> ? STORE_LOCAL(variable exc1)
> ? JUMP 12
-684a718,730
+671a705,717
> 12:
> 83 LOAD_MODULE object Predef
> 83 CONSTANT("finally")
@@ -130,19 +130,19 @@
> 84 LOAD_LOCAL(variable exc1)
> 84 THROW(Throwable)
>
-690c736
+677c723
< catch (<none>) in ArrayBuffer(4, 6, 7, 9) starting at: 3
---
> catch (<none>) in ArrayBuffer(4, 6, 7, 9, 11) starting at: 3
-714c760
+701c747
< locals: value args, variable result, value ex6, variable exc2, value x4, value x5, value message, value x, value ex6, value x4, value x5, value message, value x
---
> locals: value args, variable result, value ex6, variable exc2, value x4, value x5, value x, value ex6, value x4, value x5, value x
-716c762
+703c749
< blocks: [1,2,3,4,5,6,9,12,14,17,18,19,22,25,27,28,30,31]
---
> blocks: [1,2,3,4,5,6,9,12,14,17,18,19,22,25,27,28,30,31,32,33,34]
-740c786,793
+727c773,780
< 172 THROW(MyException)
---
> ? STORE_LOCAL(value ex6)
@@ -153,64 +153,64 @@
> 170 STORE_LOCAL(value x4)
> 170 SCOPE_ENTER value x4
> 170 JUMP 18
-787,790d839
+774,777d826
< 175 LOAD_LOCAL(value x5)
< 175 CALL_METHOD MyException.message (dynamic)
< 175 STORE_LOCAL(value message)
< 175 SCOPE_ENTER value message
-792c841,842
+779c828,829
< 176 LOAD_LOCAL(value message)
---
> ? LOAD_LOCAL(value x5)
> ? CALL_METHOD MyException.message (dynamic)
-796c846,847
+783c833,834
< 177 LOAD_LOCAL(value message)
---
> ? LOAD_LOCAL(value x5)
> ? CALL_METHOD MyException.message (dynamic)
-798c849,850
+785c836,837
< 177 THROW(MyException)
---
> ? STORE_LOCAL(value ex6)
> ? JUMP 33
-802c854,855
+789c841,842
< 170 THROW(Throwable)
---
> ? STORE_LOCAL(value ex6)
> ? JUMP 33
-811a865,870
+798a852,857
> 33:
> 169 LOAD_LOCAL(value ex6)
> 169 STORE_LOCAL(value x4)
> 169 SCOPE_ENTER value x4
> 169 JUMP 5
>
-826,829d884
+813,816d871
< 180 LOAD_LOCAL(value x5)
< 180 CALL_METHOD MyException.message (dynamic)
< 180 STORE_LOCAL(value message)
< 180 SCOPE_ENTER value message
-831c886,887
+818c873,874
< 181 LOAD_LOCAL(value message)
---
> ? LOAD_LOCAL(value x5)
> ? CALL_METHOD MyException.message (dynamic)
-835c891,892
+822c878,879
< 182 LOAD_LOCAL(value message)
---
> ? LOAD_LOCAL(value x5)
> ? CALL_METHOD MyException.message (dynamic)
-837c894,895
+824c881,882
< 182 THROW(MyException)
---
> ? STORE_LOCAL(variable exc2)
> ? JUMP 34
-841c899,900
+828c886,887
< 169 THROW(Throwable)
---
> ? STORE_LOCAL(variable exc2)
> ? JUMP 34
-857a917,929
+844a904,916
> 34:
> 184 LOAD_MODULE object Predef
> 184 CONSTANT("finally")
@@ -224,23 +224,23 @@
> 185 LOAD_LOCAL(variable exc2)
> 185 THROW(Throwable)
>
-863c935
+850c922
< catch (Throwable) in ArrayBuffer(17, 18, 19, 22, 25, 27, 28, 30) starting at: 4
---
> catch (Throwable) in ArrayBuffer(17, 18, 19, 22, 25, 27, 28, 30, 32) starting at: 4
-866c938
+853c925
< catch (<none>) in ArrayBuffer(4, 5, 6, 9, 12, 17, 18, 19, 22, 25, 27, 28, 30) starting at: 3
---
> catch (<none>) in ArrayBuffer(4, 5, 6, 9, 12, 17, 18, 19, 22, 25, 27, 28, 30, 32, 33) starting at: 3
-890c962
+877c949
< locals: value args, variable result, value e, value ex6, value x4, value x5, value message, value x
---
> locals: value args, variable result, value e, value ex6, value x4, value x5, value x
-892c964
+879c951
< blocks: [1,2,3,6,7,8,11,14,16,17,19]
---
> blocks: [1,2,3,6,7,8,11,14,16,17,19,20]
-916c988,995
+903c975,982
< 124 THROW(MyException)
---
> ? STORE_LOCAL(value ex6)
@@ -251,29 +251,29 @@
> 122 STORE_LOCAL(value x4)
> 122 SCOPE_ENTER value x4
> 122 JUMP 7
-945,948d1023
+932,935d1010
< 127 LOAD_LOCAL(value x5)
< 127 CALL_METHOD MyException.message (dynamic)
< 127 STORE_LOCAL(value message)
< 127 SCOPE_ENTER value message
-950c1025,1026
+937c1012,1013
< 127 LOAD_LOCAL(value message)
---
> ? LOAD_LOCAL(value x5)
> ? CALL_METHOD MyException.message (dynamic)
-979c1055
+966c1042
< catch (IllegalArgumentException) in ArrayBuffer(6, 7, 8, 11, 14, 16, 17, 19) starting at: 3
---
> catch (IllegalArgumentException) in ArrayBuffer(6, 7, 8, 11, 14, 16, 17, 19, 20) starting at: 3
-1003c1079
+990c1066
< locals: value args, variable result, value ex6, value x4, value x5, value message, value x, value e
---
> locals: value args, variable result, value ex6, value x4, value x5, value x, value e
-1005c1081
+992c1068
< blocks: [1,2,3,4,5,8,11,15,16,17,19]
---
> blocks: [1,2,3,5,8,11,15,16,17,19,20]
-1029c1105,1114
+1016c1092,1101
< 148 THROW(MyException)
---
> ? STORE_LOCAL(value ex6)
@@ -286,25 +286,25 @@
> 154 LOAD_LOCAL(value x4)
> 154 IS_INSTANCE REF(class MyException)
> 154 CZJUMP (BOOL)NE ? 5 : 11
-1050,1052d1134
+1037,1039d1121
< 145 JUMP 4
<
< 4:
-1066,1069d1147
+1053,1056d1134
< 154 LOAD_LOCAL(value x5)
< 154 CALL_METHOD MyException.message (dynamic)
< 154 STORE_LOCAL(value message)
< 154 SCOPE_ENTER value message
-1071c1149,1150
+1058c1136,1137
< 154 LOAD_LOCAL(value message)
---
> ? LOAD_LOCAL(value x5)
> ? CALL_METHOD MyException.message (dynamic)
-1288c1367
+1275c1354
< blocks: [1,2,3,4,5,7]
---
> blocks: [1,2,3,4,5,7,8]
-1312c1391,1398
+1299c1378,1385
< 38 THROW(IllegalArgumentException)
---
> ? STORE_LOCAL(value e)
@@ -315,20 +315,20 @@
> 42 CONSTANT("IllegalArgumentException")
> 42 CALL_METHOD scala.Predef.println (dynamic)
> 42 JUMP 2
-1359c1445
+1346c1432
< locals: value args, variable result, value ex6, value x4, value x5, value message, value x
---
> locals: value args, variable result, value ex6, value x4, value x5, value x
-1361c1447
+1348c1434
< blocks: [1,2,3,4,5,8,11,13,14,16,17,19]
---
> blocks: [1,2,3,5,8,11,13,14,16,17,19,20]
-1385c1471,1472
+1372c1458,1459
< 203 THROW(MyException)
---
> ? STORE_LOCAL(value ex6)
> ? JUMP 20
-1405c1492,1501
+1392c1479,1488
< 209 THROW(MyException)
---
> ? STORE_LOCAL(value ex6)
@@ -341,25 +341,25 @@
> 212 LOAD_LOCAL(value x4)
> 212 IS_INSTANCE REF(class MyException)
> 212 CZJUMP (BOOL)NE ? 5 : 11
-1418,1420d1513
+1405,1407d1500
< 200 JUMP 4
<
< 4:
-1434,1437d1526
+1421,1424d1513
< 212 LOAD_LOCAL(value x5)
< 212 CALL_METHOD MyException.message (dynamic)
< 212 STORE_LOCAL(value message)
< 212 SCOPE_ENTER value message
-1439c1528,1529
+1426c1515,1516
< 213 LOAD_LOCAL(value message)
---
> ? LOAD_LOCAL(value x5)
> ? CALL_METHOD MyException.message (dynamic)
-1483c1573
+1470c1560
< blocks: [1,2,3,4,5,7]
---
> blocks: [1,2,3,4,5,7,8]
-1507c1597,1604
+1494c1584,1591
< 58 THROW(IllegalArgumentException)
---
> ? STORE_LOCAL(value e)
@@ -370,11 +370,11 @@
> 62 CONSTANT("RuntimeException")
> 62 CALL_METHOD scala.Predef.println (dynamic)
> 62 JUMP 2
-1556c1653
+1543c1640
< blocks: [1,2,3,4]
---
> blocks: [1,2,3,4,5]
-1576c1673,1678
+1563c1660,1665
< 229 THROW(MyException)
---
> ? JUMP 5
@@ -383,19 +383,19 @@
> ? LOAD_LOCAL(variable monitor1)
> 228 MONITOR_EXIT
> 228 THROW(Throwable)
-1582c1684
+1569c1671
< ? THROW(Throwable)
---
> 228 THROW(Throwable)
-1610c1712
+1597c1699
< locals: value args, variable result, variable monitor2, variable monitorResult1
---
> locals: value exception$1, value args, variable result, variable monitor2, variable monitorResult1
-1612c1714
+1599c1701
< blocks: [1,2,3,4]
---
> blocks: [1,2,3,4,5]
-1635c1737,1745
+1622c1724,1732
< 245 THROW(MyException)
---
> ? STORE_LOCAL(value exception$1)
@@ -407,7 +407,7 @@
> ? LOAD_LOCAL(variable monitor2)
> 244 MONITOR_EXIT
> 244 THROW(Throwable)
-1641c1751
+1628c1738
< ? THROW(Throwable)
---
> 244 THROW(Throwable)
diff --git a/test/files/run/t1195-new.check b/test/files/run/t1195-new.check
index e0c9ac07ff..0a3f434d62 100644
--- a/test/files/run/t1195-new.check
+++ b/test/files/run/t1195-new.check
@@ -1,6 +1,6 @@
Bar.type, underlying = <: scala.runtime.AbstractFunction1[Int,Bar] with Serializable{case def unapply(x$0: Bar): Option[Int]} with Singleton
-Bar, underlying = <: Product with Serializable{val x: Int; def copy(x: Int): Bar; def copy$default$1: Int; def _1: Int}
+Bar, underlying = <: Product with Serializable{val x: Int; def copy(x: Int): Bar; def copy$default$1: Int}
Product with Serializable, underlying = Product with Serializable
Bar.type, underlying = <: scala.runtime.AbstractFunction1[Int,Bar] with Serializable{case def unapply(x$0: Bar): Option[Int]} with Singleton
-Bar, underlying = <: Product with Serializable{val x: Int; def copy(x: Int): Bar; def copy$default$1: Int; def _1: Int}
+Bar, underlying = <: Product with Serializable{val x: Int; def copy(x: Int): Bar; def copy$default$1: Int}
Product with Serializable, underlying = Product with Serializable
diff --git a/test/files/run/virtpatmat_extends_product.scala b/test/files/run/virtpatmat_extends_product.scala
index e564f4430b..4b4bc634a7 100644
--- a/test/files/run/virtpatmat_extends_product.scala
+++ b/test/files/run/virtpatmat_extends_product.scala
@@ -1,5 +1,8 @@
object Test extends App {
- case class AnnotationInfo(a: String, b: Int) extends Product2[String, Int]
+ case class AnnotationInfo(a: String, b: Int) extends Product2[String, Int] {
+ def _1 = a
+ def _2 = b
+ }
// if we're not careful in unapplyTypeListFromReturnType, the generated unapply is
// thought to return two components instead of one, since AnnotationInfo (the result of the unapply) is a Product2
@@ -8,4 +11,4 @@ object Test extends App {
NestedAnnotArg(AnnotationInfo("a", 1)) match {
case NestedAnnotArg(x) => println(x)
}
-} \ No newline at end of file
+}
diff --git a/test/files/scalap/caseClass/result.test b/test/files/scalap/caseClass/result.test
index 6165444026..7d7aa4fd8f 100644
--- a/test/files/scalap/caseClass/result.test
+++ b/test/files/scalap/caseClass/result.test
@@ -8,8 +8,6 @@ case class CaseClass[A <: scala.Seq[scala.Int]](i : A, s : scala.Predef.String)
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 */ }
- def _1 : A = { /* compiled code */ }
- def _2 : scala.Predef.String = { /* compiled code */ }
override def hashCode() : scala.Int = { /* compiled code */ }
override def toString() : java.lang.String = { /* compiled code */ }
override def equals(x$1 : scala.Any) : scala.Boolean = { /* compiled code */ }
diff --git a/test/scaladoc/run/SI-191-deprecated.check b/test/scaladoc/run/SI-191-deprecated.check
new file mode 100755
index 0000000000..3925a0d464
--- /dev/null
+++ b/test/scaladoc/run/SI-191-deprecated.check
@@ -0,0 +1 @@
+Done. \ No newline at end of file
diff --git a/test/scaladoc/run/SI-191-deprecated.scala b/test/scaladoc/run/SI-191-deprecated.scala
new file mode 100755
index 0000000000..746aa9c598
--- /dev/null
+++ b/test/scaladoc/run/SI-191-deprecated.scala
@@ -0,0 +1,71 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.nsc.doc.model.comment._
+import scala.tools.partest.ScaladocModelTest
+import java.net.{URI, URL}
+import java.io.File
+
+object Test extends ScaladocModelTest {
+
+ override def code =
+ """
+ /** See:
+ * - [[scala.collection.Map]] Simple linking
+ * - [[scala.collection.immutable.::]] Linking with symbolic name
+ * - [[scala.Int]].toLong Linking to a class
+ * - [[scala.Predef]] Linking to an object
+ * - [[scala.Int.toLong]] Linking to a method
+ * - [[scala]] Linking to a package
+ * - [[scala.AbstractMethodError]] Linking to a member in the package object
+ * - [[scala.Predef.String]] Linking to a member in an object
+ *
+ * Don't look at:
+ * - [[scala.NoLink]] Not linking :)
+ */
+ object Test {
+ def foo(param: Any) {}
+ def barr(l: scala.collection.immutable.List[Any]) {}
+ def bar(l: List[String]) {} // TODO: Should be able to link to type aliases
+ def baz(d: java.util.Date) {} // Should not be resolved
+ }
+ """
+
+ def scalaURL = "http://bog.us"
+
+ override def scaladocSettings = "-no-link-warnings -external-urls scala=" + scalaURL
+
+ def testModel(rootPackage: Package) {
+ import access._
+ val test = rootPackage._object("Test")
+
+ def check(memberDef: Def, expected: Int) {
+ val externals = memberDef.valueParams(0)(0).resultType.refEntity collect {
+ case (_, (LinkToExternal(name, url), _)) => assert(url.contains(scalaURL)); name
+ }
+ assert(externals.size == expected)
+ }
+
+ check(test._method("foo"), 1)
+ check(test._method("bar"), 0)
+ check(test._method("barr"), 2)
+ check(test._method("baz"), 0)
+
+ val expectedUrls = collection.mutable.Set[String](
+ "scala.collection.Map",
+ "scala.collection.immutable.::",
+ "scala.Int",
+ "scala.Predef$",
+ "scala.Int@toLong:Long",
+ "scala.package",
+ "scala.package@AbstractMethodError=AbstractMethodError",
+ "scala.Predef$@String=String"
+ ).map(scalaURL + "/index.html#" + _)
+
+ def isExpectedExternalLink(l: EntityLink) = l.link match {
+ case LinkToExternal(name, url) => assert(expectedUrls contains url, url); true
+ case _ => false
+ }
+
+ assert(countLinks(test.comment.get, isExpectedExternalLink) == 8,
+ countLinks(test.comment.get, isExpectedExternalLink) + " == 8")
+ }
+}
diff --git a/test/scaladoc/run/SI-191.check b/test/scaladoc/run/SI-191.check
new file mode 100755
index 0000000000..3925a0d464
--- /dev/null
+++ b/test/scaladoc/run/SI-191.check
@@ -0,0 +1 @@
+Done. \ No newline at end of file
diff --git a/test/scaladoc/run/SI-191.scala b/test/scaladoc/run/SI-191.scala
new file mode 100755
index 0000000000..0fb28145c3
--- /dev/null
+++ b/test/scaladoc/run/SI-191.scala
@@ -0,0 +1,76 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.nsc.doc.model.comment._
+import scala.tools.partest.ScaladocModelTest
+import java.net.{URI, URL}
+import java.io.File
+
+object Test extends ScaladocModelTest {
+
+ override def code =
+ """
+ /** See:
+ * - [[scala.collection.Map]] Simple linking
+ * - [[scala.collection.immutable.::]] Linking with symbolic name
+ * - [[scala.Int]].toLong Linking to a class
+ * - [[scala.Predef]] Linking to an object
+ * - [[scala.Int.toLong]] Linking to a method
+ * - [[scala]] Linking to a package
+ * - [[scala.AbstractMethodError]] Linking to a member in the package object
+ * - [[scala.Predef.String]] Linking to a member in an object
+ *
+ * Don't look at:
+ * - [[scala.NoLink]] Not linking :)
+ */
+ object Test {
+ def foo(param: Any) {}
+ def barr(l: scala.collection.immutable.List[Any]) {}
+ def bar(l: List[String]) {} // TODO: Should be able to link to type aliases
+ def baz(d: java.util.Date) {} // Should not be resolved
+ }
+ """
+
+ def scalaURL = "http://bog.us"
+
+ override def scaladocSettings = {
+ val scalaLibUri = getClass.getClassLoader.getResource("scala/Function1.class").toURI.getSchemeSpecificPart.split("!")(0)
+ val scalaLib = new File(new URL(scalaLibUri).getPath).getPath
+ val extArg = new URI("file", scalaLib, scalaURL).toString
+ "-no-link-warnings -doc-external-uris " + extArg
+ }
+
+ def testModel(rootPackage: Package) {
+ import access._
+ val test = rootPackage._object("Test")
+
+ def check(memberDef: Def, expected: Int) {
+ val externals = memberDef.valueParams(0)(0).resultType.refEntity collect {
+ case (_, (LinkToExternal(name, url), _)) => assert(url.contains(scalaURL)); name
+ }
+ assert(externals.size == expected)
+ }
+
+ check(test._method("foo"), 1)
+ check(test._method("bar"), 0)
+ check(test._method("barr"), 2)
+ check(test._method("baz"), 0)
+
+ val expectedUrls = collection.mutable.Set[String](
+ "scala.collection.Map",
+ "scala.collection.immutable.::",
+ "scala.Int",
+ "scala.Predef$",
+ "scala.Int@toLong:Long",
+ "scala.package",
+ "scala.package@AbstractMethodError=AbstractMethodError",
+ "scala.Predef$@String=String"
+ ).map(scalaURL + "/index.html#" + _)
+
+ def isExpectedExternalLink(l: EntityLink) = l.link match {
+ case LinkToExternal(name, url) => assert(expectedUrls contains url, url); true
+ case _ => false
+ }
+
+ assert(countLinks(test.comment.get, isExpectedExternalLink) == 8,
+ countLinks(test.comment.get, isExpectedExternalLink) + " == 8")
+ }
+}