Skip to content

Commit ff89398

Browse files
committed
Show debugpring on notmatched
1 parent e36c28d commit ff89398

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

compiler/src/scala/quoted/runtime/impl/QuoteMatcher.scala

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,25 @@ object QuoteMatcher {
167167
val scrutinee = normalize(scrutinee0)
168168
val pattern = normalize(pattern0)
169169

170+
inline def notMatched[T]: optional[T] =
171+
if (debug)
172+
val quotes = QuotesImpl()
173+
println(
174+
s""">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
175+
|Scrutinee
176+
| ${scrutinee.show}
177+
|did not match pattern
178+
| ${pattern.show}
179+
|
180+
|with environment: ${summon[Env]}
181+
|
182+
|Scrutinee: ${quotes.reflect.Printer.TreeStructure.show(scrutinee.asInstanceOf)}
183+
|Pattern: ${quotes.reflect.Printer.TreeStructure.show(pattern.asInstanceOf)}
184+
|
185+
|""".stripMargin)
186+
optional.break()
187+
188+
170189
/** Check that both are `val` or both are `lazy val` or both are `var` **/
171190
def checkValFlags(): Boolean = {
172191
val sFlags = scrutinee.symbol.flags

0 commit comments

Comments
 (0)