forked from scala/scala3
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kotlin interop: Find nested class if InnerClass entry is missing
This is a port of scala/scala#5822 which works around a bug in Kotlin (https://youtrack.jetbrains.com/issue/KT-27936). Fixes scala#12086. Co-Authored-By: Lukas Rytz <lukas.rytz@gmail.com> Co-Authored-By: Brandon Barker <beb82@cornell.edu>
- Loading branch information
1 parent
064c213
commit b590482
Showing
4 changed files
with
64 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class C$D { public int i() { return 1; } } | ||
class C$E { public int i() { return 1; } } | ||
class C$F$G { public int i() { return 1; } } | ||
|
||
// Test1 has a reference to C$D, which is a top-level class in this case, | ||
// so there's no INNERCLASS attribute in Test1 | ||
class Test_1 { | ||
static C$D mD(C$D cd) { return cd; } | ||
static C$E mE(C$E ce) { return ce; } | ||
static C$F$G mG(C$F$G cg ) { return cg; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class C { | ||
class D { public int i() { return 2; } } | ||
static class E { public int i() { return 2; } } | ||
static class F { static class G { public int i() { return 2; } } } | ||
} | ||
|
||
// Test2 has an INNERCLASS attribute for C$D | ||
class Test_2 { | ||
public static int acceptD(C.D cd) { return cd.i(); } | ||
public static int acceptE(C.E ce) { return ce.i(); } | ||
public static int acceptG(C.F.G cg ) { return cg.i(); } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
object Test { | ||
def main(args: Array[String]): Unit = { | ||
val c = new C | ||
assert(Test_2.acceptD(Test_1.mD(new c.D)) == 2) | ||
assert(Test_2.acceptE(Test_1.mE(new C.E)) == 2) | ||
assert(Test_2.acceptG(Test_1.mG(new C.F.G)) == 2) | ||
} | ||
} |