mirror of https://github.com/sbt/sbt.git
fresh scope for each inherited definition when tagging type variables
This commit is contained in:
parent
408d11557d
commit
ddcf885fb9
|
|
@ -23,10 +23,12 @@ private class TagTypeVariables
|
|||
|
||||
def tag(s: SourceAPI): TypeVars =
|
||||
{
|
||||
s.definitions.foreach(tagDefinition)
|
||||
tagDefinitions(s.definitions)
|
||||
tags
|
||||
}
|
||||
def tagDefinitions(ds: Seq[Definition]) = ds.foreach(tagDefinition)
|
||||
def tagDefinitions(ds: Seq[Definition], eachFresh: Boolean = false): Unit =
|
||||
for(d <- ds) if(eachFresh) freshScope(tagDefinition(d)) else tagDefinition(d)
|
||||
|
||||
def tagDefinition(d: Definition)
|
||||
{
|
||||
d match
|
||||
|
|
@ -123,7 +125,7 @@ private class TagTypeVariables
|
|||
{
|
||||
tagTypes(structure.parents)
|
||||
tagDefinitions(structure.declared)
|
||||
tagDefinitions(structure.inherited)
|
||||
tagDefinitions(structure.inherited, eachFresh=true)
|
||||
}
|
||||
def tagParameters(parameters: Seq[TypeParameter], base: Type): Unit =
|
||||
scope {
|
||||
|
|
@ -136,12 +138,24 @@ private class TagTypeVariables
|
|||
val saveIndex = index
|
||||
index = 0
|
||||
level += 1
|
||||
|
||||
|
||||
action
|
||||
|
||||
level -= 1
|
||||
index = saveIndex
|
||||
}
|
||||
def freshScope(action: => Unit)
|
||||
{
|
||||
val saveIndex = index
|
||||
val saveLevel = level
|
||||
index = 0
|
||||
level = 0
|
||||
|
||||
action
|
||||
|
||||
level = saveLevel
|
||||
index = saveIndex
|
||||
}
|
||||
def recordTypeParameter(id: Int)
|
||||
{
|
||||
tags(id) = (level, index)
|
||||
|
|
|
|||
Loading…
Reference in New Issue