@@ -1047,6 +1047,12 @@ class Inliner(val call: tpd.Tree)(using Context):
10471047 reduceInlineMatchExpr(sel)
10481048 }
10491049
1050+ override def typedTyped (tree : untpd.Typed , pt : Type )(using Context ): Tree =
1051+ if tree.hasAttachment(PrepareInlineable .InlineResultAscription ) then
1052+ typedExpr(tree.expr, pt)
1053+ else
1054+ super .typedTyped(tree, pt)
1055+
10501056 override def newLikeThis (nestingLevel : Int ): Typer = new InlineTyper (initialErrorCount, nestingLevel)
10511057
10521058 /** True if this inline typer has already issued errors */
@@ -1056,20 +1062,8 @@ class Inliner(val call: tpd.Tree)(using Context):
10561062 val meth = tree.symbol
10571063 if meth.isAllOf(DeferredInline ) then
10581064 errorTree(tree, em " Deferred inline ${meth.showLocated} cannot be invoked " )
1059- else if Inlines .needsInlining(tree) then
1060- StripInlineResultAscriptionMap ().transform(Inlines .inlineCall(simplify(tree, pt, locked)))
1061- else
1062- tree
1063-
1064- private class StripInlineResultAscriptionMap extends tpd.TreeMap :
1065- override def transform (tree : Tree )(using Context ): Tree =
1066- tree match
1067- case Typed (expr, _) if tree.hasAttachment(PrepareInlineable .InlineResultAscription ) =>
1068- expr
1069- case tree : Inlined =>
1070- super .transform(tree)
1071- case _ =>
1072- tree
1065+ else if Inlines .needsInlining(tree) then Inlines .inlineCall(simplify(tree, pt, locked))
1066+ else tree
10731067
10741068 override def typedUnadapted (tree : untpd.Tree , pt : Type , locked : TypeVars )(using Context ): Tree =
10751069 super .typedUnadapted(tree, pt, locked) match
0 commit comments