summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2013-10-14 00:12:51 +0200
committerGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2013-10-14 00:12:51 +0200
commitb126e5c31b2bc57df5d0d5cf3508babe1dd7a759 (patch)
treee1c71882fe860ac0bdd1f79b0ec45757a7c888be /test/files/run
parent71d4e285064e9d3475a0badecf283ea95166df6d (diff)
parent392d1ddb1588d69c2e8ae10a2b3e902c7229b772 (diff)
downloadscala-b126e5c31b2bc57df5d0d5cf3508babe1dd7a759.tar.gz
scala-b126e5c31b2bc57df5d0d5cf3508babe1dd7a759.tar.bz2
scala-b126e5c31b2bc57df5d0d5cf3508babe1dd7a759.zip
Merge remote-tracking branch 'scala/master' into fix-merge-3018
Conflicts: src/compiler/scala/tools/nsc/typechecker/Typers.scala
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/constrained-types.check9
-rw-r--r--test/files/run/private-override.check1
-rw-r--r--test/files/run/private-override.scala17
-rw-r--r--test/files/run/repl-reset.check6
-rw-r--r--test/files/run/t7584b.scala14
-rw-r--r--test/files/run/t7899.scala5
6 files changed, 52 insertions, 0 deletions
diff --git a/test/files/run/constrained-types.check b/test/files/run/constrained-types.check
index f022aac1b2..d965d8a2ff 100644
--- a/test/files/run/constrained-types.check
+++ b/test/files/run/constrained-types.check
@@ -138,6 +138,15 @@ scala> val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message
<console>:8: error: not found: value e
val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message
^
+<console>:8: error: not found: value f
+ val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message
+ ^
+<console>:8: error: not found: value g
+ val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message
+ ^
+<console>:8: error: not found: value h
+ val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message
+ ^
scala>
diff --git a/test/files/run/private-override.check b/test/files/run/private-override.check
new file mode 100644
index 0000000000..00750edc07
--- /dev/null
+++ b/test/files/run/private-override.check
@@ -0,0 +1 @@
+3
diff --git a/test/files/run/private-override.scala b/test/files/run/private-override.scala
new file mode 100644
index 0000000000..0a3f57f97c
--- /dev/null
+++ b/test/files/run/private-override.scala
@@ -0,0 +1,17 @@
+package test.p1.p2 {
+ abstract class A {
+ private[p2] def f2(): Int = 1
+ }
+ abstract class Other extends A {
+ // It's a private method - not a private[p2] method. Not a failed
+ // "weaker access privileges" override, a different namespace.
+ private def f2(): Int = super.f2() + 2
+ def go() = f2()
+ }
+}
+
+object Test extends test.p1.p2.Other {
+ def main(args: Array[String]): Unit = {
+ println(go())
+ }
+}
diff --git a/test/files/run/repl-reset.check b/test/files/run/repl-reset.check
index c6e147977a..ed95c7b8ff 100644
--- a/test/files/run/repl-reset.check
+++ b/test/files/run/repl-reset.check
@@ -33,6 +33,12 @@ scala> x1 + x2 + x3
<console>:8: error: not found: value x1
x1 + x2 + x3
^
+<console>:8: error: not found: value x2
+ x1 + x2 + x3
+ ^
+<console>:8: error: not found: value x3
+ x1 + x2 + x3
+ ^
scala> val x1 = 4
x1: Int = 4
diff --git a/test/files/run/t7584b.scala b/test/files/run/t7584b.scala
new file mode 100644
index 0000000000..fd560f0418
--- /dev/null
+++ b/test/files/run/t7584b.scala
@@ -0,0 +1,14 @@
+object Test extends App {
+ def fold[A, B](f: (A, => B) => B) = (b: B) => f(null.asInstanceOf[A], b)
+ def f[A, B](x: A, y: B): B = y
+ def bip[A, B] = fold[A, B]((x, y) => f(x, y))
+ def bop[A, B] = fold[A, B](f(_, _))
+
+ // these work:
+ fold[Int, Int]((x, y) => f(x, y))(0)
+ fold[Int, Int](f(_, _))(0)
+
+ // Used to throw a ClassCastException. Since the fix for SI-7899, these issue type errors.
+ // fold[Int, Int](f _)(0)
+ // fold[Int, Int](f)(0)
+}
diff --git a/test/files/run/t7899.scala b/test/files/run/t7899.scala
new file mode 100644
index 0000000000..5879d4b9fe
--- /dev/null
+++ b/test/files/run/t7899.scala
@@ -0,0 +1,5 @@
+object Test extends App {
+ def id[A](a: => A): A = null.asInstanceOf[A]
+ def foo(f: (=> Int) => Int) = () => f(???)
+ foo(id)() // should be allowed and not throw ???
+}