aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/typer/Applications.scala10
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala1
2 files changed, 11 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala
index fe45beb04..d54ff21be 100644
--- a/src/dotty/tools/dotc/typer/Applications.scala
+++ b/src/dotty/tools/dotc/typer/Applications.scala
@@ -763,6 +763,16 @@ trait Applications extends Compatibility { self: Typer =>
}
}
+ /** A dummmy typed unapply, to make re-typers between frontend and pattern matcher
+ * visit all subnodes of an unApply tree.
+ */
+ def typedUnApply(tree: untpd.UnApply, selType: Type)(implicit ctx: Context) = {
+ val unappType = typed(tree.fun)
+ tree.implicits.foreach(typed(_))
+ tree.patterns.foreach(typedPattern(_))
+ tree.withType(selType)
+ }
+
/** Is given method reference applicable to type arguments `targs` and argument trees `args`?
* @param resultType The expected result type of the application
*/
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index f6027165b..3282b8288 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -1017,6 +1017,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
case tree: untpd.PackageDef => typedPackageDef(tree)
case tree: untpd.Annotated => typedAnnotated(tree, pt)
case tree: untpd.TypedSplice => tree.tree
+ case tree: untpd.UnApply => typedUnApply(tree, pt)
case untpd.PostfixOp(tree, nme.WILDCARD) => typedAsFunction(tree, pt)
case untpd.EmptyTree => tpd.EmptyTree
case _ => typedUnadapted(desugar(tree), pt)