Skip to content

Commit 8f17872

Browse files
committed
Fix #1474: Fix applies to applyDynamic.
1 parent 2e2fcc0 commit 8f17872

File tree

6 files changed

+10
-7
lines changed

6 files changed

+10
-7
lines changed

src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -592,13 +592,15 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
592592
fun1.tpe match {
593593
case ErrorType => tree.withType(ErrorType)
594594
case TryDynamicCallType =>
595-
tree match {
596-
case Apply(Select(qual, name), args) if !isDynamicMethod(name) =>
597-
typedDynamicApply(qual, name, None, args, pt)(tree)
598-
case Apply(TypeApply(Select(qual, name), targs), args) if !isDynamicMethod(name) =>
599-
typedDynamicApply(qual, name, Some(targs), args, pt)(tree)
600-
case _ =>
601-
handleUnexpectedFunType(tree, fun1)
595+
tree.fun match {
596+
case Select(qual, name) if !isDynamicMethod(name) =>
597+
typedDynamicApply(qual, name, None, tree.args, pt)(tree)
598+
case TypeApply(Select(qual, name), targs) if !isDynamicMethod(name) =>
599+
typedDynamicApply(qual, name, Some(targs), tree.args, pt)(tree)
600+
case TypeApply(fun, targs) =>
601+
typedDynamicApply(fun, nme.apply, Some(targs), tree.args, pt)(tree)
602+
case fun =>
603+
typedDynamicApply(fun, nme.apply, None, tree.args, pt)(tree)
602604
}
603605
case _ =>
604606
tryEither {

tests/pending/run/applydynamic_sip.scala renamed to tests/run/applydynamic_sip.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import scala.language.dynamics
12
object Test extends dotty.runtime.LegacyApp {
23
object stubUpdate {
34
def update(as: Any*) = println(".update"+as.toList.mkString("(",", ", ")"))
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)