File tree 2 files changed +10
-1
lines changed
compiler/src/dotty/tools/dotc/typer 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -251,7 +251,10 @@ object PrepareInlineable {
251
251
*/
252
252
object InlineSplice {
253
253
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)
255
258
case Block (List (stat), Literal (Constants .Constant (()))) => unapply(stat)
256
259
case Block (Nil , expr) => unapply(expr)
257
260
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