Skip to content

Commit b63c3e5

Browse files
authored
Merge pull request #7290 from ashwinbhaskar/compiler_crash_fix
Fixes #6626. Pass sym.name to sanitizeName instead of sym.name.asSimpleName
2 parents 99e05f7 + 7a8abe7 commit b63c3e5

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

compiler/src/dotty/tools/dotc/transform/GenericSignatures.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import core.Annotations.Annotation
66
import core.Contexts.Context
77
import core.Definitions
88
import core.Flags._
9-
import core.Names.Name
9+
import core.Names.{DerivedName, Name, SimpleName, TypeName}
1010
import core.Symbols._
1111
import core.TypeApplications.TypeParamInfo
1212
import core.TypeErasure.erasure
@@ -17,6 +17,8 @@ import SymUtils._
1717
import TypeUtils._
1818
import java.lang.StringBuilder
1919

20+
import scala.annotation.tailrec
21+
2022
/** Helper object to generate generic java signatures, as defined in
2123
* the Java Virtual Machine Specification, §4.3.4
2224
*/
@@ -161,7 +163,7 @@ object GenericSignatures {
161163

162164
// TODO revisit this. Does it align with javac for code that can be expressed in both languages?
163165
val delimiter = if (builder.charAt(builder.length() - 1) == '>') '.' else '$'
164-
builder.append(delimiter).append(sanitizeName(sym.name.asSimpleName))
166+
builder.append(delimiter).append(sanitizeName(sym.name))
165167
}
166168
else fullNameInSig(sym)
167169
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Test$Foo$A<Test$Foo<T1>$B$>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
object Test {
2+
def main(args: Array[String]): Unit = {
3+
val objectB = classOf[Foo[Any]].getClasses
4+
val returnType = objectB(1).getDeclaredMethod("m").getGenericReturnType
5+
println(returnType)
6+
}
7+
class Foo[T1] {
8+
class A[T2]
9+
10+
object B {
11+
def m: A[B.type] = ???
12+
}
13+
}
14+
}
15+

0 commit comments

Comments
 (0)