Skip to content

Commit 3964599

Browse files
committed
Tweak: Don't refine parameters of Java classes
1 parent 7f0e259 commit 3964599

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

compiler/src/dotty/tools/dotc/cc/Setup.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ extends tpd.TreeTraverser:
9898
def addCaptureRefinements(tp: Type): Type = tp match
9999
case _: TypeRef | _: AppliedType if tp.typeParams.isEmpty =>
100100
tp.typeSymbol match
101-
case cls: ClassSymbol if !defn.isFunctionClass(cls) =>
101+
case cls: ClassSymbol
102+
if !defn.isFunctionClass(cls) && !cls.is(JavaDefined) =>
103+
// We assume that Java classes can refer to capturing Scala types only indirectly,
104+
// using type parameters. Hence, no need to refine them.
102105
cls.paramGetters.foldLeft(tp) { (core, getter) =>
103106
if getter.termRef.isTracked then
104107
val getterType = tp.memberInfo(getter).strippedDealias

0 commit comments

Comments
 (0)