File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 353562
363663
373764
38+ 71
39+ 72
40+ 75
41+ 76
42+ 81
43+ 82
Original file line number Diff line number Diff line change @@ -58,6 +58,17 @@ trait SFIS extends F1[Int, String]:
5858trait 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
6273object 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
You can’t perform that action at this time.
0 commit comments