@@ -97,7 +97,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
9797 new ExprImpl (self, SpliceScope .getCurrent)
9898 else self match
9999 case TermTypeTest (self) => throw new Exception (" Expected an expression. This is a partially applied Term. Try eta-expanding the term first." )
100- case _ => throw new Exception (" Expected a Term but was: " + self)
100+ case _ => throw new Exception (" Expected a Term but was: " + Printer . TreeStructure .show( self) )
101101 end extension
102102
103103 extension (self : Tree )
@@ -186,10 +186,11 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
186186
187187 object StatementTypeTest extends TypeTest [Tree , Statement ]:
188188 def unapply (x : Tree ): Option [Statement & x.type ] = x match
189- case _ : tpd.PatternTree => None
190- case _ =>
191- if x.isTerm then TermTypeTest .unapply(x)
192- else DefinitionTypeTest .unapply(x)
189+ case TermTypeTest (x : x.type ) => Some (x)
190+ case DefinitionTypeTest (x : x.type ) => Some (x)
191+ case ImportTypeTest (x : x.type ) => Some (x)
192+ case ExportTypeTest (x : x.type ) => Some (x)
193+ case _ => None
193194 end StatementTypeTest
194195
195196 type Definition = tpd.MemberDef
@@ -1021,7 +1022,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
10211022
10221023 object TypeIdentTypeTest extends TypeTest [Tree , TypeIdent ]:
10231024 def unapply (x : Tree ): Option [TypeIdent & x.type ] = x match
1024- case tpt : (tpd.Ident & x.type ) if tpt.isType => Some (tpt)
1025+ case tpt : (tpd.Ident & x.type ) if tpt.isType && tpt.name != nme. WILDCARD => Some (tpt)
10251026 case _ => None
10261027 end TypeIdentTypeTest
10271028
@@ -1335,7 +1336,7 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
13351336
13361337 object WildcardTypeTreeTypeTest extends TypeTest [Tree , WildcardTypeTree ]:
13371338 def unapply (x : Tree ): Option [WildcardTypeTree & x.type ] = x match
1338- case x : (tpd.Ident & x.type ) if x.name == nme.WILDCARD => Some (x)
1339+ case x : (tpd.Ident & x.type ) if x.isType && x. name == nme.WILDCARD => Some (x)
13391340 case _ => None
13401341 end WildcardTypeTreeTypeTest
13411342
0 commit comments