Skip to content

Commit 3f4805d

Browse files
committed
0.9.3 try to fix crash in named pattern match transformation
1 parent 5238abc commit 3f4805d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

utest/src-3/utest/TestBuilder.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@ object TestBuilder:
5656
override def transformTerm(t: Term)(owner: Symbol): Term =
5757
t.tpe.widen match {
5858
case _: MethodType | _: PolyType => super.transformTerm(t)(owner)
59-
case _ => t.asExpr match {
60-
case '{ TestPath.synthetic } => '{ TestPath($pathExpr) }.asTerm
59+
// Need a `Try` here because sometimes `t` is inside a
60+
// named pattern match which causes asExpr to blow up
61+
case _ => scala.util.Try(t.asExpr) match {
62+
case Success('{ TestPath.synthetic }) => '{ TestPath($pathExpr) }.asTerm
6163
case _ => super.transformTerm(t)(owner)
6264
}
6365
}

0 commit comments

Comments
 (0)