@@ -1254,14 +1254,8 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
12541254 super .ensureAccessible(tpe, superAccess, pos)
12551255 }
12561256
1257- override def typed (tree : untpd.Tree , pt : Type = WildcardType )(using Context ): Tree =
1258- val tree1 = super .typed(tree, pt)
1259- if Inliner .needsInlining(tree1)
1260- then Inliner .inlineCall(tree1)
1261- else tree1
1262-
12631257 override def typedIdent (tree : untpd.Ident , pt : Type )(using Context ): Tree =
1264- tryInlineArg(tree.asInstanceOf [tpd.Tree ]) `orElse` super .typedIdent(tree, pt)
1258+ inlineIfNeeded( tryInlineArg(tree.asInstanceOf [tpd.Tree ]) `orElse` super .typedIdent(tree, pt) )
12651259
12661260 override def typedSelect (tree : untpd.Select , pt : Type )(using Context ): Tree = {
12671261 assert(tree.hasType, tree)
@@ -1273,7 +1267,7 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
12731267 else
12741268 val res = resMaybeReduced
12751269 ensureAccessible(res.tpe, tree.qualifier.isInstanceOf [untpd.Super ], tree.srcPos)
1276- res
1270+ inlineIfNeeded( res)
12771271 }
12781272
12791273 override def typedIf (tree : untpd.If , pt : Type )(using Context ): Tree =
@@ -1310,14 +1304,14 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
13101304 val expanded = expandMacro(res.args.head, tree.span)
13111305 typedExpr(expanded) // Inline calls and constant fold code generated by the macro
13121306 case res =>
1313- res
1307+ inlineIfNeeded( res)
13141308 }
13151309 if res.symbol == defn.QuotedRuntime_exprQuote then
13161310 ctx.compilationUnit.needsQuotePickling = true
13171311 res
13181312
13191313 override def typedTypeApply (tree : untpd.TypeApply , pt : Type )(using Context ): Tree =
1320- constToLiteral(betaReduce(super .typedTypeApply(tree, pt)))
1314+ inlineIfNeeded( constToLiteral(betaReduce(super .typedTypeApply(tree, pt) )))
13211315
13221316 override def typedMatch (tree : untpd.Match , pt : Type )(using Context ): Tree =
13231317 val tree1 =
@@ -1376,6 +1370,10 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
13761370 /** True if this inline typer has already issued errors */
13771371 override def hasInliningErrors (using Context ) = ctx.reporter.errorCount > initialErrorCount
13781372
1373+ private def inlineIfNeeded (tree : Tree )(using Context ): Tree =
1374+ if Inliner .needsInlining(tree) then Inliner .inlineCall(tree)
1375+ else tree
1376+
13791377 }
13801378
13811379 /** Drop any side-effect-free bindings that are unused in expansion or other reachable bindings.
0 commit comments