diff options
author | Martin Odersky <odersky@gmail.com> | 2014-06-12 12:46:57 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-06-12 12:55:11 +0200 |
commit | 51563aee5478f90a0f86c29385f74d020b8995dd (patch) | |
tree | 05d317678ee3eda3c8d15af334e5a7e221722644 /src/dotty/tools/dotc/core/Types.scala | |
parent | c2175ec910165308e81c48bd8ca8910c50862be4 (diff) | |
download | dotty-51563aee5478f90a0f86c29385f74d020b8995dd.tar.gz dotty-51563aee5478f90a0f86c29385f74d020b8995dd.tar.bz2 dotty-51563aee5478f90a0f86c29385f74d020b8995dd.zip |
Change definition of isLegalPrefix so that it allows projecting on an abstract type.
This is needed to make the encoding og higher-kinded types work. E.g.
Rep[Int]
would be represented as
Rep { type Arg$0 = Int } # Apply
where Apply is an abstract member of the base class Lambfa$I of Rep.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index 89facfee5..827e851a9 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -117,14 +117,15 @@ object Types { } /** A type T is a legal prefix in a type selection T#A if - * T is stable or T contains no abstract types + * T is stable or T contains no abstract types except possibly A. * !!! Todo: What about non-final vals that contain abstract types? */ - final def isLegalPrefix(implicit ctx: Context): Boolean = + final def isLegalPrefixFor(selector: Name)(implicit ctx: Context): Boolean = isStable || { val absTypeNames = memberNames(abstractTypeNameFilter) if (absTypeNames.nonEmpty) typr.println(s"abstract type members of ${this.showWithUnderlying()}: $absTypeNames") - absTypeNames.isEmpty + absTypeNames.isEmpty || + absTypeNames.head == selector && absTypeNames.tail.isEmpty } /** Is this type guaranteed not to have `null` as a value? |