Skip to content

Commit ec3cdab

Browse files
authored
Merge pull request #5656 from panacekcz/fix-5655
Fix #5655: Use a prefix to construct a TypeRef when parsing Java signature
2 parents 5de6116 + 22ab968 commit ec3cdab

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ class ClassfileParser(
363363
accept('.')
364364
val name = subName(c => c == ';' || c == '<' || c == '.').toTypeName
365365
val clazz = tpe.member(name).symbol
366-
tpe = processClassType(processInner(clazz.typeRef))
366+
tpe = processClassType(processInner(TypeRef(tpe, clazz)))
367367
}
368368
accept(';')
369369
tpe

tests/pos/i5655/J_1.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
public class J_1{
2+
public class A<T>{
3+
public class B<U>{}
4+
}
5+
A<String>.B<String> m(){
6+
J_1 j = new J_1();
7+
A<String> a = j.new A<>();
8+
A<String>.B<String> b = a.new B<>();
9+
return b;
10+
}
11+
}

tests/pos/i5655/S_2.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
object O {
2+
def main(args: Array[String]) = {
3+
val j = new J_1
4+
val ab: J_1#A[String]#B[String] = j.m()
5+
}
6+
}

0 commit comments

Comments
 (0)