aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/neg/i866.scala9
-rw-r--r--tests/neg/typedIdents/PQ.scala6
-rw-r--r--tests/neg/typedIdents/typedIdents.scala (renamed from tests/neg/typedIdents.scala)6
-rw-r--r--tests/pos/i830.scala6
-rw-r--r--tests/pos/i873.scala10
-rw-r--r--tests/pos/i884.scala4
-rw-r--r--tests/pos/i903.scala26
-rw-r--r--tests/pos/java-interop/i879.java11
-rw-r--r--tests/pos/java-interop/volatile/volatile.java3
-rw-r--r--tests/pos/overloadedAccess.scala1
-rw-r--r--tests/pos/range.scala9
-rw-r--r--tests/pos/tparam_inf.scala38
-rw-r--r--tests/pos/typedIdents/PQ.scala6
-rw-r--r--tests/pos/typedIdents/typedIdents.scala (renamed from tests/pos/typedIdents.scala)6
14 files changed, 128 insertions, 13 deletions
diff --git a/tests/neg/i866.scala b/tests/neg/i866.scala
new file mode 100644
index 000000000..2cdc99ede
--- /dev/null
+++ b/tests/neg/i866.scala
@@ -0,0 +1,9 @@
+object Test {
+ def x: Int = "" // error
+}
+import nonexistent._ // error; this one will swallow all errors below.
+object Foo {
+ def bar(implicit x: NonExistent) = ???
+ val baz = bar
+}
+
diff --git a/tests/neg/typedIdents/PQ.scala b/tests/neg/typedIdents/PQ.scala
new file mode 100644
index 000000000..8a5afede0
--- /dev/null
+++ b/tests/neg/typedIdents/PQ.scala
@@ -0,0 +1,6 @@
+package P {
+ object X { val x = 1; val y = 2 }
+}
+package Q {
+ object X { val x = true; val y = "" }
+}
diff --git a/tests/neg/typedIdents.scala b/tests/neg/typedIdents/typedIdents.scala
index cb7cca743..4937edfe3 100644
--- a/tests/neg/typedIdents.scala
+++ b/tests/neg/typedIdents/typedIdents.scala
@@ -1,9 +1,3 @@
-package P {
- object X { val x = 1; val y = 2 }
-}
-package Q {
- object X { val x = true; val y = "" }
-}
package P { // `X' bound by package clause
import Console._ // `println' bound by wildcard import
object A {
diff --git a/tests/pos/i830.scala b/tests/pos/i830.scala
new file mode 100644
index 000000000..8fcb29f36
--- /dev/null
+++ b/tests/pos/i830.scala
@@ -0,0 +1,6 @@
+object C {
+ trait X[T]
+ implicit def u[A, B]: X[A | B] = new X[A | B] {}
+ def y[T](implicit x: X[T]): T = ???
+ val x: 1 & 2 | 2 & 3 = y
+}
diff --git a/tests/pos/i873.scala b/tests/pos/i873.scala
new file mode 100644
index 000000000..94f8d2c67
--- /dev/null
+++ b/tests/pos/i873.scala
@@ -0,0 +1,10 @@
+object Test {
+ def call(k: (Int, Int) => Unit): Unit = ???
+ def test = call({ case (x, y) => ()})
+
+ trait X extends Function1[Int, String]
+ implicit def f2x(f: Function1[Int, String]): X = ???
+ ({case _ if "".isEmpty => ""} : X) // allowed, implicit view used to adapt
+
+ // ({case _ if "".isEmpty => 0} : X) // expected String, found Int
+}
diff --git a/tests/pos/i884.scala b/tests/pos/i884.scala
new file mode 100644
index 000000000..29e53b9be
--- /dev/null
+++ b/tests/pos/i884.scala
@@ -0,0 +1,4 @@
+import scala.reflect._
+
+object `package` {
+}
diff --git a/tests/pos/i903.scala b/tests/pos/i903.scala
new file mode 100644
index 000000000..5afb6e530
--- /dev/null
+++ b/tests/pos/i903.scala
@@ -0,0 +1,26 @@
+object Test {
+ def contains(s: String, i: Int) = true
+ def test1 = {
+ val f = contains("", (_: Int))
+ val ff = contains("", ((_: Int)))
+ val g: Int => Boolean = contains("", (_))
+ val gg: Int => Boolean = contains("", ((_)))
+ f.apply(0)
+ // sandbox/eta.scala:4: error: type mismatch:
+ // found : Int => Int
+ // required: Int
+ // val f = contains("", (_: Int))
+ // ^
+ // sandbox/eta.scala:5: error: apply is not a member of Boolean(f)
+ // f.apply(0)
+ // ^
+ }
+
+ def test2 = {
+ val f = "".contains("", (_: Int)) // dotc:
+ f.apply(0)
+ // sandbox/eta.scala:18: error: apply is not a member of Boolean(f)
+ // f.apply(0)
+ // ^
+ }
+}
diff --git a/tests/pos/java-interop/i879.java b/tests/pos/java-interop/i879.java
new file mode 100644
index 000000000..6db5b77ff
--- /dev/null
+++ b/tests/pos/java-interop/i879.java
@@ -0,0 +1,11 @@
+class Foo {
+ Foo(int i) {
+ }
+}
+
+
+class Bar extends Foo {
+ Bar() {
+ super(10);
+ }
+} \ No newline at end of file
diff --git a/tests/pos/java-interop/volatile/volatile.java b/tests/pos/java-interop/volatile/volatile.java
new file mode 100644
index 000000000..c6a607b4d
--- /dev/null
+++ b/tests/pos/java-interop/volatile/volatile.java
@@ -0,0 +1,3 @@
+public class Foo {
+ volatile int x = 1;
+}
diff --git a/tests/pos/overloadedAccess.scala b/tests/pos/overloadedAccess.scala
index a2d72f583..10168b61d 100644
--- a/tests/pos/overloadedAccess.scala
+++ b/tests/pos/overloadedAccess.scala
@@ -14,5 +14,4 @@ object overloadedAccess {
val x = f("abc")
val y: Int = x
}
-
}
diff --git a/tests/pos/range.scala b/tests/pos/range.scala
new file mode 100644
index 000000000..9e7b5d1c9
--- /dev/null
+++ b/tests/pos/range.scala
@@ -0,0 +1,9 @@
+import scala.math._
+import collection.immutable.NumericRange
+object Test {
+ val r1: scala.collection.immutable.Range.Partial = ???
+ val r2: scala.Range.Partial = r1
+ def until(d: BigDecimal, end: BigDecimal): Range.Partial[BigDecimal, NumericRange.Exclusive[BigDecimal]] =
+ new Range.Partial(until(d, end, _))
+ def until(d: BigDecimal, end: BigDecimal, step: BigDecimal) = Range.BigDecimal(d, end, step)
+}
diff --git a/tests/pos/tparam_inf.scala b/tests/pos/tparam_inf.scala
new file mode 100644
index 000000000..16d99b75d
--- /dev/null
+++ b/tests/pos/tparam_inf.scala
@@ -0,0 +1,38 @@
+class HasFoo[T] {
+ val x: Foo[T] = ???
+}
+class Foo[T] {
+ def get(x: T): T = x
+ def get2(x: T): Nothing = ???
+
+ def foo1(x: T)(implicit ev: T): Nothing = ???
+ def foo2(x: T)(implicit ev: T): T = ???
+ def foo3[Dummy](x: T)(implicit ev: T): Nothing = ???
+ def foo4[Dummy](x: T)(implicit ev: T): T = ???
+}
+
+object Test {
+
+ def foo1[T](x: T)(implicit ev: T): Nothing = ???
+ def foo2[T](x: T)(implicit ev: T): T = ???
+
+ def test1: Unit = {
+ implicit val ii: Int = 42
+
+ foo1(10)
+ foo2(10)
+ }
+
+ def hf[T]: HasFoo[T] = ???
+ def test2: Unit = {
+ implicit val ii: Int = 42
+
+ hf.x.get(10)
+ hf.x.get2(10)
+
+ hf.x.foo1(10)
+ hf.x.foo2(10)
+ hf.x.foo3(10)
+ hf.x.foo4(10)
+ }
+}
diff --git a/tests/pos/typedIdents/PQ.scala b/tests/pos/typedIdents/PQ.scala
new file mode 100644
index 000000000..8a5afede0
--- /dev/null
+++ b/tests/pos/typedIdents/PQ.scala
@@ -0,0 +1,6 @@
+package P {
+ object X { val x = 1; val y = 2 }
+}
+package Q {
+ object X { val x = true; val y = "" }
+}
diff --git a/tests/pos/typedIdents.scala b/tests/pos/typedIdents/typedIdents.scala
index e99b5a045..95b9f1b63 100644
--- a/tests/pos/typedIdents.scala
+++ b/tests/pos/typedIdents/typedIdents.scala
@@ -1,9 +1,3 @@
-package P {
- object X { val x = 1; val y = 2 }
-}
-package Q {
- object X { val x = true; val y = "" }
-}
package P { // `X' bound by package clause
import Console._ // `println' bound by wildcard import
object A {