diff options
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") { |