aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/TypeAssigner.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-03-25 10:47:06 +0100
committerMartin Odersky <odersky@gmail.com>2016-03-30 09:51:04 +0200
commitde870e26da30e6d2b8f5dcab08a4f3db3334c41c (patch)
tree9f84b0f9c4187d0c40ba96603d9240fe9d3d6106 /src/dotty/tools/dotc/typer/TypeAssigner.scala
parent6d2a3d341128eddb99c0f52bca154f9e8b87eb55 (diff)
downloaddotty-de870e26da30e6d2b8f5dcab08a4f3db3334c41c.tar.gz
dotty-de870e26da30e6d2b8f5dcab08a4f3db3334c41c.tar.bz2
dotty-de870e26da30e6d2b8f5dcab08a4f3db3334c41c.zip
Adapt type assignment for AppliedTypeTrees to new named params
Diffstat (limited to 'src/dotty/tools/dotc/typer/TypeAssigner.scala')
-rw-r--r--src/dotty/tools/dotc/typer/TypeAssigner.scala10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/typer/TypeAssigner.scala b/src/dotty/tools/dotc/typer/TypeAssigner.scala
index 821de607e..995fa43ca 100644
--- a/src/dotty/tools/dotc/typer/TypeAssigner.scala
+++ b/src/dotty/tools/dotc/typer/TypeAssigner.scala
@@ -96,7 +96,8 @@ trait TypeAssigner {
}
case tp @ AppliedType(tycon, args) if toAvoid(tycon) =>
val base = apply(tycon)
- apply(base.appliedTo(tp.baseArgInfos(base.typeSymbol)))
+ val args = tp.baseArgInfos(base.typeSymbol)
+ if (base.typeParams.length == args.length) base.appliedTo(args) else base
case tp @ RefinedType(parent, name) if variance > 0 =>
val parent1 = apply(tp.parent)
val refinedInfo1 = apply(tp.refinedInfo)
@@ -404,16 +405,13 @@ trait TypeAssigner {
def assignType(tree: untpd.AppliedTypeTree, tycon: Tree, args: List[Tree])(implicit ctx: Context) = {
val tparams = tycon.tpe.typeParams
+ lazy val ntparams = tycon.tpe.namedTypeParams
def refineNamed(tycon: Type, arg: Tree) = arg match {
case ast.Trees.NamedArg(name, argtpt) =>
// Dotty deviation: importing ast.Trees._ and matching on NamedArg gives a cyclic ref error
val tparam = tparams.find(_.name == name) match {
case Some(tparam) => tparam
- case none =>
- val sym = tycon.member(name).symbol
- if (sym.isAbstractType) sym
- else if (sym.is(ParamAccessor)) sym.info.dealias.typeSymbol
- else NoSymbol
+ case none => ntparams.find(_.name == name).getOrElse(NoSymbol)
}
if (tparam.exists) RefinedType(tycon, name, argtpt.tpe.toBounds(tparam))
else errorType(i"$tycon does not have a parameter or abstract type member named $name", arg.pos)