aboutsummaryrefslogtreecommitdiff
path: root/src/dotty
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-01-14 13:02:57 +0100
committerMartin Odersky <odersky@gmail.com>2014-01-14 13:03:03 +0100
commit41e22296813188b1def6bc948e138244afd9cb92 (patch)
tree1f55fdb5ed0482e1e55d3ff7bd41fde2c3307e37 /src/dotty
parent3affebe539b3461e7ea84411fe0a3943ccf35b4b (diff)
downloaddotty-41e22296813188b1def6bc948e138244afd9cb92.tar.gz
dotty-41e22296813188b1def6bc948e138244afd9cb92.tar.bz2
dotty-41e22296813188b1def6bc948e138244afd9cb92.zip
Renaming to make program Scala2x and Dotty compatible.
Diffstat (limited to 'src/dotty')
-rw-r--r--src/dotty/tools/dotc/core/Substituters.scala2
-rw-r--r--src/dotty/tools/dotc/core/Types.scala13
2 files changed, 10 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/core/Substituters.scala b/src/dotty/tools/dotc/core/Substituters.scala
index 0df1ea49f..944931698 100644
--- a/src/dotty/tools/dotc/core/Substituters.scala
+++ b/src/dotty/tools/dotc/core/Substituters.scala
@@ -10,7 +10,7 @@ trait Substituters { this: Context =>
final def subst(tp: Type, from: BindingType, to: BindingType, map: SubstBindingMap): Type =
tp match {
case tp: BoundType =>
- if (tp.binder eq from) tp.copy(to.asInstanceOf[tp.BT]) else tp
+ if (tp.binder eq from) tp.copyBoundType(to.asInstanceOf[tp.BT]) else tp
case tp: NamedType =>
if (tp.symbol.isStatic) tp
else tp.derivedSelect(subst(tp.prefix, from, to, map))
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index 85e89fa62..4e961ecd9 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -1644,7 +1644,11 @@ object Types {
abstract class BoundType extends UncachedProxyType with ValueType {
type BT <: BindingType
def binder: BT
- def copy(bt: BT): Type
+ // Dotty deviation: copyBoundType was copy, but
+ // dotty generates copy methods always automatically, and therefore
+ // does not accept same-named method definitions in subclasses.
+ // Scala2x, on the other hand, requires them (not sure why!)
+ def copyBoundType(bt: BT): Type
}
abstract class ParamType extends BoundType {
@@ -1654,7 +1658,7 @@ object Types {
case class MethodParam(binder: MethodType, paramNum: Int) extends ParamType with SingletonType {
type BT = MethodType
override def underlying(implicit ctx: Context): Type = binder.paramTypes(paramNum)
- def copy(bt: BT) = MethodParam(bt, paramNum)
+ def copyBoundType(bt: BT) = MethodParam(bt, paramNum)
// need to customize hashCode and equals to prevent infinite recursion for dep meth types.
override def hashCode = System.identityHashCode(binder) + paramNum
@@ -1670,7 +1674,7 @@ object Types {
case class PolyParam(binder: PolyType, paramNum: Int) extends ParamType {
type BT = PolyType
- def copy(bt: BT) = PolyParam(bt, paramNum)
+ def copyBoundType(bt: BT) = PolyParam(bt, paramNum)
/** Looking only at the structure of `bound`, is one of the following true?
* - fromBelow and param <:< bound
@@ -1693,7 +1697,8 @@ object Types {
case class RefinedThis(binder: RefinedType) extends BoundType with SingletonType {
type BT = RefinedType
override def underlying(implicit ctx: Context) = binder.parent
- def copy(bt: BT) = RefinedThis(bt)
+ def copyBoundType(bt: BT) = RefinedThis(bt)
+
// need to customize hashCode and equals to prevent infinite recursion for
// refinements that refer to the refinement type via this
override def hashCode = System.identityHashCode(binder)