Skip to content

Generate signature for local class #10936

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
Dec 29, 2020
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 @@ -33,8 +33,8 @@ object GenericSignatures {
* @return The signature if it could be generated, `None` otherwise.
*/
def javaSig(sym0: Symbol, info: Type)(using Context): Option[String] =
// Avoid generating a signature for local symbols.
if (sym0.isLocal) None
// Avoid generating a signature for non-class local symbols.
if (sym0.isLocal && !sym0.isClass) None
else atPhase(erasurePhase)(javaSig0(sym0, info))

@noinline
Expand Down
2 changes: 2 additions & 0 deletions tests/generic-java-signatures/i6349.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Foo<java.lang.String>
Foo<java.lang.String>
12 changes: 12 additions & 0 deletions tests/generic-java-signatures/i6349.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class Foo[T]
object Test {
class Inner extends Foo[String]

def main(args: Array[String]): Unit = {
class Local extends Foo[String]

println((new Inner).getClass.getGenericSuperclass) // Foo<java.lang.String>

println((new Local).getClass.getGenericSuperclass) // Foo<java.lang.String>
}
}