File tree Expand file tree Collapse file tree 3 files changed +15
-0
lines changed
compiler/src/scala/quoted/runtime/impl Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -247,6 +247,8 @@ object QuoteMatcher {
247247 case ref : Ident =>
248248 ref.tpe match
249249 case TermRef (qual : TermRef , _) => tpd.ref(qual) =?= qual2
250+ case TermRef (qual : ThisType , _) if qual.classSymbol.is(Module ) =>
251+ tpd.ref(ref.symbol) =?= pattern
250252 case _ => matched
251253 /* Match reference */
252254 case _ : Ident if symbolMatch(scrutinee, pattern) => matched
Original file line number Diff line number Diff line change 1+ import quoted .*
2+
3+ inline def isFoo (inline x : Any ): Boolean = $ { isFooImpl(' x ) }
4+
5+ def isFooImpl (x : Expr [Any ])(using Quotes ): Expr [Boolean ] =
6+ x match
7+ case ' { ($p : Parent ).foo } => ' { true }
8+ case _ => ' { false }
9+
10+ trait Parent :
11+ def foo = 0
Original file line number Diff line number Diff line change 1+ object Child extends Parent :
2+ def bar = isFoo(foo)
You can’t perform that action at this time.
0 commit comments