Skip to content

Commit c8c5e5a

Browse files
committed
Add InlineByNameProxy flag conjunction
1 parent fe67510 commit c8c5e5a

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

compiler/src/dotty/tools/dotc/core/Flags.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,9 @@ object Flags {
608608
/** An inline method */
609609
final val InlineMethod: FlagConjunction = allOf(Inline, Method)
610610

611+
/** An inline by-name parameter proxy */
612+
final val InlineByNameProxy: FlagConjunction = allOf(InlineProxy, Method)
613+
611614
/** An inline parameter */
612615
final val InlineParam: FlagConjunction = allOf(Inline, Param)
613616

compiler/src/dotty/tools/dotc/transform/Splicer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import dotty.tools.dotc.ast.tpd
88
import dotty.tools.dotc.ast.Trees._
99
import dotty.tools.dotc.core.Contexts._
1010
import dotty.tools.dotc.core.Decorators._
11-
import dotty.tools.dotc.core.Flags.{Method => MethodFlag, _}
11+
import dotty.tools.dotc.core.Flags._
1212
import dotty.tools.dotc.core.NameKinds.FlatName
1313
import dotty.tools.dotc.core.Names.{Name, TermName}
1414
import dotty.tools.dotc.core.StdNames._
@@ -313,7 +313,7 @@ object Splicer {
313313
protected final def interpretTree(tree: Tree)(implicit env: Env): Result = tree match {
314314
case Apply(TypeApply(fn, _), quoted :: Nil) if fn.symbol == defn.QuotedExpr_apply =>
315315
val quoted1 = quoted match {
316-
case quoted: Ident if quoted.symbol.is(InlineProxy) && quoted.symbol.is(MethodFlag) =>
316+
case quoted: Ident if quoted.symbol.is(InlineByNameProxy) =>
317317
// inline proxy for by-name parameter
318318
quoted.symbol.defTree.asInstanceOf[DefDef].rhs
319319
case Inlined(EmptyTree, _, quoted) => quoted

compiler/src/dotty/tools/dotc/typer/Inliner.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
253253
var inlineFlag = InlineProxy
254254
if (paramtp.hasAnnotation(defn.InlineParamAnnot)) inlineFlag |= Inline
255255
val (bindingFlags, bindingType) =
256-
if (isByName) (Method | InlineProxy, ExprType(argtpe.widen))
256+
if (isByName) (InlineByNameProxy.toTermFlags, ExprType(argtpe.widen))
257257
else (inlineFlag, argtpe.widen)
258258
val boundSym = newSym(name, bindingFlags, bindingType).asTerm
259259
val binding = {

0 commit comments

Comments
 (0)