diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pos/i2212.scala | 19 | ||||
-rw-r--r-- | tests/pos/i2218.scala | 9 | ||||
-rw-r--r-- | tests/pos/i2219.scala | 7 | ||||
-rw-r--r-- | tests/run/i2163.scala | 21 | ||||
-rw-r--r-- | tests/run/t5857.scala | 5 |
5 files changed, 58 insertions, 3 deletions
diff --git a/tests/pos/i2212.scala b/tests/pos/i2212.scala new file mode 100644 index 000000000..416c8ca04 --- /dev/null +++ b/tests/pos/i2212.scala @@ -0,0 +1,19 @@ +package object squants { + type Time = squants.time.Time +} +package squants.time { + class Time + object Time { def x = 2 } +} +package squants.velocity { + import squants.time._ // <-- imports `Time` value + import squants.Time // <-- imports type alias + object Velocity { Time.x } +} + +import scala.math.BigDecimal.RoundingMode +import scala.math.BigDecimal.RoundingMode.RoundingMode + +object Money { + def foo(round: RoundingMode = RoundingMode.HALF_EVEN): Int = ??? +} diff --git a/tests/pos/i2218.scala b/tests/pos/i2218.scala new file mode 100644 index 000000000..fbede8b9b --- /dev/null +++ b/tests/pos/i2218.scala @@ -0,0 +1,9 @@ +trait Rule[In] + +class C { + def ruleWithName[In](f: In => Int): Rule[In] = { + new DefaultRule(f) {} + } + + class DefaultRule[In](f: In => Int) extends Rule[In] +} diff --git a/tests/pos/i2219.scala b/tests/pos/i2219.scala new file mode 100644 index 000000000..7f786eb3e --- /dev/null +++ b/tests/pos/i2219.scala @@ -0,0 +1,7 @@ +object Test { + type Inv[T[_]] = T[_] + + class Hi[T[_]](x: Inv[T]) { + def foo[T[_]](value: Inv[T] = x) = {} + } +} diff --git a/tests/run/i2163.scala b/tests/run/i2163.scala new file mode 100644 index 000000000..952f651e3 --- /dev/null +++ b/tests/run/i2163.scala @@ -0,0 +1,21 @@ +class Base(f: Int => Int) { + def result = f(3) +} + +class Child(x: Int) extends Base(y => x + y) + +class Outer(z: Int) { + class Base(f: Int => Int) { + def result = f(3) + } + + class Child(x: Int) extends Base(y => x + y + z) +} + +object Test { + def main(args: Array[String]): Unit = { + assert(new Child(4).result == 7) + val o = new Outer(2) + assert(new o.Child(2).result == 7) + } +} diff --git a/tests/run/t5857.scala b/tests/run/t5857.scala index eabf5dc86..fe67a7546 100644 --- a/tests/run/t5857.scala +++ b/tests/run/t5857.scala @@ -36,10 +36,9 @@ object Test { b } - // whatever it is, it should be less than, say, 250ms + // whatever it is, it should be less than, say, 1000ms // if `max` involves traversal, it takes over 5 seconds on a 3.2GHz i7 CPU //println(exectime) - assert(exectime < 250, exectime) + assert(exectime < 1000, exectime) } - } |