aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc
diff options
context:
space:
mode:
authorDmitry Petrashko <dark@d-d.me>2016-04-26 16:14:56 +0200
committerDmitry Petrashko <dark@d-d.me>2016-04-26 16:14:56 +0200
commit4d7aaf637edafa1305602fc9f63b4c2ed4288ad5 (patch)
treed43603872c2390c11ee9866e61bd999327f9ef4f /src/dotty/tools/dotc
parentef2c479a752e3811c3a7f76bf355ddce955bb464 (diff)
parent769f8a080ec7513cb59c74813de6b562f6b641bb (diff)
downloaddotty-4d7aaf637edafa1305602fc9f63b4c2ed4288ad5.tar.gz
dotty-4d7aaf637edafa1305602fc9f63b4c2ed4288ad5.tar.bz2
dotty-4d7aaf637edafa1305602fc9f63b4c2ed4288ad5.zip
Merge pull request #1237 from dotty-staging/vc-ofDim
arrayConstructors: do not rewrite ofDim for arrays of value classes
Diffstat (limited to 'src/dotty/tools/dotc')
-rw-r--r--src/dotty/tools/dotc/transform/ArrayConstructors.scala10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/transform/ArrayConstructors.scala b/src/dotty/tools/dotc/transform/ArrayConstructors.scala
index ec3bfa47f..74213d332 100644
--- a/src/dotty/tools/dotc/transform/ArrayConstructors.scala
+++ b/src/dotty/tools/dotc/transform/ArrayConstructors.scala
@@ -42,11 +42,14 @@ class ArrayConstructors extends MiniPhaseTransform { thisTransform =>
val TypeApply(tycon, targ :: Nil) = tree.fun
rewrite(targ.tpe, tree.args)
} else if ((tree.fun.symbol.maybeOwner eq defn.ArrayModule) && (tree.fun.symbol.name eq nme.ofDim) && !tree.tpe.isInstanceOf[MethodicType]) {
-
+ val Apply(Apply(TypeApply(_, List(tp)), _), _) = tree
+ val cs = tp.tpe.widen.classSymbol
tree.fun match {
- case Apply(TypeApply(t: Ident, targ), dims) if !TypeErasure.isUnboundedGeneric(targ.head.tpe) =>
+ case Apply(TypeApply(t: Ident, targ), dims)
+ if !TypeErasure.isUnboundedGeneric(targ.head.tpe) && !ValueClasses.isDerivedValueClass(cs) =>
rewrite(targ.head.tpe, dims)
- case Apply(TypeApply(t: Select, targ), dims) if !TypeErasure.isUnboundedGeneric(targ.head.tpe) =>
+ case Apply(TypeApply(t: Select, targ), dims)
+ if !TypeErasure.isUnboundedGeneric(targ.head.tpe) && !ValueClasses.isDerivedValueClass(cs) =>
Block(t.qualifier :: Nil, rewrite(targ.head.tpe, dims))
case _ => tree
}
@@ -54,4 +57,3 @@ class ArrayConstructors extends MiniPhaseTransform { thisTransform =>
} else tree
}
}
-