diff options
Diffstat (limited to 'src/dotty/tools/dotc/typer/Namer.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Namer.scala | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala index 78f0da1f0..148cf1da7 100644 --- a/src/dotty/tools/dotc/typer/Namer.scala +++ b/src/dotty/tools/dotc/typer/Namer.scala @@ -114,7 +114,7 @@ trait NamerContextOps { this: Context => if (param.info.isDirectRef(defn.ObjectClass)) param.info = defn.AnyType make.fromSymbols(params, resultType) } - if (typeParams.nonEmpty) PolyType.fromSymbols(typeParams, monotpe) + if (typeParams.nonEmpty) monotpe.LambdaAbstract(typeParams) else if (valueParamss.isEmpty) ExprType(monotpe) else monotpe } @@ -294,7 +294,7 @@ class Namer { typer: Typer => val inSuperCall1 = if (tree.mods is ParamOrAccessor) EmptyFlags else inSuperCall // suppress inSuperCall for constructor parameters val higherKinded = tree match { - case tree: TypeDef if tree.tparams.nonEmpty && isDeferred => HigherKinded + case TypeDef(_, PolyTypeTree(_, _)) if isDeferred => HigherKinded case _ => EmptyFlags } @@ -616,8 +616,12 @@ class Namer { typer: Typer => nestedCtx = localContext(sym).setNewScope myTypeParams = { implicit val ctx: Context = nestedCtx - completeParams(original.tparams) - original.tparams.map(symbolOfTree(_).asType) + val tparams = original.rhs match { + case PolyTypeTree(tparams, _) => tparams + case _ => Nil + } + completeParams(tparams) + tparams.map(symbolOfTree(_).asType) } } myTypeParams @@ -1025,7 +1029,11 @@ class Namer { typer: Typer => // inspects a TypeRef's info, instead of simply dealiasing alias types. val isDerived = tdef.rhs.isInstanceOf[untpd.DerivedTypeTree] - val rhsBodyType = typedAheadType(tdef.rhs).tpe + val rhs = tdef.rhs match { + case PolyTypeTree(_, body) => body + case rhs => rhs + } + val rhsBodyType = typedAheadType(rhs).tpe val rhsType = if (isDerived) rhsBodyType else abstracted(rhsBodyType) val unsafeInfo = rhsType match { case bounds: TypeBounds => bounds |