File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change 11object Test extends App {
22
3+ // toplevel contra
34 implicit def f : String => String = x => " f"
4-
55 implicit def g : Object => String = x => " g"
6-
76 def h (implicit x : String => String ) = x(" " )
7+ assert(h == " f" , h)
88
9+ // nested contra
910 implicit def fs : List [String => String ] = List (f)
10-
1111 implicit def gs : List [Object => String ] = List (g)
12-
1312 def hs (implicit xs : List [String => String ]) = xs.head(" " )
13+ assert(hs == " f" , hs)
14+
15+ // covariant subapplication nested in toplevel contra
16+ implicit def f2 : (Unit => String ) => String = x => " f2"
17+ implicit def g2 : (Unit => Object ) => String = x => " g2"
18+ def h2 (implicit x : (Unit => String ) => String ) = x(_ => " " )
19+ assert(h2 == " f2" , h2)
1420
15- assert(h == " f" )
16- assert(hs == " f" )
21+ // covariant subapplication nested in nested contra
22+ implicit def fs2 : List [(Unit => String ) => String ] = List (f2)
23+ implicit def gs2 : List [(Unit => Object ) => String ] = List (g2)
24+ def hs2 (implicit xs : List [(Unit => String ) => String ]) = xs.head(_ => " " )
25+ assert(hs2 == " f2" , hs2)
1726}
You can’t perform that action at this time.
0 commit comments