Skip to content

Generate static forwarders for object members in companion interface #13573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ trait BCodeSkelBuilder extends BCodeHelpers {
emitAnnotations(cnode, claszSymbol.annotations ++ ssa)

if (!isCZStaticModule && !isCZParcelable) {
val skipStaticForwarders = (claszSymbol.isInterface || claszSymbol.is(Module) || ctx.settings.XnoForwarders.value)
val skipStaticForwarders = (claszSymbol.is(Module) || ctx.settings.XnoForwarders.value)
if (!skipStaticForwarders) {
val lmoc = claszSymbol.companionModule
// add static forwarders if there are no name conflicts; see bugs #363 and #1735
Expand Down
4 changes: 4 additions & 0 deletions compiler/test/dotc/run-test-pickling.blacklist
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## Many of these tests fail because CompilationTests.pickling does not handle
## tests containing java files correctly

derive-generic.scala
eff-dependent.scala
enum-java
Expand Down Expand Up @@ -38,3 +41,4 @@ i12753
t6138
t6138-2
i12656.scala
trait-static-forwarder
2 changes: 1 addition & 1 deletion project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ object Build {
* set to 3.1.3. If it is going to be 3.1.0, it must be set to the latest
* 3.0.x release.
*/
val previousDottyVersion = "3.0.2"
val previousDottyVersion = "3.1.0-RC3"

object CompatMode {
final val BinaryCompatible = 0
Expand Down
43 changes: 0 additions & 43 deletions project/MiMaFilters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,5 @@ import com.typesafe.tools.mima.core.ProblemFilters._

object MiMaFilters {
val Library: Seq[ProblemFilter] = Seq(
// Experimental API for saferExceptions
exclude[MissingClassProblem]("scala.CanThrow"),
exclude[MissingClassProblem]("scala.CanThrow$package"),
exclude[MissingClassProblem]("scala.CanThrow$package$"),
exclude[MissingClassProblem]("scala.unsafeExceptions"),
exclude[MissingClassProblem]("scala.unsafeExceptions$"),
exclude[MissingFieldProblem]("scala.runtime.stdLibPatches.language#experimental.saferExceptions"),
exclude[MissingClassProblem]("scala.runtime.stdLibPatches.language$experimental$saferExceptions$"),

// New APIs that will be introduced in 3.1.0
exclude[ReversedMissingMethodProblem]("scala.quoted.Quotes#reflectModule.Wildcard"),
exclude[ReversedMissingMethodProblem]("scala.quoted.Quotes#reflectModule.WildcardTypeTest"),
exclude[ReversedMissingMethodProblem]("scala.quoted.Quotes#reflectModule#SourceFileMethods.getJPath"),
exclude[ReversedMissingMethodProblem]("scala.quoted.Quotes#reflectModule#SourceFileMethods.name"),
exclude[ReversedMissingMethodProblem]("scala.quoted.Quotes#reflectModule#SourceFileMethods.path"),
exclude[DirectMissingMethodProblem]("scala.quoted.Quotes#reflectModule#SourceFileMethods.getJPath"),
exclude[DirectMissingMethodProblem]("scala.quoted.Quotes#reflectModule#SourceFileMethods.name"),
exclude[DirectMissingMethodProblem]("scala.quoted.Quotes#reflectModule#SourceFileMethods.path"),
exclude[ReversedMissingMethodProblem]("scala.quoted.Quotes#reflectModule#UnapplyModule.apply"),
exclude[DirectMissingMethodProblem]("scala.quoted.Quotes#reflectModule#UnapplyModule.apply"),
exclude[ReversedMissingMethodProblem]("scala.quoted.Quotes#reflectModule.TypedOrTestTypeTest"),
exclude[ReversedMissingMethodProblem]("scala.quoted.Quotes#reflectModule.TypedOrTest"),
exclude[ReversedMissingMethodProblem]("scala.quoted.Quotes#reflectModule.TypedOrTestMethods"),
exclude[ReversedMissingMethodProblem]("scala.quoted.Quotes#reflectModule#TypeReprMethods.isTupleN"),

// TODO: Remove those filters after releasing 3.1.0:
exclude[DirectMissingMethodProblem]("scala.CanEqual.canEqualSeqs"),
exclude[DirectMissingMethodProblem]("scala.CanEqual.canEqualOptions"),
exclude[DirectMissingMethodProblem]("scala.CanEqual.canEqualOption"),
exclude[DirectMissingMethodProblem]("scala.CanEqual.canEqualEither"),
exclude[DirectMissingMethodProblem]("scala.Tuple.canEqualEmptyTuple"),
exclude[DirectMissingMethodProblem]("scala.Tuple.canEqualTuple"),
exclude[DirectMissingMethodProblem]("scala.quoted.Quotes#reflectModule.WildcardTypeTest"),
exclude[DirectMissingMethodProblem]("scala.quoted.Quotes#reflectModule.Wildcard"),
exclude[DirectMissingMethodProblem]("scala.quoted.Quotes#reflectModule.TypedOrTestTypeTest"),
exclude[DirectMissingMethodProblem]("scala.quoted.Quotes#reflectModule.TypedOrTest"),
exclude[DirectMissingMethodProblem]("scala.quoted.Quotes#reflectModule.TypedOrTestMethods"),
exclude[DirectMissingMethodProblem]("scala.quoted.Quotes#reflectModule#TypeReprMethods.isTupleN"),
exclude[MissingClassProblem]("scala.quoted.Quotes$reflectModule$TypedOrTestMethods"),
exclude[MissingClassProblem]("scala.quoted.Quotes$reflectModule$TypedOrTestModule"),
exclude[MissingClassProblem]("scala.quoted.Quotes$reflectModule$WildcardModule"),
exclude[MissingClassProblem]("scala.runtime.$throws$package"),
exclude[MissingClassProblem]("scala.runtime.$throws$package$"),
)
}
1 change: 1 addition & 0 deletions tests/run/trait-static-forwarder.check
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
42
5 changes: 5 additions & 0 deletions tests/run/trait-static-forwarder/Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public final class Test {
public static void main(String... args) {
System.out.println(T.foo());
}
}
5 changes: 5 additions & 0 deletions tests/run/trait-static-forwarder/forwarders.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
trait T

object T {
def foo = 42
}