File tree Expand file tree Collapse file tree 3 files changed +22
-3
lines changed
compiler/src/dotty/tools/dotc/transform
tests/run-macros/dollar-asInstanceOf-dollar Expand file tree Collapse file tree 3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -193,8 +193,12 @@ object Splicer {
193193 val staticMethodCall = interpretedStaticMethodCall(fn.symbol.owner, fn.symbol)
194194 staticMethodCall(args.flatten.map(interpretTree))
195195 } else if (fn.qualifier.symbol.is(Module ) && fn.qualifier.symbol.isStatic) {
196- val staticMethodCall = interpretedStaticMethodCall(fn.qualifier.symbol.moduleClass, fn.symbol)
197- staticMethodCall(args.flatten.map(interpretTree))
196+ if (fn.name == nme.asInstanceOfPM) {
197+ interpretModuleAccess(fn.qualifier.symbol)
198+ } else {
199+ val staticMethodCall = interpretedStaticMethodCall(fn.qualifier.symbol.moduleClass, fn.symbol)
200+ staticMethodCall(args.flatten.map(interpretTree))
201+ }
198202 } else if (env.contains(fn.name)) {
199203 env(fn.name)
200204 } else if (tree.symbol.is(InlineProxy )) {
@@ -265,7 +269,6 @@ object Splicer {
265269
266270 val name = getDirectName(fn.info.finalResultType, fn.name.asTermName)
267271 val method = getMethod(clazz, name, paramsSig(fn))
268-
269272 (args : List [Object ]) => stopIfRuntimeException(method.invoke(inst, args : _* ))
270273 }
271274
Original file line number Diff line number Diff line change 1+ import scala .quoted ._
2+ import scala .deriving ._
3+
4+ case class Box [A ](x : A )
5+
6+ object Macro {
7+ inline def foo [X [_]](implicit inline m : Mirror { type MirroredType = X }): Int =
8+ $ { fooImpl }
9+
10+ def fooImpl [X [_]](implicit m : Mirror { type MirroredType = X }, qc : QuoteContext ): Expr [Int ] =
11+ ' { 1 }
12+ }
Original file line number Diff line number Diff line change 1+ object Test {
2+ def main (args : Array [String ]): Unit =
3+ assert(Macro .foo[Box ] == 1 )
4+ }
You can’t perform that action at this time.
0 commit comments