File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -415,24 +415,28 @@ object Erasure {
415
415
* e.m -> e.[]m if `m` is an array operation other than `clone`.
416
416
*/
417
417
override def typedSelect (tree : untpd.Select , pt : Type )(implicit ctx : Context ): Tree = {
418
-
419
418
val qual1 = typed(tree.qualifier, AnySelectionProto )
420
419
421
420
def mapOwner (sym : Symbol ): Symbol = {
422
- def recur (owner : Symbol ): Symbol = {
423
- val owner = sym.maybeOwner
424
- if (! owner.exists) {
425
- // Hack for PolyFunction#apply
426
- qual1.tpe.widen.typeSymbol
427
- } else if (defn.specialErasure.contains(owner)) {
421
+ // PolyFunction apply Selects will not have a symbol, so deduce the owner
422
+ // from the typed qual.
423
+ def polyOwner : Symbol =
424
+ if (sym.exists || tree.name != nme.apply) NoSymbol
425
+ else {
426
+ val owner = qual1.tpe.widen.typeSymbol
427
+ if (defn.isFunctionClass(owner)) owner else NoSymbol
428
+ }
429
+
430
+ polyOwner orElse {
431
+ val owner = sym.owner
432
+ if (defn.specialErasure.contains(owner)) {
428
433
assert(sym.isConstructor, s " ${sym.showLocated}" )
429
434
defn.specialErasure(owner)
430
435
} else if (defn.isSyntheticFunctionClass(owner))
431
436
defn.erasedFunctionClass(owner)
432
437
else
433
438
owner
434
439
}
435
- recur(sym.maybeOwner)
436
440
}
437
441
438
442
val origSym = tree.symbol
You can’t perform that action at this time.
0 commit comments