diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/neg/implicit-lower-bound.scala | 14 | ||||
-rw-r--r-- | tests/pos/valueclasses/paramlists.scala | 37 | ||||
-rw-r--r-- | tests/run/case-class-toString.check | 4 | ||||
-rw-r--r-- | tests/run/case-class-toString.scala | 17 |
4 files changed, 72 insertions, 0 deletions
diff --git a/tests/neg/implicit-lower-bound.scala b/tests/neg/implicit-lower-bound.scala new file mode 100644 index 000000000..4d5e6389c --- /dev/null +++ b/tests/neg/implicit-lower-bound.scala @@ -0,0 +1,14 @@ +class Foo + +class Bar extends Foo +object Bar { + implicit val listbar: List[Bar] = ??? +} + +class Test { + def get1(implicit lf: List[_ <: Bar]) = {} + def get2(implicit lf: List[_ >: Bar]) = {} + + get1 // works + get2 // error +} diff --git a/tests/pos/valueclasses/paramlists.scala b/tests/pos/valueclasses/paramlists.scala new file mode 100644 index 000000000..f390a44e0 --- /dev/null +++ b/tests/pos/valueclasses/paramlists.scala @@ -0,0 +1,37 @@ +package paramlists + +class Meter[T](val x: T) extends AnyVal { + def zero: T = x + def zero2[M >: T]: M = x + def one(): T = x + def one2[M >: T](): M = x + def one3(x: T): T = x + def one4[M >: T](x: M): M = x + def two(x: T)(y: T): T = y + def two2[M >: T](x: T)(y: M): M = y +} + +object Test { + def test: Unit = { + val m1 = new Meter(1) + m1.zero + m1.zero2 + m1.one + m1.one2 + m1.one3(10) + m1.two(11)(12) + m1.two2(11)(12) + + { + import m1._ + + zero + zero2 + one + one2 + one3(10) + two(11)(12) + two2(11)(12) + } + } +} diff --git a/tests/run/case-class-toString.check b/tests/run/case-class-toString.check new file mode 100644 index 000000000..fe7d8a803 --- /dev/null +++ b/tests/run/case-class-toString.check @@ -0,0 +1,4 @@ +Zero2() +One(1) +Two(1,2) +Encoded!Name(3) diff --git a/tests/run/case-class-toString.scala b/tests/run/case-class-toString.scala new file mode 100644 index 000000000..05a14f54f --- /dev/null +++ b/tests/run/case-class-toString.scala @@ -0,0 +1,17 @@ +case object Zero +case class Zero2() +case class One(x: Int) +case class Two(x: Int, y: Int) +case class `Encoded!Name`(x: Int) + +object Test { + def main(args: Array[String]): Unit = { + // FIXME: case objects are not handled like Scala 2 currently, see #723 + //println(Zero) + + println(Zero2()) + println(One(1)) + println(Two(1, 2)) + println(`Encoded!Name`(3)) + } +} |