Skip to content

Don't emit inner classes as static classes #6268

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
Apr 9, 2019
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
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/backend/jvm/BackendInterface.scala
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,8 @@ abstract class BackendInterface extends BackendInterfaceDefinitions {
* object T { def f { object U } }
* the owner of U is T, so UModuleClass.isStatic is true. Phase travel does not help here.
*/
def isOriginallyStaticOwner: Boolean

def isOriginallyStaticOwner: Boolean =
isPackageClass || isModuleClass && originalOwner.isOriginallyStaticOwner

def samMethod(): Symbol

Expand Down
12 changes: 0 additions & 12 deletions compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala
Original file line number Diff line number Diff line change
Expand Up @@ -839,18 +839,6 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
toDenot(sym).owner.is(Flags.PackageClass)
}

/**
* This is basically a re-implementation of sym.isStaticOwner, but using the originalOwner chain.
*
* The problem is that we are interested in a source-level property. Various phases changed the
* symbol's properties in the meantime, mostly lambdalift modified (destructively) the owner.
* Therefore, `sym.isStatic` is not what we want. For example, in
* object T { def f { object U } }
* the owner of U is T, so UModuleClass.isStatic is true. Phase travel does not help here.
*/
def isOriginallyStaticOwner: Boolean = sym.isStatic


def addRemoteRemoteExceptionAnnotation: Unit = ()

def samMethod(): Symbol =
Expand Down
1 change: 1 addition & 0 deletions compiler/test/dotc/run-test-pickling.blacklist
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ instances.scala
instances-anonymous.scala
mixin-forwarder-overload
t8905
t10889
1 change: 1 addition & 0 deletions tests/run/t10889.check
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
new O(o).I[](i)
6 changes: 6 additions & 0 deletions tests/run/t10889/O.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package p
class O(val o: String) {
class I[T](val i: String) {
println(s"new O($o).I[]($i)")
}
}
6 changes: 6 additions & 0 deletions tests/run/t10889/Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
public class Test {
public static void main(String[] args) {
p.O l = new p.O("o");
p.O.I<Object> s = l.new I<Object>(/*l,*/ "i");
}
}