Skip to content

Commit

Permalink
Merge pull request scala#6965 from diesalbla/tvars
Browse files Browse the repository at this point in the history
Small change: remove call to List.reverse.
  • Loading branch information
dwijnand authored Aug 21, 2018
2 parents 53c4be1 + a6e7fe5 commit 9cbe8b1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/reflect/scala/reflect/internal/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ trait Types
def findMembers(excludedFlags: Long, requiredFlags: Long): Scope = {
def findMembersInternal = new FindMembers(this, excludedFlags, requiredFlags).apply()
if (this.isGround) findMembersInternal
else suspendingTypeVars(typeVarsInType(this))(findMembersInternal)
else suspendingTypeVars(typeVarsInTypeRev(this))(findMembersInternal)
}

/**
Expand All @@ -1026,7 +1026,7 @@ trait Types
def findMemberInternal = new FindMember(this, name, excludedFlags, requiredFlags, stableOnly).apply()

if (this.isGround) findMemberInternal
else suspendingTypeVars(typeVarsInType(this))(findMemberInternal)
else suspendingTypeVars(typeVarsInTypeRev(this))(findMemberInternal)
}

/** The (existential or otherwise) skolems and existentially quantified variables which are free in this type */
Expand Down Expand Up @@ -4768,13 +4768,16 @@ trait Types
}

/** A list of the typevars in a type. */
def typeVarsInType(tp: Type): List[TypeVar] = {
def typeVarsInType(tp: Type): List[TypeVar] =
typeVarsInTypeRev(tp).reverse

private[this] def typeVarsInTypeRev(tp: Type): List[TypeVar] = {
var tvs: List[TypeVar] = Nil
tp foreach {
case t: TypeVar => tvs ::= t
case _ =>
}
tvs.reverse
tvs
}

// If this type contains type variables, put them to sleep for a while.
Expand Down

0 comments on commit 9cbe8b1

Please sign in to comment.