diff options
author | Martin Odersky <odersky@gmail.com> | 2014-08-28 18:26:13 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-08-28 18:26:35 +0200 |
commit | cdaa3a0249977bc2a9eb385fb840d62e01273f71 (patch) | |
tree | c6fe36e90309555fa583f12927a03765eba4a6fa /src/dotty/tools/dotc/typer/Applications.scala | |
parent | 215f73f1f6b8b03b49bdab80fbbfcf4574203d2b (diff) | |
download | dotty-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/Applications.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Applications.scala | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala index a126db1ad..ff465ea2f 100644 --- a/src/dotty/tools/dotc/typer/Applications.scala +++ b/src/dotty/tools/dotc/typer/Applications.scala @@ -476,10 +476,8 @@ trait Applications extends Compatibility { self: Typer => } case _ => fun1.tpe match { - case ErrorType => - tree.withType(ErrorType) - case tp => - throw new Error(s"unexpected type.\n fun1 = $fun1,\n methPart(fun1) = ${methPart(fun1)},\n methPart(fun1).tpe = ${methPart(fun1).tpe},\n tpe = $tp") + case ErrorType => tree.withType(ErrorType) + case tp => handleUnexpectedFunType(tree, fun1) } } } @@ -515,6 +513,10 @@ trait Applications extends Compatibility { self: Typer => else realApply } + /** Overridden in ReTyper to handle primitive operations that can be generated after erasure */ + protected def handleUnexpectedFunType(tree: untpd.Apply, fun: Tree)(implicit ctx: Context): Tree = + throw new Error(s"unexpected type.\n fun = $fun,\n methPart(fun) = ${methPart(fun)},\n methPart(fun).tpe = ${methPart(fun).tpe},\n tpe = ${fun.tpe}") + def typedTypeApply(tree: untpd.TypeApply, pt: Type)(implicit ctx: Context): Tree = track("typedTypeApply") { var typedArgs = tree.args mapconserve (typedType(_)) val typedFn = typedExpr(tree.fun, PolyProto(typedArgs.tpes, pt)) |