File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -251,7 +251,10 @@ object PrepareInlineable {
251251 */
252252 object InlineSplice {
253253 def unapply (tree : Tree )(implicit ctx : Context ): Option [Tree ] = tree match {
254- case Spliced (code) if Splicer .canBeSpliced(code) => Some (code)
254+ case Spliced (code) if Splicer .canBeSpliced(code) =>
255+ if (code.symbol.flags.is(Inline ))
256+ ctx.error(" Macro cannot be implemented with an `inline` method" , code.sourcePos)
257+ Some (code)
255258 case Block (List (stat), Literal (Constants .Constant (()))) => unapply(stat)
256259 case Block (Nil , expr) => unapply(expr)
257260 case Typed (expr, _) => unapply(expr)
Original file line number Diff line number Diff line change 1+ import scala .quoted ._
2+
3+ inline def assert (expr : => Boolean ): Unit =
4+ $ { assertImpl(' expr ) } // error: Macro cannot be implemented with an `inline` method
5+
6+ inline def assertImpl (expr : Expr [Boolean ]): Expr [Unit ] = ' { println(" Hello World" ) }
You can’t perform that action at this time.
0 commit comments