diff options
author | Martin Odersky <odersky@gmail.com> | 2014-11-28 22:10:37 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-11-28 22:12:51 +0100 |
commit | 91c61e4694097971b9a0c139048b7239d0f05588 (patch) | |
tree | 6836b169dce43f32e588f60bb16d14dba850b254 /src/dotty/tools/dotc/typer/Applications.scala | |
parent | b18ce863f5f2444a5a00ccc9d55c4ee12115c467 (diff) | |
download | dotty-91c61e4694097971b9a0c139048b7239d0f05588.tar.gz dotty-91c61e4694097971b9a0c139048b7239d0f05588.tar.bz2 dotty-91c61e4694097971b9a0c139048b7239d0f05588.zip |
Previous scheme was buggy; leaked Array types to backend.
Now: All new Array[T] methods are translated to calls of the form
dotty.Arrays.newXYZArray ...
Diffstat (limited to 'src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Applications.scala | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala index ba770cf2c..fe45beb04 100644 --- a/src/dotty/tools/dotc/typer/Applications.scala +++ b/src/dotty/tools/dotc/typer/Applications.scala @@ -596,7 +596,16 @@ trait Applications extends Compatibility { self: Typer => checkBounds(typedArgs, pt) case _ => } - assignType(cpy.TypeApply(tree)(typedFn, typedArgs), typedFn, typedArgs) + convertNewArray( + assignType(cpy.TypeApply(tree)(typedFn, typedArgs), typedFn, typedArgs)) + } + + /** Rewrite `new Array[T]` trees to calls of newXYZArray methods. */ + def convertNewArray(tree: Tree)(implicit ctx: Context): Tree = tree match { + case TypeApply(tycon, targs) if tycon.symbol == defn.ArrayConstructor => + newArray(targs.head, tree.pos) + case _ => + tree } def typedUnApply(tree: untpd.Apply, selType: Type)(implicit ctx: Context): Tree = track("typedUnApply") { |