Skip to content

Commit 0c8e1ea

Browse files
committed
Remove refinement encoding of hk types
Remove the code that implemented the encoding of hk types using refinements. Drop the notion that RefinedTypes can be type parameters. This is no longer true under the new representation. Also, refactoring MemberBinding -> TypeParamInfo
1 parent ad92537 commit 0c8e1ea

17 files changed

+112
-653
lines changed

src/dotty/tools/dotc/config/Config.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ object Config {
1010

1111
final val checkCacheMembersNamed = false
1212

13-
final val newHK = true
14-
1513
/** When updating a constraint bound, check that the constrained parameter
1614
* does not appear at the top-level of either of its bounds.
1715
*/

src/dotty/tools/dotc/core/ConstraintHandling.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,6 @@ trait ConstraintHandling {
286286
if (!addParamBound(bound)) NoType
287287
else if (fromBelow) defn.NothingType
288288
else defn.AnyType
289-
case bound: RefinedType if !Config.newHK =>
290-
bound.normalizeHkApplyOLD
291289
case _ =>
292290
bound
293291
}

src/dotty/tools/dotc/core/MemberBinding.scala

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/dotty/tools/dotc/core/NameOps.scala

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -101,21 +101,6 @@ object NameOps {
101101
name.length > 0 && name.last == '=' && name.head != '=' && isOperatorPart(name.head)
102102
}
103103

104-
/** Is this the name of a higher-kinded type parameter of a Lambda? */
105-
def isHkArgNameOLD =
106-
name.length > 0 &&
107-
name.head == tpnme.hkArgPrefixHeadOLD &&
108-
name.startsWith(tpnme.hkArgPrefixOLD) && {
109-
val digits = name.drop(tpnme.hkArgPrefixLengthOLD)
110-
digits.length <= 4 && digits.forall(_.isDigit)
111-
}
112-
113-
/** The index of the higher-kinded type parameter with this name.
114-
* Pre: isLambdaArgName.
115-
*/
116-
def hkArgIndexOLD: Int =
117-
name.drop(tpnme.hkArgPrefixLengthOLD).toString.toInt
118-
119104
/** If the name ends with $nn where nn are
120105
* all digits, strip the $ and the digits.
121106
* Otherwise return the argument.

src/dotty/tools/dotc/core/StdNames.scala

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -529,10 +529,6 @@ object StdNames {
529529

530530
val synthSwitch: N = "$synthSwitch"
531531

532-
val hkArgPrefixOLD: N = "$hk"
533-
val hkArgPrefixHeadOLD: Char = hkArgPrefixOLD.head
534-
val hkArgPrefixLengthOLD: Int = hkArgPrefixOLD.length
535-
536532
// unencoded operators
537533
object raw {
538534
final val AMP : N = "&"
@@ -746,8 +742,6 @@ object StdNames {
746742
def syntheticLambdaParamNames(num: Int): List[TypeName] =
747743
(0 until num).map(syntheticLambdaParamName)(breakOut)
748744

749-
def hkArgOLD(n: Int): TypeName = hkArgPrefixOLD ++ n.toString
750-
751745
final val Conforms = encode("<:<")
752746
}
753747

src/dotty/tools/dotc/core/Symbols.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ object Symbols {
367367
* @param coord The coordinates of the symbol (a position or an index)
368368
* @param id A unique identifier of the symbol (unique per ContextBase)
369369
*/
370-
class Symbol private[Symbols] (val coord: Coord, val id: Int) extends DotClass with MemberBinding with printing.Showable {
370+
class Symbol private[Symbols] (val coord: Coord, val id: Int) extends DotClass with TypeParamInfo with printing.Showable {
371371

372372
type ThisName <: Name
373373

@@ -489,12 +489,12 @@ object Symbols {
489489
*/
490490
def pos: Position = if (coord.isPosition) coord.toPosition else NoPosition
491491

492-
// MemberBinding methods
492+
// TypeParamInfo methods
493493
def isTypeParam(implicit ctx: Context) = denot.is(TypeParam)
494-
def memberName(implicit ctx: Context): Name = name
495-
def memberBounds(implicit ctx: Context) = denot.info.bounds
496-
def memberBoundsAsSeenFrom(pre: Type)(implicit ctx: Context) = pre.memberInfo(this).bounds
497-
def memberVariance(implicit ctx: Context) = denot.variance
494+
def paramName(implicit ctx: Context): Name = name
495+
def paramBounds(implicit ctx: Context) = denot.info.bounds
496+
def paramBoundsAsSeenFrom(pre: Type)(implicit ctx: Context) = pre.memberInfo(this).bounds
497+
def paramVariance(implicit ctx: Context) = denot.variance
498498

499499
// -------- Printing --------------------------------------------------------
500500

0 commit comments

Comments
 (0)