Skip to content

Commit

Permalink
better fix for scope resolution in case of name clashes
Browse files Browse the repository at this point in the history
  • Loading branch information
pshirshov committed Sep 30, 2024
1 parent c713338 commit 73adf33
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ object BaboonTyper {
]] = {
for {
depmap <- flattened
.filterNot(_.defn.defn.isInstanceOf[RawNamespace]) // cheapo fix for namespace id clashes caused by nested namespaces with identical names, namespaces have no deps anyway
.map(d => deps(pkg, d))
.biSequence
asMap <- depmap.toUniqueMap(bad => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,12 @@ object ScopeSupport {
.orElse(findScope(needles, s.defn.parentOf(s)))

case s: SubScope[ExtendedRawDefn] =>
s.nested.toMap
.get(head)
.orElse(Some(s).filter(_.name == head))
Some(s)
.filter(_.name == head)
.orElse(
s.nested.toMap
.get(head)
)
.orElse(findScope(needles, s.defn.parentOf(s)))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ object Scope {
list.toMap
}

private def index[Def](root: RootScope[Def]): Map[ScopeUID, Scope[Def]] = {
private def index(root: RootScope[Def]): Map[ScopeUID, Scope[Def]] = {
def identifySubParents(
scope: NestedScope[Def]
): List[(ScopeUID, Scope[Def])] = {
Expand Down

0 comments on commit 73adf33

Please sign in to comment.