Skip to content

Commit f2ae513

Browse files
authored
Merge pull request #13616 from dotty-staging/backport-13573
[Backport] Generate static forwarders for object members in companion interface
2 parents 569f1d7 + 51b875d commit f2ae513

File tree

5 files changed

+17
-2
lines changed

5 files changed

+17
-2
lines changed

compiler/src/dotty/tools/backend/jvm/BCodeSkelBuilder.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ trait BCodeSkelBuilder extends BCodeHelpers {
292292
emitAnnotations(cnode, claszSymbol.annotations ++ ssa)
293293

294294
if (!isCZStaticModule && !isCZParcelable) {
295-
val skipStaticForwarders = (claszSymbol.isInterface || claszSymbol.is(Module) || ctx.settings.XnoForwarders.value)
295+
val skipStaticForwarders = (claszSymbol.is(Module) || ctx.settings.XnoForwarders.value)
296296
if (!skipStaticForwarders) {
297297
val lmoc = claszSymbol.companionModule
298298
// add static forwarders if there are no name conflicts; see bugs #363 and #1735

compiler/test/dotc/run-test-pickling.blacklist

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## Many of these tests fail because CompilationTests.pickling does not handle
2+
## tests containing java files correctly
3+
14
derive-generic.scala
25
eff-dependent.scala
36
enum-java
@@ -36,4 +39,5 @@ zero-arity-case-class.scala
3639
i12194.scala
3740
i12753
3841
t6138
39-
t6138-2
42+
t6138-2
43+
trait-static-forwarder
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
42
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
public final class Test {
2+
public static void main(String... args) {
3+
System.out.println(T.foo());
4+
}
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
trait T
2+
3+
object T {
4+
def foo = 42
5+
}

0 commit comments

Comments
 (0)