Skip to content

Commit c4680c8

Browse files
committed
Make sure expanded method names are legal according to JVM spec
1 parent 70ad514 commit c4680c8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,11 @@ object SymDenotations {
299299
/** The expanded name of this denotation. */
300300
final def expandedName(implicit ctx: Context) =
301301
if (is(ExpandedName) || isConstructor) name
302-
else name.expandedName(initial.asSymDenotation.owner)
302+
else {
303+
def legalize(name: Name): Name = // JVM method names may not contain `<' or `>' characters
304+
if (is(Method)) name.replace('<', '(').replace('>', ')') else name
305+
legalize(name.expandedName(initial.asSymDenotation.owner))
306+
}
303307
// need to use initial owner to disambiguate, as multiple private symbols with the same name
304308
// might have been moved from different origins into the same class
305309

0 commit comments

Comments
 (0)