File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -210,7 +210,13 @@ trait TypeAssigner {
210210 case p.arrayApply => MethodType (defn.IntType :: Nil , arrayElemType)
211211 case p.arrayUpdate => MethodType (defn.IntType :: arrayElemType :: Nil , defn.UnitType )
212212 case p.arrayLength => MethodType (Nil , defn.IntType )
213- case nme.clone_ if qualType.isInstanceOf [JavaArrayType ] => MethodType (Nil , qualType)
213+
214+ // Note that we do not need to handle calls to Array[T]#clone() specially:
215+ // The JLS section 10.7 says "The return type of the clone method of an array type
216+ // T[] is T[]", but the actual return type at the bytecode level is Object which
217+ // is casted to T[] by javac. Since the return type of Array[T]#clone() is Array[T],
218+ // this is exactly what Erasure will do.
219+
214220 case _ => accessibleSelectionType(tree, qual)
215221 }
216222 tree.withType(tp)
You can’t perform that action at this time.
0 commit comments