Skip to content

Commit eb46cea

Browse files
committed
Add new tests with fixed Unit return type
1 parent dffabb2 commit eb46cea

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

tests/run/i24573.check

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,9 @@
3535
62
3636
63
3737
64
38+
71
39+
72
40+
75
41+
76
42+
81
43+
82

tests/run/i24573.scala

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ trait SFIS extends F1[Int, String]:
5858
trait SFIU extends F1[Int, Unit]:
5959
def apply(t: Int): Unit
6060

61+
trait F1U[-T]:
62+
def apply(t: T): Unit
63+
64+
trait SF2T[-T] extends F1U[T]:
65+
def apply(t: T): Unit
66+
67+
trait SF2I extends F1U[Int]:
68+
def apply(t: Int): Unit
69+
70+
trait SF2S extends F1U[String]:
71+
def apply(t: String): Unit
6172

6273
object Test:
6374
def main(args: Array[String]): Unit =
@@ -149,3 +160,19 @@ object Test:
149160
val sfIU: SFIU = (x: Int) => println(x) // expanded
150161
sfIU(64)
151162

163+
val f2ITU: F1U[Int] = (x: Int) => println(x) // closure
164+
f2ITU(71)
165+
val f2STU: F1U[String] = (x: String) => println(x) // closure
166+
f2STU("72")
167+
168+
val sf2IT: SF2T[Int] = (x: Int) => println(x) // closure
169+
sf2IT(75)
170+
val sf2ST: SF2T[String] = (x: String) => println(x) // closure
171+
sf2ST("76")
172+
173+
val sf2I: SF2I = (x: Int) => println(x) // expanded
174+
sf2I(81)
175+
val sf2S: SF2S = (x: String) => println(x) // closure
176+
sf2S("82")
177+
178+
end Test

0 commit comments

Comments
 (0)