Skip to content

Commit

Permalink
Fix stackoverflow in super class name resolution
Browse files Browse the repository at this point in the history
Fixes #341
  • Loading branch information
valis committed May 7, 2024
1 parent 1350129 commit bfacd52
Show file tree
Hide file tree
Showing 3 changed files with 216 additions and 169 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public List<? extends ClassReferable> getSuperClassReferences() {
protected void resolve() {
if (!myResolved) {
ChildGroup parent = myGroup.getParentGroup();
resolve(CachingScope.make(parent == null ? ScopeFactory.forGroup(myGroup, EmptyModuleScopeProvider.INSTANCE) : LexicalScope.insideOf(myGroup, parent.getGroupScope(), LexicalScope.Extent.ONLY_EXTERNAL)));
resolve(CachingScope.make(parent == null ? ScopeFactory.forGroup(myGroup, EmptyModuleScopeProvider.INSTANCE) : LexicalScope.insideOf(myGroup, parent.getGroupScope(LexicalScope.Extent.ONLY_EXTERNAL), LexicalScope.Extent.ONLY_EXTERNAL)));
myResolved = true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion base/src/main/java/org/arend/term/group/ChildGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public interface ChildGroup extends Group {
@NotNull
default Scope getGroupScope(LexicalScope.Extent extent) {
ChildGroup parent = getParentGroup();
return parent == null ? ScopeFactory.forGroup(this, EmptyModuleScopeProvider.INSTANCE) : LexicalScope.insideOf(this, parent.getGroupScope(LexicalScope.Extent.EVERYTHING), extent);
return parent == null ? ScopeFactory.forGroup(this, EmptyModuleScopeProvider.INSTANCE) : LexicalScope.insideOf(this, parent.getGroupScope(extent == LexicalScope.Extent.ONLY_EXTERNAL ? extent : LexicalScope.Extent.EVERYTHING), extent);
}

default Scope getGroupScope() {
Expand Down
Loading

0 comments on commit bfacd52

Please sign in to comment.