aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Applications.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Applications.scala11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala
index a9184c7e5..aba073f3d 100644
--- a/src/dotty/tools/dotc/typer/Applications.scala
+++ b/src/dotty/tools/dotc/typer/Applications.scala
@@ -17,6 +17,7 @@ import Types._
import Decorators._
import ErrorReporting._
import Trees._
+import config.Config
import Names._
import StdNames._
import ProtoTypes._
@@ -66,7 +67,7 @@ object Applications {
if (extractorMemberType(unapplyResult, nme.isDefined, pos) isRef defn.BooleanClass) {
if (getTp.exists)
if (unapplyFn.symbol.name == nme.unapplySeq) {
- val seqArg = boundsToHi(getTp.firstBaseArgInfo(defn.SeqClass))
+ val seqArg = boundsToHi(getTp.elemType)
if (seqArg.exists) return args map Function.const(seqArg)
}
else return getUnapplySelectors(getTp, args, pos)
@@ -628,12 +629,11 @@ trait Applications extends Compatibility { self: Typer =>
def typedTypeApply(tree: untpd.TypeApply, pt: Type)(implicit ctx: Context): Tree = track("typedTypeApply") {
val isNamed = hasNamedArg(tree.args)
- var typedArgs = if (isNamed) typedNamedArgs(tree.args) else tree.args.mapconserve(typedType(_))
+ val typedArgs = if (isNamed) typedNamedArgs(tree.args) else tree.args.mapconserve(typedType(_))
val typedFn = typedExpr(tree.fun, PolyProto(typedArgs.tpes, pt))
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)
@@ -643,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 =
- 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.
@@ -741,7 +738,7 @@ trait Applications extends Compatibility { self: Typer =>
def isSubTypeOfParent(subtp: Type, tp: Type)(implicit ctx: Context): Boolean =
if (subtp <:< tp) true
else tp match {
- case RefinedType(parent, _) => isSubTypeOfParent(subtp, parent)
+ case tp: RefinedType => isSubTypeOfParent(subtp, tp.parent)
case _ => false
}