Skip to content

Commit d101f49

Browse files
committed
Polishings
1 parent 2e04574 commit d101f49

File tree

7 files changed

+13
-19
lines changed

7 files changed

+13
-19
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ object desugar {
245245
if (tdef.mods is PrivateLocalParam) {
246246
val tparam = cpy.TypeDef(tdef)(name = tdef.name.expandedName(ctx.owner))
247247
.withMods(tdef.mods &~ PrivateLocal | ExpandedName)
248-
val alias = cpy.TypeDef(tdef)(name = tdef.name, rhs = refOfDef(tparam))
248+
val alias = cpy.TypeDef(tdef)(rhs = refOfDef(tparam))
249249
.withMods(tdef.mods & VarianceFlags | PrivateLocalParamAccessor | Synthetic)
250250
Thicket(tparam, alias)
251251
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,9 +360,9 @@ trait ConstraintHandling {
360360
if (comparedTypeLambdas.nonEmpty) {
361361
val approx = new ApproximatingTypeMap {
362362
def apply(t: Type): Type = t match {
363-
case t @ TypeParamRef(pt: TypeLambda, n) if comparedTypeLambdas contains pt =>
363+
case t @ TypeParamRef(tl: TypeLambda, n) if comparedTypeLambdas contains tl =>
364364
val effectiveVariance = if (fromBelow) -variance else variance
365-
val bounds = pt.paramInfos(n)
365+
val bounds = tl.paramInfos(n)
366366
if (effectiveVariance > 0) bounds.lo
367367
else if (effectiveVariance < 0) bounds.hi
368368
else NoType

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,8 @@ object Symbols {
516516
// ParamInfo types and methods
517517
def isTypeParam(implicit ctx: Context) = denot.is(TypeParam)
518518
def paramName(implicit ctx: Context) = name.asInstanceOf[ThisName]
519-
def paramInfo(implicit ctx: Context) = denot.info.bounds
520-
def paramInfoAsSeenFrom(pre: Type)(implicit ctx: Context) = pre.memberInfo(this).bounds
519+
def paramInfo(implicit ctx: Context) = denot.info
520+
def paramInfoAsSeenFrom(pre: Type)(implicit ctx: Context) = pre.memberInfo(this)
521521
def paramInfoOrCompleter(implicit ctx: Context): Type = denot.infoOrCompleter
522522
def paramVariance(implicit ctx: Context) = denot.variance
523523
def paramRef(implicit ctx: Context) = denot.typeRef

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,13 @@ object Types {
6565
* | +- ExprType
6666
* | +- AnnotatedType
6767
* | +- TypeVar
68-
* | +- HKLambda --------- PolyType
68+
* | +- HKTypeLambda
6969
* |
7070
* +- GroundType -+- AndType
7171
* +- OrType
72-
* +- MethodOrPoly ----- MethodType ---+- ImplicitMethodType
73-
* | +- JavaMethodType
72+
* +- MethodOrPoly ---+-- PolyType
73+
* +-- MethodType ---+- ImplicitMethodType
74+
* | +- JavaMethodType
7475
* +- ClassInfo
7576
* |
7677
* +- NoType
@@ -2359,8 +2360,8 @@ object Types {
23592360
def isDependent(implicit ctx: Context): Boolean
23602361
def isParamDependent(implicit ctx: Context): Boolean
23612362

2362-
final def isTermLambda = paramNames.head.isTermName
2363-
final def isTypeLambda = paramNames.head.isTypeName
2363+
final def isTermLambda = isInstanceOf[TermLambda]
2364+
final def isTypeLambda = isInstanceOf[TypeLambda]
23642365
final def isHigherKinded = isInstanceOf[TypeProxy]
23652366

23662367
lazy val paramRefs: List[ParamRef] = paramNames.indices.toList.map(newParamRef)

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,6 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table, posUnpickle
227227
def readLengthType(): Type = {
228228
val end = readEnd()
229229

230-
def readNamesSkipParams: (List[Name], TreeReader) = {
231-
val nameReader = fork
232-
nameReader.skipTree() // skip result
233-
val paramReader = nameReader.fork
234-
(nameReader.readParamNames(end), paramReader)
235-
}
236-
237230
def readMethodic[N <: Name, PInfo <: Type, LT <: LambdaType]
238231
(companion: LambdaTypeCompanion[N, PInfo, LT], nameMap: Name => N): LT = {
239232
val nameReader = fork

compiler/src/dotty/tools/dotc/printing/Formatting.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ object Formatting {
3131
case arg: Showable =>
3232
try arg.show
3333
catch {
34-
case NonFatal(ex) if false => s"[cannot display due to $ex, raw string = $toString]"
34+
case NonFatal(ex) => s"[cannot display due to $ex, raw string = $toString]"
3535
}
3636
case _ => arg.toString
3737
}

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
10551055
typr.println(s"adding refinement $refinement")
10561056
checkRefinementNonCyclic(refinement, refineCls, seen)
10571057
val rsym = refinement.symbol
1058-
if (rsym.info.isInstanceOf[TypeLambda] && rsym.allOverriddenSymbols.isEmpty)
1058+
if (rsym.info.isInstanceOf[PolyType] && rsym.allOverriddenSymbols.isEmpty)
10591059
ctx.error(i"polymorphic refinement $rsym without matching type in parent $tpt1 is no longer allowed", refinement.pos) }
10601060
assignType(cpy.RefinedTypeTree(tree)(tpt1, refinements1), tpt1, refinements1, refineCls)
10611061
}

0 commit comments

Comments
 (0)