@@ -70,7 +70,9 @@ object Inliner {
70
70
71
71
def postTransform (tree : Tree )(implicit ctx : Context ) = tree match {
72
72
case Assign (lhs, rhs) if lhs.symbol.name.is(InlineAccessorName ) =>
73
- cpy.Apply (tree)(useSetter(lhs), rhs :: Nil )
73
+ val setter = useSetter(lhs)
74
+ if (inlineSym.isTransparentMethod) tree // just generate a setter, but don't integrate it in the tree
75
+ else cpy.Apply (tree)(setter, rhs :: Nil )
74
76
case _ =>
75
77
tree
76
78
}
@@ -686,6 +688,18 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
686
688
*/
687
689
trait InlineTyping extends Typer {
688
690
691
+ override def ensureAccessible (tpe : Type , superAccess : Boolean , pos : Position )(implicit ctx : Context ): Type = {
692
+ tpe match {
693
+ case tpe @ TypeRef (pre, _) if ! tpe.symbol.isAccessibleFrom(pre, superAccess) =>
694
+ tpe.info match {
695
+ case TypeAlias (alias) => return ensureAccessible(alias, superAccess, pos)
696
+ case _ =>
697
+ }
698
+ case _ =>
699
+ }
700
+ super .ensureAccessible(tpe, superAccess, pos)
701
+ }
702
+
689
703
override def typedIf (tree : untpd.If , pt : Type )(implicit ctx : Context ) = {
690
704
val cond1 = typed(tree.cond, defn.BooleanType )
691
705
cond1.tpe.widenTermRefExpr match {
@@ -752,18 +766,6 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
752
766
/** A re-typer used for inlined methods */
753
767
private class InlineReTyper extends ReTyper with InlineTyping {
754
768
755
- override def ensureAccessible (tpe : Type , superAccess : Boolean , pos : Position )(implicit ctx : Context ): Type = {
756
- tpe match {
757
- case tpe @ TypeRef (pre, _) if ! tpe.symbol.isAccessibleFrom(pre, superAccess) =>
758
- tpe.info match {
759
- case TypeAlias (alias) => return ensureAccessible(alias, superAccess, pos)
760
- case _ =>
761
- }
762
- case _ =>
763
- }
764
- super .ensureAccessible(tpe, superAccess, pos)
765
- }
766
-
767
769
override def typedIdent (tree : untpd.Ident , pt : Type )(implicit ctx : Context ) =
768
770
tree.asInstanceOf [tpd.Tree ] match {
769
771
case InlineableArg (rhs) => inlining.println(i " inline arg $tree -> $rhs" ); rhs
0 commit comments