aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/ReTyper.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-08-28 18:26:13 +0200
committerMartin Odersky <odersky@gmail.com>2014-08-28 18:26:35 +0200
commitcdaa3a0249977bc2a9eb385fb840d62e01273f71 (patch)
treec6fe36e90309555fa583f12927a03765eba4a6fa /src/dotty/tools/dotc/typer/ReTyper.scala
parent215f73f1f6b8b03b49bdab80fbbfcf4574203d2b (diff)
downloaddotty-cdaa3a0249977bc2a9eb385fb840d62e01273f71.tar.gz
dotty-cdaa3a0249977bc2a9eb385fb840d62e01273f71.tar.bz2
dotty-cdaa3a0249977bc2a9eb385fb840d62e01273f71.zip
Enabling primitive operations in ReTyper
The idea is that primitive operations do not have a symbol, but when applied have directly a MethodType. Such operations will be generated in Erasure for array ops. The patch allows retyping of such operations.
Diffstat (limited to 'src/dotty/tools/dotc/typer/ReTyper.scala')
-rw-r--r--src/dotty/tools/dotc/typer/ReTyper.scala8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/typer/ReTyper.scala b/src/dotty/tools/dotc/typer/ReTyper.scala
index 230788cc1..4014aa202 100644
--- a/src/dotty/tools/dotc/typer/ReTyper.scala
+++ b/src/dotty/tools/dotc/typer/ReTyper.scala
@@ -70,5 +70,13 @@ class ReTyper extends Typer {
override def encodeName(tree: untpd.NameTree)(implicit ctx: Context) = tree
+ override def handleUnexpectedFunType(tree: untpd.Apply, fun: Tree)(implicit ctx: Context): Tree = fun.tpe match {
+ case mt @ MethodType(_, formals) =>
+ val args: List[Tree] = tree.args.zipWithConserve(formals)(typedExpr(_, _)).asInstanceOf[List[Tree]]
+ assignType(untpd.cpy.Apply(tree)(fun, args), fun, args)
+ case _ =>
+ super.handleUnexpectedFunType(tree, fun)
+ }
+
override def checkVariance(tree: Tree)(implicit ctx: Context) = ()
} \ No newline at end of file