aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/typer/TypeAssigner.scala8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/TypeAssigner.scala b/src/dotty/tools/dotc/typer/TypeAssigner.scala
index 2ec510a3d..d3baad848 100644
--- a/src/dotty/tools/dotc/typer/TypeAssigner.scala
+++ b/src/dotty/tools/dotc/typer/TypeAssigner.scala
@@ -210,7 +210,13 @@ trait TypeAssigner {
case p.arrayApply => MethodType(defn.IntType :: Nil, arrayElemType)
case p.arrayUpdate => MethodType(defn.IntType :: arrayElemType :: Nil, defn.UnitType)
case p.arrayLength => MethodType(Nil, defn.IntType)
- case nme.clone_ if qualType.isInstanceOf[JavaArrayType] => MethodType(Nil, qualType)
+
+ // Note that we do not need to handle calls to Array[T]#clone() specially:
+ // The JLS section 10.7 says "The return type of the clone method of an array type
+ // T[] is T[]", but the actual return type at the bytecode level is Object which
+ // is casted to T[] by javac. Since the return type of Array[T]#clone() is Array[T],
+ // this is exactly what Erasure will do.
+
case _ => accessibleSelectionType(tree, qual)
}
tree.withType(tp)