File tree Expand file tree Collapse file tree 4 files changed +8
-6
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 4 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -699,10 +699,12 @@ object Trees {
699
699
s " TypeTree ${if (hasType) s " [ $typeOpt] " else " " }"
700
700
}
701
701
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.
704
706
*/
705
- class TypeVarBinder [- T >: Untyped ](implicit @ constructorOnly src : SourceFile ) extends TypeTree [T ]
707
+ class InferredTypeTree [- T >: Untyped ](implicit @ constructorOnly src : SourceFile ) extends TypeTree [T ]
706
708
707
709
/** ref.type */
708
710
case class SingletonTypeTree [- T >: Untyped ] private [ast] (ref : Tree [T ])(implicit @ constructorOnly src : SourceFile )
Original file line number Diff line number Diff line change @@ -333,7 +333,7 @@ object Inferencing {
333
333
@ tailrec def boundVars (tree : Tree , acc : List [TypeVar ]): List [TypeVar ] = tree match {
334
334
case Apply (fn, _) => boundVars(fn, acc)
335
335
case TypeApply (fn, targs) =>
336
- val tvars = targs.filter(_.isInstanceOf [TypeVarBinder [? ]]).tpes.collect {
336
+ val tvars = targs.filter(_.isInstanceOf [InferredTypeTree [? ]]).tpes.collect {
337
337
case tvar : TypeVar
338
338
if ! tvar.isInstantiated &&
339
339
ctx.typerState.ownedVars.contains(tvar) &&
Original file line number Diff line number Diff line change @@ -636,7 +636,7 @@ object ProtoTypes {
636
636
def newTypeVars (tl : TypeLambda ): List [TypeTree ] =
637
637
for (paramRef <- tl.paramRefs)
638
638
yield {
639
- val tt = TypeVarBinder ().withSpan(owningTree.span)
639
+ val tt = InferredTypeTree ().withSpan(owningTree.span)
640
640
val tvar = TypeVar (paramRef, state)
641
641
state.ownedVars += tvar
642
642
tt.withType(tvar)
Original file line number Diff line number Diff line change @@ -3063,7 +3063,7 @@ class Typer extends Namer
3063
3063
else Some (adapt(tree1, pt, locked))
3064
3064
} { (_, _) => None
3065
3065
}
3066
- case TypeApply (fn, args) if args.forall(_.isInstanceOf [TypeVarBinder [_]]) =>
3066
+ case TypeApply (fn, args) if args.forall(_.isInstanceOf [InferredTypeTree [_]]) =>
3067
3067
tryInsertImplicitOnQualifier(fn, pt, locked)
3068
3068
case _ => None
3069
3069
}
You can’t perform that action at this time.
0 commit comments