Skip to content

Commit 997796b

Browse files
committed
Merge pull request scala#4121 from retronym/ticket/5938
SI-5938 Test for a FSC bug with mixin, duplicate static forwarders
2 parents 3f08b09 + f75dbdb commit 997796b

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

test/files/run/t5938.scala

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import scala.tools.partest.DirectTest
2+
3+
object Test extends DirectTest {
4+
5+
override def extraSettings: String =
6+
s"-usejavacp -d ${testOutput.path}"
7+
8+
override def code = """
9+
object O extends C {
10+
def main(args: Array[String]): Unit = {
11+
}
12+
// Static forwarder for foo and setter_foo_= added more once in a multi-run compile.
13+
}
14+
""".trim
15+
16+
override def show(): Unit = {
17+
val global = newCompiler()
18+
Console.withErr(System.out) {
19+
compileString(global)(code)
20+
compileString(global)(code)
21+
loadClass // was "duplicate name and signature in class X"
22+
}
23+
}
24+
25+
def loadClass: Class[_] = {
26+
val cl = new java.net.URLClassLoader(Array(testOutput.toFile.toURL));
27+
cl.loadClass("O")
28+
}
29+
}
30+
31+
trait T {
32+
val foo: String = ""
33+
}
34+
class C extends T
35+

0 commit comments

Comments
 (0)