Skip to content

Commit 006748d

Browse files
committed
Simplify abstracted
As @smarter noted, makes no sense to use a boolean parameter here. We got there by refactoring blindness.
1 parent 013101d commit 006748d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -934,11 +934,10 @@ class Namer { typer: Typer =>
934934
}
935935

936936
def typeDefSig(tdef: TypeDef, sym: Symbol, tparamSyms: List[TypeSymbol])(implicit ctx: Context): Type = {
937-
def abstracted(tp: Type, canAbstract: Boolean): Type =
938-
if (tparamSyms.nonEmpty && canAbstract) tp.LambdaAbstract(tparamSyms)
939-
else tp
937+
def abstracted(tp: Type): Type =
938+
if (tparamSyms.nonEmpty) tp.LambdaAbstract(tparamSyms) else tp
940939

941-
val dummyInfo = abstracted(TypeBounds.empty, canAbstract = true)
940+
val dummyInfo = abstracted(TypeBounds.empty)
942941
sym.info = dummyInfo
943942
// Temporarily set info of defined type T to ` >: Nothing <: Any.
944943
// This is done to avoid cyclic reference errors for F-bounds.
@@ -952,7 +951,8 @@ class Namer { typer: Typer =>
952951
// inspects a TypeRef's info, instead of simply dealiasing alias types.
953952

954953
val isDerived = tdef.rhs.isInstanceOf[untpd.DerivedTypeTree]
955-
val rhsType = abstracted(typedAheadType(tdef.rhs).tpe, canAbstract = !isDerived)
954+
val rhsBodyType = typedAheadType(tdef.rhs).tpe
955+
val rhsType = if (isDerived) rhsBodyType else abstracted(rhsBodyType)
956956
val unsafeInfo = rhsType match {
957957
case bounds: TypeBounds => bounds
958958
case alias => TypeAlias(alias, if (sym is Local) sym.variance else 0)

0 commit comments

Comments
 (0)