Skip to content

Commit b6642e6

Browse files
committed
Address reviewers comments
1 parent 1e753c3 commit b6642e6

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,10 +1014,10 @@ object Types {
10141014
case _ => this
10151015
}
10161016

1017-
/** If this is a dependent function type, drop the `apply` refinement */
1018-
final def dropDependentRefinement(implicit ctx: Context): Type = stripTypeVar match {
1017+
/** Dealias, and if result is a dependent function type, drop the `apply` refinement. */
1018+
final def dropDependentRefinement(implicit ctx: Context): Type = dealias match {
10191019
case RefinedType(parent, nme.apply, _) => parent
1020-
case _ => this
1020+
case tp => tp
10211021
}
10221022

10231023
/** The type constructor of an applied type, otherwise the type itself */

compiler/src/dotty/tools/dotc/typer/Inferencing.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ object Inferencing {
5454
*/
5555
def instantiateDependent(tp: Type, tparams: List[Symbol], vparamss: List[List[Symbol]])(implicit ctx: Context): Unit = {
5656
val dependentVars = new TypeAccumulator[Set[TypeVar]] {
57-
lazy val params = (vparamss :\ tparams)( _ ::: _)
57+
lazy val params = (tparams :: vparamss).flatten
5858
def apply(tvars: Set[TypeVar], tp: Type) = tp match {
5959
case tp: TypeVar
6060
if !tp.isInstantiated &&

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
715715
}
716716
val funCls = defn.FunctionClass(args.length, isImplicit)
717717

718-
def typedDependent(params: List[ValDef])(implicit ctx: Context) = {
718+
/** Typechecks dependent function type with given parameters `params` */
719+
def typedDependent(params: List[ValDef])(implicit ctx: Context): Tree = {
719720
completeParams(params)
720721
val params1 = params.map(typedExpr(_).asInstanceOf[ValDef])
721722
val resultTpt = typed(body)
@@ -744,8 +745,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
744745
}
745746

746747
def typedFunctionValue(tree: untpd.Function, pt: Type)(implicit ctx: Context) = {
747-
val untpd.Function(args, body) = tree
748-
val params = args.asInstanceOf[List[untpd.ValDef]]
748+
val untpd.Function(params: List[untpd.ValDef], body) = tree
749749

750750
pt match {
751751
case pt: TypeVar if untpd.isFunctionWithUnknownParamType(tree) =>
@@ -837,7 +837,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
837837
}
838838
case _ =>
839839
}
840-
errorType(AnonymousFunctionMissingParamType(param, args, tree, pt), param.pos)
840+
errorType(AnonymousFunctionMissingParamType(param, params, tree, pt), param.pos)
841841
}
842842

843843
def protoFormal(i: Int): Type =
@@ -1721,7 +1721,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
17211721
}
17221722

17231723
protected def makeImplicitFunction(tree: untpd.Tree, pt: Type)(implicit ctx: Context): Tree = {
1724-
val defn.FunctionOf(formals, _, true) = pt.dealias.dropDependentRefinement
1724+
val defn.FunctionOf(formals, _, true) = pt.dropDependentRefinement
17251725
val paramTypes = formals.map(fullyDefinedType(_, "implicit function parameter", tree.pos))
17261726
val ifun = desugar.makeImplicitFunction(paramTypes, tree)
17271727
typr.println(i"make implicit function $tree / $pt ---> $ifun")

0 commit comments

Comments
 (0)