File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ import scala .language .implicitConversions
2+
3+ final class MyClass (name : String ) {
4+
5+ final class Fun0 (val f : Function0 [Any ])
6+
7+ object Fun0 {
8+
9+ implicit def function0AsFun0 (f : Function0 [Any ]): Fun0 = new Fun0 (f)
10+
11+ }
12+
13+ def apply (f : => Unit ): Unit = {
14+ apply(() => f)
15+ }
16+
17+ def apply (fun : Fun0 ): Unit = {
18+ // Do something
19+ println(s " Got a Fun0 $fun" )
20+ }
21+
22+ def apply [T1 ](f : (T1 ) => Any )(implicit m1 : Manifest [T1 ]): Unit = {
23+ // Do something
24+ println(s " Got a Function1: ${f}" )
25+ }
26+
27+ }
Original file line number Diff line number Diff line change 1+ trait A {
2+ val s = " same val in A"
3+ def f : String = s
4+ }
5+
6+ class B extends A {
7+ class C {
8+ def call_f_in_A : String = B .super [A ].f
9+ }
10+ }
11+ val b = new B
12+ val c = new b.C
13+ @ main def Test = c.call_f_in_A // AbstractMethodError
You can’t perform that action at this time.
0 commit comments