diff --git a/tests/pos/i14699.scala b/tests/pos/i14699.scala index c0cc89fbf4f8..ec1d78da554a 100644 --- a/tests/pos/i14699.scala +++ b/tests/pos/i14699.scala @@ -1,7 +1,21 @@ -def always(block: => Unit): Unit = {} -def always(args: Int*)(block: => Unit): Unit ={} -def test = - val x = always{} - val xc: Unit = x - always(1,2,3) {} +package i14699: + def always(block: => Unit): Unit = () + def always(args: Int*)(block: => Unit): Unit = () + + def test = + val x = always{} + val xc: Unit = x + always(1,2,3) {} + +package i15163: + trait Ctx + object Ctx: + given Ctx() + def always(block: Ctx ?=> Unit): Unit = block + def always(args: Int*)(block: Ctx ?=> Unit): Unit = block + + def test = + //val _ = always {} + val _ = always { (x: Ctx) ?=> () } + always(1,2,3) {} diff --git a/tests/run/i10016.scala b/tests/run/i10016.scala index 475cf0898466..1a02ecd5aa52 100644 --- a/tests/run/i10016.scala +++ b/tests/run/i10016.scala @@ -1,5 +1,10 @@ -def f(init: Int ?=> Int) : Int = 1 -def f(s: String)(init: Int ?=> Int) : Int = 2 +def f(init: Int ?=> Int): Int = 1 +def f(s: String)(init: Int ?=> Int): Int = 2 + +def g(init: String ?=> Int)(s: String): Int = init(using s) +def g(init: Int ?=> Int)(j: Int): Int = init(using j) @main def Test() = assert(f((x: Int) ?=> x) == 1) + assert(g((i: Int) ?=> i+1)(41) == 42, s"${ g((i: Int) ?=> i+1)(41) }") + //assert(g(summon[Int]+1)(41) == 42, s"${ g((i: Int) ?=> i+1)(41) }")