Skip to content

Commit b8c0478

Browse files
committed
Add a test that checks that no useless forwarders are being created.
1 parent 1a83575 commit b8c0478

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/run/no-useless-forwarders.scala

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
trait A {
2+
def foo(a: Int): Int = a
3+
def bar(a: Int): Int
4+
}
5+
6+
trait B {
7+
def bar(a: Int): Int = a
8+
}
9+
10+
object Test extends A with B{
11+
def main(args: Array[String]) = {
12+
assert(!this.getClass.getDeclaredMethods.exists{x: java.lang.reflect.Method => x.getName == "foo"},
13+
"no forwarder is needed here")
14+
assert(!this.getClass.getDeclaredMethods.exists{x: java.lang.reflect.Method => x.getName == "bar"},
15+
"no forwarder is needed here")
16+
}
17+
}

0 commit comments

Comments
 (0)