Skip to content

Commit 965f164

Browse files
authored
Merge pull request #15093 from dotty-staging/gensig-nohk
Java generic signatures can't refer to type members
2 parents 72352dc + abdd536 commit 965f164

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import core.Definitions
99
import core.Flags._
1010
import core.Names.Name
1111
import core.Symbols._
12-
import core.TypeApplications.TypeParamInfo
12+
import core.TypeApplications.{EtaExpansion, TypeParamInfo}
1313
import core.TypeErasure.{erasedGlb, erasure, isGenericArrayElement}
1414
import core.Types._
1515
import core.classfile.ClassfileConstants
@@ -166,6 +166,7 @@ object GenericSignatures {
166166
// a type parameter or similar) must go through here or the signature is
167167
// likely to end up with Foo<T>.Empty where it needs Foo<T>.Empty$.
168168
def fullNameInSig(sym: Symbol): Unit = {
169+
assert(sym.isClass)
169170
val name = atPhase(genBCodePhase) { sanitizeName(sym.fullName).replace('.', '/') }
170171
builder.append('L').nn.append(name)
171172
}
@@ -183,11 +184,10 @@ object GenericSignatures {
183184
boxedSig(bounds.lo)
184185
}
185186
else builder.append('*')
186-
case PolyType(_, res) =>
187-
builder.append('*') // scala/bug#7932
187+
case EtaExpansion(tp) =>
188+
argSig(tp)
188189
case _: HKTypeLambda =>
189-
fullNameInSig(tp.typeSymbol)
190-
builder.append(';')
190+
builder.append('*')
191191
case _ =>
192192
boxedSig(tp.widenDealias.widenNullaryMethod)
193193
// `tp` might be a singleton type referring to a getter.

tests/run/t7932.check

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
public Category C.category()
22
public Category C.category1()
3+
public abstract Category<?> M2.category3()
4+
public abstract Category<java.lang.Object> M2.category2()
35
public default Category<F> M1.category()
46
public default Category<scala.Tuple2> M1.category1()
57
public static Category M1.category$(M1)
68
public static Category M1.category1$(M1)
9+
public abstract Category<?> M2.category3()
10+
public abstract Category<java.lang.Object> M2.category2()
711
public default Category<F> M2.category()
812
public default Category<scala.Tuple2> M2.category1()
913
public static Category M2.category$(M2)

tests/run/t7932.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ trait M1[F] {
1313
trait M2[F] { self: M1[F] =>
1414
override def category: Category[X] = null
1515
override def category1: Category[Tuple2] = null
16+
17+
type T[A, B]
18+
def category2: Category[T]
19+
def category3: Category[[A, B] =>> T[B, A]]
1620
}
1721

1822
abstract class C extends M1[Float] with M2[Float]

0 commit comments

Comments
 (0)