Skip to content

Commit 32b8d51

Browse files
committed
Rename TypeVarBinder --> InferredTypeTree
# Conflicts: # compiler/src/dotty/tools/dotc/typer/RefineTypes.scala
1 parent 0722bf4 commit 32b8d51

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

compiler/src/dotty/tools/dotc/ast/Trees.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -699,10 +699,12 @@ object Trees {
699699
s"TypeTree${if (hasType) s"[$typeOpt]" else ""}"
700700
}
701701

702-
/** A type tree that defines a new type variable. Its type is always a TypeVar.
703-
* Every TypeVar is created as the type of one TypeVarBinder.
702+
/** A type tree whose type is inferred. These trees appear in two contexts
703+
* - as an argument of a TypeApply. In that case its type is always a TypeVar
704+
* - as a (result-)type of an inferred ValDef or DefDef.
705+
* Every TypeVar is created as the type of one InferredTypeTree.
704706
*/
705-
class TypeVarBinder[-T >: Untyped](implicit @constructorOnly src: SourceFile) extends TypeTree[T]
707+
class InferredTypeTree[-T >: Untyped](implicit @constructorOnly src: SourceFile) extends TypeTree[T]
706708

707709
/** ref.type */
708710
case class SingletonTypeTree[-T >: Untyped] private[ast] (ref: Tree[T])(implicit @constructorOnly src: SourceFile)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ object Inferencing {
333333
@tailrec def boundVars(tree: Tree, acc: List[TypeVar]): List[TypeVar] = tree match {
334334
case Apply(fn, _) => boundVars(fn, acc)
335335
case TypeApply(fn, targs) =>
336-
val tvars = targs.filter(_.isInstanceOf[TypeVarBinder[?]]).tpes.collect {
336+
val tvars = targs.filter(_.isInstanceOf[InferredTypeTree[?]]).tpes.collect {
337337
case tvar: TypeVar
338338
if !tvar.isInstantiated &&
339339
ctx.typerState.ownedVars.contains(tvar) &&

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ object ProtoTypes {
636636
def newTypeVars(tl: TypeLambda): List[TypeTree] =
637637
for (paramRef <- tl.paramRefs)
638638
yield {
639-
val tt = TypeVarBinder().withSpan(owningTree.span)
639+
val tt = InferredTypeTree().withSpan(owningTree.span)
640640
val tvar = TypeVar(paramRef, state)
641641
state.ownedVars += tvar
642642
tt.withType(tvar)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3063,7 +3063,7 @@ class Typer extends Namer
30633063
else Some(adapt(tree1, pt, locked))
30643064
} { (_, _) => None
30653065
}
3066-
case TypeApply(fn, args) if args.forall(_.isInstanceOf[TypeVarBinder[_]]) =>
3066+
case TypeApply(fn, args) if args.forall(_.isInstanceOf[InferredTypeTree[_]]) =>
30673067
tryInsertImplicitOnQualifier(fn, pt, locked)
30683068
case _ => None
30693069
}

0 commit comments

Comments
 (0)