aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/disabled/scalac-dependent/pos/contextbounds-implicits-new.scala (renamed from tests/pos/contextbounds-implicits-new.scala)0
-rw-r--r--tests/disabled/scalac-dependent/pos/spec-doubledef-new.scala (renamed from tests/pos/spec-doubledef-new.scala)0
-rw-r--r--tests/disabled/scalac-dependent/pos/t7688.scala (renamed from tests/pos-scala2/t7688.scala)0
-rw-r--r--tests/disabled/scalac-dependent/pos/t8187.scala (renamed from tests/pos/t8187.scala)0
-rw-r--r--tests/disabled/scalac-dependent/run/bytecodecs.scala (renamed from tests/run/bytecodecs.scala)0
-rw-r--r--tests/disabled/scalac-dependent/run/var-arity-class-symbol.scala (renamed from tests/run/var-arity-class-symbol.scala)0
-rw-r--r--tests/neg/customArgs/typers.scala2
-rw-r--r--tests/neg/falseView.scala7
-rw-r--r--tests/neg/i1050c.scala3
-rw-r--r--tests/neg/i2030.scala5
-rw-r--r--tests/neg/namedTypeParams.scala12
-rw-r--r--tests/pickling/innerclass.scala3
-rw-r--r--tests/pos-scala2/typerep-stephane.scala (renamed from tests/pos/typerep-stephane.scala)0
-rw-r--r--tests/pos-scala2/viewtest1.scala (renamed from tests/pos/viewtest1.scala)0
-rw-r--r--tests/pos/i2056.scala13
-rw-r--r--tests/pos/t0786.scala2
-rw-r--r--tests/pos/t2421_delitedsl.scala3
-rw-r--r--tests/repl/errmsgs.check2
-rw-r--r--tests/repl/overrides.check4
-rw-r--r--tests/run/builder.check2
-rw-r--r--tests/run/builder.scala12
-rw-r--r--tests/run/iterator-from.scala6
-rw-r--r--tests/run/puzzler54.scala13
-rw-r--r--tests/run/t8280.check3
-rw-r--r--tests/run/t8280.scala9
-rw-r--r--tests/tasty/default-param-interface.scala3
26 files changed, 82 insertions, 22 deletions
diff --git a/tests/pos/contextbounds-implicits-new.scala b/tests/disabled/scalac-dependent/pos/contextbounds-implicits-new.scala
index 8389d1332..8389d1332 100644
--- a/tests/pos/contextbounds-implicits-new.scala
+++ b/tests/disabled/scalac-dependent/pos/contextbounds-implicits-new.scala
diff --git a/tests/pos/spec-doubledef-new.scala b/tests/disabled/scalac-dependent/pos/spec-doubledef-new.scala
index de438d6e9..de438d6e9 100644
--- a/tests/pos/spec-doubledef-new.scala
+++ b/tests/disabled/scalac-dependent/pos/spec-doubledef-new.scala
diff --git a/tests/pos-scala2/t7688.scala b/tests/disabled/scalac-dependent/pos/t7688.scala
index 5a846b97e..5a846b97e 100644
--- a/tests/pos-scala2/t7688.scala
+++ b/tests/disabled/scalac-dependent/pos/t7688.scala
diff --git a/tests/pos/t8187.scala b/tests/disabled/scalac-dependent/pos/t8187.scala
index 84b8cd0f4..84b8cd0f4 100644
--- a/tests/pos/t8187.scala
+++ b/tests/disabled/scalac-dependent/pos/t8187.scala
diff --git a/tests/run/bytecodecs.scala b/tests/disabled/scalac-dependent/run/bytecodecs.scala
index 454958dfa..454958dfa 100644
--- a/tests/run/bytecodecs.scala
+++ b/tests/disabled/scalac-dependent/run/bytecodecs.scala
diff --git a/tests/run/var-arity-class-symbol.scala b/tests/disabled/scalac-dependent/run/var-arity-class-symbol.scala
index 2a7d32987..2a7d32987 100644
--- a/tests/run/var-arity-class-symbol.scala
+++ b/tests/disabled/scalac-dependent/run/var-arity-class-symbol.scala
diff --git a/tests/neg/customArgs/typers.scala b/tests/neg/customArgs/typers.scala
index 49742ebbd..9432ab039 100644
--- a/tests/neg/customArgs/typers.scala
+++ b/tests/neg/customArgs/typers.scala
@@ -30,7 +30,7 @@ object typers {
}
type L[X] = scala.collection.immutable.List[X]
- type M[X, Y] <: scala.collection.immutable.Map[X, Y] // error: only classes can have declared but undefined members
+ type M[X, Y] <: scala.collection.immutable.Map[X, Y] // old-error: only classes can have declared but undefined members
object hk {
def f(x: L) // error: missing type parameter
diff --git a/tests/neg/falseView.scala b/tests/neg/falseView.scala
new file mode 100644
index 000000000..613abe3f1
--- /dev/null
+++ b/tests/neg/falseView.scala
@@ -0,0 +1,7 @@
+object Test {
+
+ private implicit val xs: Map[String, Int] = ???
+
+ val x: Int = "abc" // error
+
+}
diff --git a/tests/neg/i1050c.scala b/tests/neg/i1050c.scala
index 19570eb83..ecfaa3ea3 100644
--- a/tests/neg/i1050c.scala
+++ b/tests/neg/i1050c.scala
@@ -27,7 +27,8 @@ object Tiark4 {
v.brand("boom!")
}
object V { // error: cannot be instantiated
- type Y >: Any <: Nothing // error: only classes can have declared but undefined members
+ type Y >: Any <: Nothing // old-error: only classes can have declared but undefined members
+ type Z
}
object Tiark5 {
trait A { type L <: Nothing }
diff --git a/tests/neg/i2030.scala b/tests/neg/i2030.scala
new file mode 100644
index 000000000..2d049f4e6
--- /dev/null
+++ b/tests/neg/i2030.scala
@@ -0,0 +1,5 @@
+// This used to take ~12s, the check should be that
+// it runs in reasonable time (i.e. instantaneous).
+object a {
+ val x: String | Int = 'a // error
+}
diff --git a/tests/neg/namedTypeParams.scala b/tests/neg/namedTypeParams.scala
new file mode 100644
index 000000000..75bb1cd7e
--- /dev/null
+++ b/tests/neg/namedTypeParams.scala
@@ -0,0 +1,12 @@
+class C[T]
+class D[type T] // error: identifier expected, but `type` found
+
+object Test {
+
+ val x: C[T = Int] = // error: ']' expected, but `=` found // error
+ new C[T = Int] // error: ']' expected, but `=` found // error
+
+ class E extends C[T = Int] // error: ']' expected, but `=` found // error
+ class F extends C[T = Int]() // error: ']' expected, but `=` found // error
+
+}
diff --git a/tests/pickling/innerclass.scala b/tests/pickling/innerclass.scala
new file mode 100644
index 000000000..5881cf6ed
--- /dev/null
+++ b/tests/pickling/innerclass.scala
@@ -0,0 +1,3 @@
+trait Foo {
+ class Inner(x: Int = 42)
+}
diff --git a/tests/pos/typerep-stephane.scala b/tests/pos-scala2/typerep-stephane.scala
index 2cb899591..2cb899591 100644
--- a/tests/pos/typerep-stephane.scala
+++ b/tests/pos-scala2/typerep-stephane.scala
diff --git a/tests/pos/viewtest1.scala b/tests/pos-scala2/viewtest1.scala
index 38945ad2f..38945ad2f 100644
--- a/tests/pos/viewtest1.scala
+++ b/tests/pos-scala2/viewtest1.scala
diff --git a/tests/pos/i2056.scala b/tests/pos/i2056.scala
new file mode 100644
index 000000000..c4d020fb6
--- /dev/null
+++ b/tests/pos/i2056.scala
@@ -0,0 +1,13 @@
+object Test {
+ inline def crash() = {
+ try {
+ println("hi")
+ } catch {
+ case e: Exception =>
+ }
+ }
+
+ def main(args: Array[String]): Unit = {
+ crash()
+ }
+}
diff --git a/tests/pos/t0786.scala b/tests/pos/t0786.scala
index b320de0ed..9346afdff 100644
--- a/tests/pos/t0786.scala
+++ b/tests/pos/t0786.scala
@@ -15,7 +15,7 @@ object ImplicitProblem {
def eval = f(nullval[T]).eval + 1
}
- def depth[T](n: T)(implicit ev: T => Rep[T]) = n.eval
+ def depth[T](n: T)(implicit ev: T => Rep[T]) = ev(n).eval
def main(args: Array[String]): Unit = {
println(depth(nullval[M[Int]])) // (1) this works
diff --git a/tests/pos/t2421_delitedsl.scala b/tests/pos/t2421_delitedsl.scala
index 22f1ecd85..bde3593c9 100644
--- a/tests/pos/t2421_delitedsl.scala
+++ b/tests/pos/t2421_delitedsl.scala
@@ -1,6 +1,9 @@
trait DeliteDSL {
abstract class <~<[-From, +To] extends (From => To)
+
implicit def trivial[A]: A <~< A = new (A <~< A) {def apply(x: A) = x}
+ implicit def convert_<-<[A, B](x: A)(implicit ev: A <~< B): B = ev(x)
+
trait Forcible[T]
object Forcible {
diff --git a/tests/repl/errmsgs.check b/tests/repl/errmsgs.check
index d7a230e61..4e89a16a5 100644
--- a/tests/repl/errmsgs.check
+++ b/tests/repl/errmsgs.check
@@ -86,7 +86,7 @@ scala> val x: List[Int] = "foo" :: List(1)
| required: Int
|
scala> { def f: Int = g; val x: Int = 1; def g: Int = 5; }
--- [E039] Reference Error: <console> -------------------------------------------
+-- [E038] Reference Error: <console> -------------------------------------------
5 |{ def f: Int = g; val x: Int = 1; def g: Int = 5; }
| ^
| `g` is a forward reference extending over the definition of `x`
diff --git a/tests/repl/overrides.check b/tests/repl/overrides.check
index 2424c80ce..0fbd3d0e3 100644
--- a/tests/repl/overrides.check
+++ b/tests/repl/overrides.check
@@ -1,5 +1,5 @@
scala> class B { override def foo(i: Int): Unit = {}; }
--- [E037] Reference Error: <console> -------------------------------------------
+-- [E036] Reference Error: <console> -------------------------------------------
4 |class B { override def foo(i: Int): Unit = {}; }
| ^
| method foo overrides nothing
@@ -8,7 +8,7 @@ longer explanation available when compiling with `-explain`
scala> class A { def foo: Unit = {}; }
defined class A
scala> class B extends A { override def foo(i: Int): Unit = {}; }
--- [E038] Reference Error: <console> -------------------------------------------
+-- [E037] Reference Error: <console> -------------------------------------------
5 |class B extends A { override def foo(i: Int): Unit = {}; }
| ^
| method foo has a different signature than the overridden declaration
diff --git a/tests/run/builder.check b/tests/run/builder.check
index 48f7d9253..04048dfcc 100644
--- a/tests/run/builder.check
+++ b/tests/run/builder.check
@@ -1 +1 @@
-Table(Row(Cell(A1), Cell(B1)), Row(Cell(A2), Cell(B2)))
+Table(Row(Cell(top left), Cell(top right)), Row(Cell(botttom left), Cell(bottom right)))
diff --git a/tests/run/builder.scala b/tests/run/builder.scala
index 532a95071..d09e9f2c8 100644
--- a/tests/run/builder.scala
+++ b/tests/run/builder.scala
@@ -12,9 +12,7 @@ class Row {
override def toString = cells.mkString("Row(", ", ", ")")
}
-class Cell(elem: String) {
- override def toString = s"Cell($elem)"
-}
+case class Cell(elem: String)
object Test {
@@ -36,12 +34,12 @@ object Test {
val data =
table {
row {
- cell("A1")
- cell("B1")
+ cell("top left")
+ cell("top right")
}
row {
- cell("A2")
- cell("B2")
+ cell("botttom left")
+ cell("bottom right")
}
}
diff --git a/tests/run/iterator-from.scala b/tests/run/iterator-from.scala
index 4f403680c..c7c0f9809 100644
--- a/tests/run/iterator-from.scala
+++ b/tests/run/iterator-from.scala
@@ -11,7 +11,9 @@ object Test extends dotty.runtime.LegacyApp {
val maxKey = 50
val maxValue = 50
- def testSet[A <% Ordered[A]](set: SortedSet[A], list: List[A]): Unit = {
+ implicit def convertIfView[A](x: A)(implicit view: A => Ordered[A]): Ordered[A] = view(x)
+
+ def testSet[A: Ordering](set: SortedSet[A], list: List[A]): Unit = {
val distinctSorted = list.distinct.sorted
assertEquals("Set size wasn't the same as list sze", set.size, distinctSorted.size)
@@ -24,7 +26,7 @@ object Test extends dotty.runtime.LegacyApp {
}
}
- def testMap[A <% Ordered[A], B](map: SortedMap[A, B], list: List[(A, B)]): Unit = {
+ def testMap[A: Ordering, B](map: SortedMap[A, B], list: List[(A, B)]): Unit = {
val distinctSorted = distinctByKey(list).sortBy(_._1)
assertEquals("Map size wasn't the same as list sze", map.size, distinctSorted.size)
diff --git a/tests/run/puzzler54.scala b/tests/run/puzzler54.scala
new file mode 100644
index 000000000..9dd4cbb47
--- /dev/null
+++ b/tests/run/puzzler54.scala
@@ -0,0 +1,13 @@
+// Scala Puzzler 54
+object Test {
+ case class Card(number: Int, suit: String = "clubs") {
+ val value = (number % 13) + 1 // ace = 1, king = 13
+ def isInDeck(implicit deck: List[Card]) = deck contains this
+ }
+
+ def main(args: Array[String]) = {
+ implicit val deck = List(Card(1, "clubs"))
+ implicit def intToCard(n: Int): Card = Card(n)
+ assert(1.isInDeck)
+ }
+}
diff --git a/tests/run/t8280.check b/tests/run/t8280.check
index 44c51f5aa..b5885df48 100644
--- a/tests/run/t8280.check
+++ b/tests/run/t8280.check
@@ -1,7 +1,6 @@
-Int
-Int
Long
Int
Int
Int
Int
+Int
diff --git a/tests/run/t8280.scala b/tests/run/t8280.scala
index f433dcc32..5fcbad0a3 100644
--- a/tests/run/t8280.scala
+++ b/tests/run/t8280.scala
@@ -37,7 +37,8 @@ object Moop1 {
implicit object f1 extends (Int => String) { def apply(x: Int): String = "Int" }
implicit val f2: Long => String = _ => "Long"
- println(5: String)
+ //println(5: String)
+ // This picked f1 before, but is now disallowed since subtypes of functions are no longer implicit conversions
}
}
@@ -73,14 +74,14 @@ object Moop3 {
// Dotty deviation. This fails for Dotty with ambiguity error for similar reasons as ob1.
}
object ob2 {
- implicit val f1: Int => String = _ => "Int"
+ implicit val f1: ImplicitConverter[Int, String] = _ => "Int"
implicit def f2(x: Long): String = "Long"
println(5: String)
}
object ob3 {
- implicit val f1: Int => String = _ => "Int"
- implicit val f2: Long => String = _ => "Long"
+ implicit val f1: ImplicitConverter[Int, String] = _ => "Int"
+ implicit val f2: ImplicitConverter[Long, String] = _ => "Long"
println(5: String)
}
diff --git a/tests/tasty/default-param-interface.scala b/tests/tasty/default-param-interface.scala
new file mode 100644
index 000000000..919f4b627
--- /dev/null
+++ b/tests/tasty/default-param-interface.scala
@@ -0,0 +1,3 @@
+trait Foo {
+ def newName(prefix: String = "foo"): String
+}