aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-06-29 19:59:16 +0200
committerMartin Odersky <odersky@gmail.com>2016-07-11 13:35:02 +0200
commitd1f809f14cad2c14c312767d71361c7f2e7d8244 (patch)
treea929f8d6c9700acfc5ae031fdda6bb0852c9726e /src/dotty/tools/dotc/typer
parente749d832e9adebc502c961d743b3b29072f8116a (diff)
downloaddotty-d1f809f14cad2c14c312767d71361c7f2e7d8244.tar.gz
dotty-d1f809f14cad2c14c312767d71361c7f2e7d8244.tar.bz2
dotty-d1f809f14cad2c14c312767d71361c7f2e7d8244.zip
Remove old hk scheme
- Simplify RefinedType - Drop recursive definition of RefinedThis - this is now taken over by RecType. - Drop RefinedThis. - Simplify typeParams The logic avoiding forcing is no longer needed. - Remove unused code and out of date comments.
Diffstat (limited to 'src/dotty/tools/dotc/typer')
-rw-r--r--src/dotty/tools/dotc/typer/Applications.scala4
-rw-r--r--src/dotty/tools/dotc/typer/Implicits.scala5
-rw-r--r--src/dotty/tools/dotc/typer/Namer.scala25
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala3
4 files changed, 3 insertions, 34 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala
index cdbf692cd..caae422d3 100644
--- a/src/dotty/tools/dotc/typer/Applications.scala
+++ b/src/dotty/tools/dotc/typer/Applications.scala
@@ -634,7 +634,6 @@ trait Applications extends Compatibility { self: Typer =>
typedFn.tpe.widen match {
case pt: PolyType =>
if (typedArgs.length <= pt.paramBounds.length && !isNamed)
- typedArgs = typedArgs.zipWithConserve(pt.paramBounds)(adaptTypeArg)
if (typedFn.symbol == defn.Predef_classOf && typedArgs.nonEmpty) {
val arg = typedArgs.head
checkClassType(arg.tpe, arg.pos, traitReq = false, stablePrefixReq = false)
@@ -644,9 +643,6 @@ trait Applications extends Compatibility { self: Typer =>
assignType(cpy.TypeApply(tree)(typedFn, typedArgs), typedFn, typedArgs)
}
- def adaptTypeArg(tree: tpd.Tree, bound: Type)(implicit ctx: Context): tpd.Tree =
- if (Config.newHK) tree else tree.withType(tree.tpe.etaExpandIfHK(bound))
-
/** Rewrite `new Array[T](....)` if T is an unbounded generic to calls to newGenericArray.
* It is performed during typer as creation of generic arrays needs a classTag.
* we rely on implicit search to find one.
diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala
index 1b02f7e70..a5246cf6b 100644
--- a/src/dotty/tools/dotc/typer/Implicits.scala
+++ b/src/dotty/tools/dotc/typer/Implicits.scala
@@ -284,13 +284,10 @@ trait ImplicitRunInfo { self: RunInfo =>
override implicit protected val ctx: Context = liftingCtx
override def stopAtStatic = true
def apply(tp: Type) = tp match {
- case tp: TypeRef if tp.symbol.isLambdaTraitOBS =>
- defn.AnyType
case tp: TypeRef if tp.symbol.isAbstractOrAliasType =>
val pre = tp.prefix
def joinClass(tp: Type, cls: ClassSymbol) =
- if (cls.isLambdaTraitOBS) tp
- else AndType.make(tp, cls.typeRef.asSeenFrom(pre, cls.owner))
+ AndType.make(tp, cls.typeRef.asSeenFrom(pre, cls.owner))
val lead = if (tp.prefix eq NoPrefix) defn.AnyType else apply(tp.prefix)
(lead /: tp.classSymbols)(joinClass)
case tp: TypeVar =>
diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala
index bc8f8e281..bf36942e0 100644
--- a/src/dotty/tools/dotc/typer/Namer.scala
+++ b/src/dotty/tools/dotc/typer/Namer.scala
@@ -973,29 +973,6 @@ class Namer { typer: Typer =>
}
ensureUpToDate(sym.typeRef, dummyInfo)
ensureUpToDate(sym.typeRef.appliedTo(tparamSyms.map(_.typeRef)), TypeBounds.empty)
-
- if (Config.newHK) sym.info
- else etaExpandArgsOBS.apply(sym.info)
- }
-
- /** Eta expand all class types C appearing as arguments to a higher-kinded
- * type parameter to type lambdas, e.g. [HK0] => C[HK0]. This is necessary
- * because in `typedAppliedTypeTree` we might have missed some eta expansions
- * of arguments in F-bounds, because the recursive type was initialized with
- * TypeBounds.empty.
- */
- def etaExpandArgsOBS(implicit ctx: Context) = new TypeMap {
- def apply(tp: Type): Type = tp match {
- case tp: RefinedType =>
- val args = tp.argInfos.mapconserve(this)
- if (args.nonEmpty) {
- val tycon = tp.withoutArgs(args)
- val tycon1 = this(tycon)
- val tparams = tycon.typeParams
- val args1 = if (args.length == tparams.length) etaExpandIfHK(tparams, args) else args
- if ((tycon1 eq tycon) && (args1 eq args)) tp else tycon1.appliedTo(args1)
- } else mapOver(tp)
- case _ => mapOver(tp)
- }
+ sym.info
}
}
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 96bc2ab35..2ab06bf70 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -949,8 +949,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
(if (isVarPattern(arg)) desugar.patternVar(arg) else arg, tparam.memberBounds)
else
(arg, WildcardType)
- val arg1 = typed(desugaredArg, argPt)
- adaptTypeArg(arg1, tparam.memberBounds)
+ typed(desugaredArg, argPt)
}
args.zipWithConserve(tparams)(typedArg(_, _)).asInstanceOf[List[Tree]]
}