Closed
Description
minimized code
Macros_1.scala
inline def g = '{1}
def h(given scala.quoted.QuoteContext) = g
inline def mcr = ${h}
Test_2.scala
@main def Test = println(mcr)
Compile it:
-- Error: /Users/anatolii/Projects/dotty/pg/i7343-2/neg/Test_2.scala:1:25 ------
1 |@main def Test = println(mcr)
| ^^^
| Exception occurred while executing macro expansion.
| java.lang.Exception: Not in inline macro.
| at scala.quoted.QuoteContext$.macroContext(QuoteContext.scala:52)
| at Macros_1$package$.h(Macros_1.scala:1)
|
| This location is in code that was inlined at Test_2.scala:1
one error found
If you define g
from Macros_1.scala
with an explicit given QuoteContext
:
inline def g(given scala.quoted.QuoteContext) = '{1}
Test
runs fine.
expectation
I would expect a compile-time error saying that g
is lacking a given QuoteContext
parameter.