Skip to content

Commit 69089b6

Browse files
committed
Disable mapJavaArgs when rechecking Apply nodes
It seems it's no longer needed.
1 parent 584b858 commit 69089b6

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,16 @@ abstract class Recheck extends Phase, SymTransformer:
253253
sym.typeRef
254254

255255
/** Assuming `formals` are parameters of a Java-defined method, remap Object
256-
* to FromJavaObject since it got lost in ElimRepeated
256+
* to FromJavaObject since it got lost in ElimRepeated.
257+
* NOTE: It seems this is no longer true, and `mapJavaArgs` is not needed.
258+
* The invocation is currently disabled in recheckApply.
257259
*/
258260
private def mapJavaArgs(formals: List[Type])(using Context): List[Type] =
259261
val tm = new TypeMap with IdempotentCaptRefMap:
260-
def apply(t: Type) = t match
261-
case t: TypeRef if t.symbol == defn.ObjectClass => defn.FromJavaObjectType
262-
case _ => mapOver(t)
262+
def apply(t: Type) =
263+
t match
264+
case t: TypeRef if t.symbol == defn.ObjectClass => defn.FromJavaObjectType
265+
case _ => mapOver(t)
263266
formals.mapConserve(tm)
264267

265268
/** Hook for method type instantiation */
@@ -274,7 +277,8 @@ abstract class Recheck extends Phase, SymTransformer:
274277
case fntpe: MethodType =>
275278
assert(fntpe.paramInfos.hasSameLengthAs(tree.args))
276279
val formals =
277-
if tree.symbol.is(JavaDefined) then mapJavaArgs(fntpe.paramInfos)
280+
if false && tree.symbol.is(JavaDefined) // see NOTE in mapJavaArgs
281+
then mapJavaArgs(fntpe.paramInfos)
278282
else fntpe.paramInfos
279283
def recheckArgs(args: List[Tree], formals: List[Type], prefs: List[ParamRef]): List[Type] = args match
280284
case arg :: args1 =>

0 commit comments

Comments
 (0)