@@ -862,15 +862,14 @@ trait Checking {
862
862
}
863
863
864
864
/** Check that `tree` can be right hand-side or argument to `inline` value or parameter. */
865
- def checkInlineConformant (tree : Tree , isFinal : Boolean , what : => String )(using Context ): Unit = {
866
- // final vals can be marked inline even if they're not pure, see Typer#patchFinalVals
867
- val purityLevel = if (isFinal) Idempotent else Pure
868
- tree.tpe.widenTermRefExpr match {
869
- case tp : ConstantType if exprPurity(tree) >= purityLevel => // ok
870
- case _ =>
871
- if (! ctx.erasedTypes && ! ctx.inInlineMethod)
872
- ctx.error(em " $what must be a known value " , tree.sourcePos)
873
- }
865
+ def checkInlineConformant (tpt : Tree , tree : Tree , sym : Symbol )(using Context ): Unit = {
866
+ if sym.is(Inline , butNot = DeferredOrTermParamOrAccessor ) && ! ctx.erasedTypes && ! ctx.inInlineMethod then
867
+ // final vals can be marked inline even if they're not pure, see Typer#patchFinalVals
868
+ val purityLevel = if (sym.is(Final )) Idempotent else Pure
869
+ tpt.tpe.widenTermRefExpr match
870
+ case tp : ConstantType if exprPurity(tree) >= purityLevel => // ok
871
+ case _ =>
872
+ ctx.error(em " type of inline must be a known value " , tree.sourcePos)
874
873
}
875
874
876
875
/** A hook to exclude selected symbols from double declaration check */
@@ -1199,7 +1198,7 @@ trait NoChecking extends ReChecking {
1199
1198
override def checkImplicitConversionDefOK (sym : Symbol )(using Context ): Unit = ()
1200
1199
override def checkImplicitConversionUseOK (sym : Symbol , posd : Positioned )(using Context ): Unit = ()
1201
1200
override def checkFeasibleParent (tp : Type , pos : SourcePosition , where : => String = " " )(using Context ): Type = tp
1202
- override def checkInlineConformant (tree : Tree , isFinal : Boolean , what : => String )(using Context ): Unit = ()
1201
+ override def checkInlineConformant (tpt : Tree , tree : Tree , sym : Symbol )(using Context ): Unit = ()
1203
1202
override def checkNoAlphaConflict (stats : List [Tree ])(using Context ): Unit = ()
1204
1203
override def checkParentCall (call : Tree , caller : ClassSymbol )(using Context ): Unit = ()
1205
1204
override def checkSimpleKinded (tpt : Tree )(using Context ): Tree = tpt
0 commit comments