@@ -307,27 +307,36 @@ object PrepareTransparent {
307307 }
308308
309309 def traverse (tree : Tree )(implicit ctx : Context ): Unit = {
310+ val sym = tree.symbol
310311 tree match {
311312 case Ident (nme.WILDCARD ) =>
312313 case _ : Ident | _ : This =>
313314 // println(i"leaf: $tree at ${tree.pos}")
314- if (tree.symbol. exists && ! isLocal(tree.symbol , inlineMethod)) {
315+ if (sym. exists && ! isLocal(sym , inlineMethod)) {
315316 if (ctx.debug) inlining.println(i " type at $tree @ ${tree.pos.toSynthetic} = ${tree.tpe}" )
316- typeAtPos(tree.pos.toSynthetic) = tree.tpe
317+ tree.tpe match {
318+ case tp : NamedType if tp.prefix.member(sym.name).isOverloaded =>
319+ // refer to prefix instead of to ident directly, so that overloading can be resolved
320+ // again at expansion site
321+ println(i " RECORD start for $tree" )
322+ typeAtPos(tree.pos.startPos) = tp.prefix
323+ case _ =>
324+ typeAtPos(tree.pos.toSynthetic) = tree.tpe
325+ }
317326 // Note: It's possible that during traversals several types are stored under the same
318327 // position. This could happen for instance for implicit conersions added around a tree.
319328 // In general, it's always the innermost tree that holds the relevant type. The traversal
320329 // order guarantees that the innermost tree's type is stored last, and thereby replaces all previously
321330 // stored types.
322331 }
323332 case _ : Select =>
324- tree.symbol .name match {
333+ sym .name match {
325334 case InlineAccessorName (UniqueInlineName (_, _)) => return // was already recorded in Apply
326335 case InlineAccessorName (_) => registerAccessor(tree)
327336 case _ =>
328337 }
329338 case Apply (_ : RefTree | _ : TypeApply , receiver :: Nil ) =>
330- tree.symbol .name match {
339+ sym .name match {
331340 case InlineAccessorName (UniqueInlineName (_, _)) => registerAccessor(tree)
332341 case _ =>
333342 }
0 commit comments