Skip to content

Commit 99c3a16

Browse files
committed
Status quo overload taking context function
1 parent c4c48e3 commit 99c3a16

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

tests/pos/i14699.scala

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1-
def always(block: => Unit): Unit = {}
2-
def always(args: Int*)(block: => Unit): Unit ={}
31

4-
def test =
5-
val x = always{}
6-
val xc: Unit = x
7-
always(1,2,3) {}
2+
package i14699:
3+
def always(block: => Unit): Unit = ()
4+
def always(args: Int*)(block: => Unit): Unit = ()
5+
6+
def test =
7+
val x = always{}
8+
val xc: Unit = x
9+
always(1,2,3) {}
10+
11+
package i15163:
12+
trait Ctx
13+
object Ctx:
14+
given Ctx()
15+
def always(block: Ctx ?=> Unit): Unit = block
16+
def always(args: Int*)(block: Ctx ?=> Unit): Unit = block
17+
18+
def test =
19+
//val _ = always {}
20+
val _ = always { (x: Ctx) ?=> () }
21+
always(1,2,3) {}

tests/run/i10016.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
def f(init: Int ?=> Int) : Int = 1
2-
def f(s: String)(init: Int ?=> Int) : Int = 2
1+
def f(init: Int ?=> Int): Int = 1
2+
def f(s: String)(init: Int ?=> Int): Int = 2
3+
4+
def g(init: String ?=> Int)(s: String): Int = init(using s)
5+
def g(init: Int ?=> Int)(j: Int): Int = init(using j)
36

47
@main def Test() =
58
assert(f((x: Int) ?=> x) == 1)
9+
assert(g((i: Int) ?=> i+1)(41) == 42, s"${ g((i: Int) ?=> i+1)(41) }")
10+
//assert(g(summon[Int]+1)(41) == 42, s"${ g((i: Int) ?=> i+1)(41) }")

0 commit comments

Comments
 (0)