@@ -57,6 +57,7 @@ class Erasure extends Phase with DenotTransformer {
57
57
case _ => false
58
58
}
59
59
}
60
+
60
61
def erasedName =
61
62
if ref.is(Flags .Method )
62
63
&& contextResultsAreErased(ref.symbol)
@@ -381,29 +382,26 @@ object Erasure {
381
382
*/
382
383
def adaptToType (tree : Tree , pt : Type )(using Context ): Tree = pt match
383
384
case _ : FunProto | AnyFunctionProto => tree
384
- case _ =>
385
- /* val ahead = tree.attachmentOrElse(needsEta, 0)
386
- if ahead > 0 then etaExpand(tree, ahead, pt)
387
- else*/ tree.tpe.widen match
388
- case mt : MethodType if tree.isTerm =>
389
- assert(mt.paramInfos.isEmpty)
390
- adaptToType(tree.appliedToNone, pt)
391
- case tpw =>
392
- if (pt.isInstanceOf [ProtoType ] || tree.tpe <:< pt)
393
- tree
394
- else if (tpw.isErasedValueType)
395
- if (pt.isErasedValueType) then
396
- tree.asInstance(pt)
397
- else
398
- adaptToType(box(tree), pt)
399
- else if (pt.isErasedValueType)
400
- adaptToType(unbox(tree, pt), pt)
401
- else if (tpw.isPrimitiveValueType && ! pt.isPrimitiveValueType)
402
- adaptToType(box(tree), pt)
403
- else if (pt.isPrimitiveValueType && ! tpw.isPrimitiveValueType)
404
- adaptToType(unbox(tree, pt), pt)
385
+ case _ => tree.tpe.widen match
386
+ case mt : MethodType if tree.isTerm =>
387
+ assert(mt.paramInfos.isEmpty)
388
+ adaptToType(tree.appliedToNone, pt)
389
+ case tpw =>
390
+ if (pt.isInstanceOf [ProtoType ] || tree.tpe <:< pt)
391
+ tree
392
+ else if (tpw.isErasedValueType)
393
+ if (pt.isErasedValueType) then
394
+ tree.asInstance(pt)
405
395
else
406
- cast(tree, pt)
396
+ adaptToType(box(tree), pt)
397
+ else if (pt.isErasedValueType)
398
+ adaptToType(unbox(tree, pt), pt)
399
+ else if (tpw.isPrimitiveValueType && ! pt.isPrimitiveValueType)
400
+ adaptToType(box(tree), pt)
401
+ else if (pt.isPrimitiveValueType && ! tpw.isPrimitiveValueType)
402
+ adaptToType(unbox(tree, pt), pt)
403
+ else
404
+ cast(tree, pt)
407
405
end adaptToType
408
406
409
407
/** The following code:
0 commit comments