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 =
|
def tag(s: SourceAPI): TypeVars =
|
||||||
{
|
{
|
||||||
s.definitions.foreach(tagDefinition)
|
tagDefinitions(s.definitions)
|
||||||
tags
|
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)
|
def tagDefinition(d: Definition)
|
||||||
{
|
{
|
||||||
d match
|
d match
|
||||||
|
|
@ -123,7 +125,7 @@ private class TagTypeVariables
|
||||||
{
|
{
|
||||||
tagTypes(structure.parents)
|
tagTypes(structure.parents)
|
||||||
tagDefinitions(structure.declared)
|
tagDefinitions(structure.declared)
|
||||||
tagDefinitions(structure.inherited)
|
tagDefinitions(structure.inherited, eachFresh=true)
|
||||||
}
|
}
|
||||||
def tagParameters(parameters: Seq[TypeParameter], base: Type): Unit =
|
def tagParameters(parameters: Seq[TypeParameter], base: Type): Unit =
|
||||||
scope {
|
scope {
|
||||||
|
|
@ -142,6 +144,18 @@ private class TagTypeVariables
|
||||||
level -= 1
|
level -= 1
|
||||||
index = saveIndex
|
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)
|
def recordTypeParameter(id: Int)
|
||||||
{
|
{
|
||||||
tags(id) = (level, index)
|
tags(id) = (level, index)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue