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 {
415415 * e.m -> e.[]m if `m` is an array operation other than `clone`.
416416 */
417417 override def typedSelect (tree : untpd.Select , pt : Type )(implicit ctx : Context ): Tree = {
418-
419418 val qual1 = typed(tree.qualifier, AnySelectionProto )
420419
421420 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)) {
428433 assert(sym.isConstructor, s " ${sym.showLocated}" )
429434 defn.specialErasure(owner)
430435 } else if (defn.isSyntheticFunctionClass(owner))
431436 defn.erasedFunctionClass(owner)
432437 else
433438 owner
434439 }
435- recur(sym.maybeOwner)
436440 }
437441
438442 val origSym = tree.symbol
You can’t perform that action at this time.
0 commit comments