Skip to content

Commit 50dc05c

Browse files
committed
Make overloaded in Quotes return a Term instead of an apply.
It calls `applyOverloaded`, but the interaction of named and default parameters means that sometimes arguments have to be lifted out and a block is returned instead of an apply.
1 parent bd9926d commit 50dc05c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -459,11 +459,11 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
459459
val denot = qualifier.tpe.member(name.toTermName)
460460
assert(!denot.isOverloaded, s"The symbol `$name` is overloaded. The method Select.unique can only be used for non-overloaded symbols.")
461461
withDefaultPos(tpd.Select(qualifier, name.toTermName))
462-
def overloaded(qualifier: Term, name: String, targs: List[TypeRepr], args: List[Term]): Apply =
463-
withDefaultPos(tpd.applyOverloaded(qualifier, name.toTermName, args, targs, Types.WildcardType).asInstanceOf[Apply])
462+
def overloaded(qualifier: Term, name: String, targs: List[TypeRepr], args: List[Term]): Term =
463+
withDefaultPos(tpd.applyOverloaded(qualifier, name.toTermName, args, targs, Types.WildcardType))
464464

465-
def overloaded(qualifier: Term, name: String, targs: List[TypeRepr], args: List[Term], returnType: TypeRepr): Apply =
466-
withDefaultPos(tpd.applyOverloaded(qualifier, name.toTermName, args, targs, returnType).asInstanceOf[Apply])
465+
def overloaded(qualifier: Term, name: String, targs: List[TypeRepr], args: List[Term], returnType: TypeRepr): Term =
466+
withDefaultPos(tpd.applyOverloaded(qualifier, name.toTermName, args, targs, returnType))
467467
def copy(original: Tree)(qualifier: Term, name: String): Select =
468468
tpd.cpy.Select(original)(qualifier, name.toTermName)
469469
def unapply(x: Select): (Term, String) =

library/src/scala/quoted/Quotes.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,10 +776,10 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
776776
def unique(qualifier: Term, name: String): Select
777777

778778
/** Call an overloaded method with the given type and term parameters */
779-
def overloaded(qualifier: Term, name: String, targs: List[TypeRepr], args: List[Term]): Apply
779+
def overloaded(qualifier: Term, name: String, targs: List[TypeRepr], args: List[Term]): Term
780780

781781
/** Call an overloaded method with the given type and term parameters */
782-
def overloaded(qualifier: Term, name: String, targs: List[TypeRepr], args: List[Term], returnType: TypeRepr): Apply
782+
def overloaded(qualifier: Term, name: String, targs: List[TypeRepr], args: List[Term], returnType: TypeRepr): Term
783783

784784
def copy(original: Tree)(qualifier: Term, name: String): Select
785785

0 commit comments

Comments
 (0)