Skip to content

Commit e9165e4

Browse files
authored
Merge pull request #1894 from dotty-staging/fix/inner-class-emission
Partially fix Java interop for emitted inner classes
2 parents 486b029 + 50268a1 commit e9165e4

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,10 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
560560
def javaBinaryName: Name = toDenot(sym).fullNameSeparated("/") // addModuleSuffix(fullNameInternal('/'))
561561
def javaClassName: String = toDenot(sym).fullName.toString// addModuleSuffix(fullNameInternal('.')).toString
562562
def name: Name = sym.name
563-
def rawname: Name = sym.name // todo ????
563+
def rawname: Name = {
564+
val original = toDenot(sym).initial
565+
sym.name(ctx.withPhase(original.validFor.phaseId))
566+
}
564567

565568
// types
566569
def info: Type = toDenot(sym).info
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class Outer {
2+
class InnerInClass
3+
4+
def inner() = new InnerInClass
5+
}
6+
object Outer {
7+
class InnerInObject
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
public class Test {
2+
public static void test() {
3+
Outer outer = new Outer();
4+
Outer.InnerInClass innerInClass = outer.inner();
5+
6+
// Does not work yet, requires https://github.com/DarkDimius/scala/pull/4
7+
// Outer.InnerInObject innerInObject = new Outer.InnerInObject();
8+
}
9+
}

0 commit comments

Comments
 (0)