@@ -533,29 +533,32 @@ object Inlines:
533
533
end expandDefs
534
534
535
535
protected class InlineTraitTypeMap extends InlinerTypeMap {
536
- override def apply (t : Type ) = t match {
537
- case t : ThisType if t.cls == parentSym => ctx.owner.thisType
538
- case t => super .apply(t)
536
+ override def apply (t : Type ) = super .apply(t) match {
537
+ case t : ThisType if t.cls == parentSym =>
538
+ ctx.owner.thisType
539
+ case t =>
540
+ mapOver(t)
539
541
}
540
542
}
541
543
542
544
protected class InlineTraitTreeMap extends InlinerTreeMap {
543
- override def apply (tree : Tree ) = tree match {
544
- case tree : This if tree.qual.name == parentSym.name =>
545
- Inlined (EmptyTree , Nil , This (ctx.owner.asClass).withSpan(parent.span)).withSpan(tree .span)
545
+ override def apply (tree : Tree ) = super .apply( tree) match {
546
+ case tree : This if tree.symbol == parentSym =>
547
+ Inlined (EmptyTree , Nil , This (ctx.owner.asClass).withSpan(parent.span)).withSpan(parent .span)
546
548
case tree : This =>
547
549
tree.tpe match {
548
550
case thisTpe : ThisType if thisTpe.cls.isInlineTrait =>
549
- integrate(This (ctx.owner.asClass).withSpan(call.span), thisTpe.cls)
550
- case _ => super .apply(tree)
551
+ integrate(This (ctx.owner.asClass).withSpan(parent.span), thisTpe.cls)
552
+ case _ =>
553
+ tree
551
554
}
552
555
case Select (qual, name) =>
553
556
paramAccessorsMapper.getParamAccessorName(qual.symbol, name) match {
554
- case Some (newName) => Select (apply (qual), newName).withSpan(tree .span)
555
- case None => super .apply(tree )
557
+ case Some (newName) => Select (this (qual), newName).withSpan(parent .span)
558
+ case None => Select ( this (qual), name )
556
559
}
557
560
case tree =>
558
- super .apply( tree)
561
+ tree
559
562
}
560
563
}
561
564
@@ -564,6 +567,11 @@ object Inlines:
564
567
565
568
override protected def substFrom : List [Symbol ] = innerClassNewSyms.keys.toList
566
569
override protected def substTo : List [Symbol ] = innerClassNewSyms.values.toList
570
+ override protected def inlineCopier : tpd.TreeCopier = new TypedTreeCopier () {
571
+ // FIXME it feels weird... Is this correct?
572
+ override def Apply (tree : Tree )(fun : Tree , args : List [Tree ])(using Context ): Apply =
573
+ untpd.cpy.Apply (tree)(fun, args).withTypeUnchecked(tree.tpe)
574
+ }
567
575
568
576
override protected def computeThisBindings (): Unit = ()
569
577
override protected def canElideThis (tpe : ThisType ): Boolean = true
0 commit comments