diff options
author | Martin Odersky <odersky@gmail.com> | 2016-07-22 16:22:00 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-07-22 16:22:00 +0200 |
commit | 006748d895ade64b0b63916996eb7df8258def18 (patch) | |
tree | f3a8febc9736559e5793c18f1e7c09a841999330 /src | |
parent | 013101d9f77d8283007911c61aaae7ac9cc2d486 (diff) | |
download | dotty-006748d895ade64b0b63916996eb7df8258def18.tar.gz dotty-006748d895ade64b0b63916996eb7df8258def18.tar.bz2 dotty-006748d895ade64b0b63916996eb7df8258def18.zip |
Simplify abstracted
As @smarter noted, makes no sense to use a boolean parameter here.
We got there by refactoring blindness.
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/typer/Namer.scala | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala index 666047db2..2c08f238d 100644 --- a/src/dotty/tools/dotc/typer/Namer.scala +++ b/src/dotty/tools/dotc/typer/Namer.scala @@ -934,11 +934,10 @@ class Namer { typer: Typer => } def typeDefSig(tdef: TypeDef, sym: Symbol, tparamSyms: List[TypeSymbol])(implicit ctx: Context): Type = { - def abstracted(tp: Type, canAbstract: Boolean): Type = - if (tparamSyms.nonEmpty && canAbstract) tp.LambdaAbstract(tparamSyms) - else tp + def abstracted(tp: Type): Type = + if (tparamSyms.nonEmpty) tp.LambdaAbstract(tparamSyms) else tp - val dummyInfo = abstracted(TypeBounds.empty, canAbstract = true) + val dummyInfo = abstracted(TypeBounds.empty) sym.info = dummyInfo // Temporarily set info of defined type T to ` >: Nothing <: Any. // This is done to avoid cyclic reference errors for F-bounds. @@ -952,7 +951,8 @@ class Namer { typer: Typer => // inspects a TypeRef's info, instead of simply dealiasing alias types. val isDerived = tdef.rhs.isInstanceOf[untpd.DerivedTypeTree] - val rhsType = abstracted(typedAheadType(tdef.rhs).tpe, canAbstract = !isDerived) + val rhsBodyType = typedAheadType(tdef.rhs).tpe + val rhsType = if (isDerived) rhsBodyType else abstracted(rhsBodyType) val unsafeInfo = rhsType match { case bounds: TypeBounds => bounds case alias => TypeAlias(alias, if (sym is Local) sym.variance else 0) |