Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler

object BlockTypeTest extends TypeTest[Tree, Block]:
def unapply(x: Tree): Option[Block & x.type] = x match
case x: (tpd.Block & x.type) => Some(x)
case x: (tpd.Block & x.type) if x.isTerm => Some(x)
case _ => None
end BlockTypeTest

Expand Down
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions tests/pos-macros/i21721-b/Macro_1.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import scala.quoted._

inline def test(): Any = ${ testImpl }

def testImpl(using Quotes): Expr[Any] =
import quotes.reflect._
TypeBlock(Nil, TypeTree.of[Int]) match
case Block(_, res) =>
res.asExpr // unexpected case - would crash here, as res of TypeBlock is not a term
case _ =>
'{()} // expected case
1 change: 1 addition & 0 deletions tests/pos-macros/i21721-b/Test_2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@main def Test() = test()
Loading