Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- False positives on enumerator method `MoveNext` in `UnusedRoutine`.
- False positives on enumerator property `Current` in `UnusedProperty`.
- Name resolution failures in legacy initialization sections referencing the implementation section.
- Name resolution failures whena accessing ancestors of enclosing types from nested type methods.
- Incorrect file position calculation for multiline string tokens.

## [1.15.0] - 2025-04-03
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,14 @@ private Set<NameDeclaration> searchTypeScope(TypeScope scope) {
private Set<NameDeclaration> searchEnclosingTypes(@Nullable DelphiScope scope) {
Set<NameDeclaration> result = Collections.emptySet();
if (scope != null) {
TypeScope nextTypeScope = scope.getEnclosingScope(TypeScope.class);
if (nextTypeScope != null) {
TypeScope enclosingTypeScope = scope.getEnclosingScope(TypeScope.class);
if (enclosingTypeScope != null) {
if (TRACE) {
LOG.info(" checking enclosing type scope {}", nextTypeScope);
LOG.info(" checking enclosing type scope {}", enclosingTypeScope);
}
result = filterTypeScopeResults(nextTypeScope.findDeclaration(occurrence));
result = searchTypeScope(enclosingTypeScope);
if (result.isEmpty()) {
return searchEnclosingTypes(nextTypeScope.getParent());
return searchEnclosingTypes(enclosingTypeScope.getParent());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ void testNestedTypes() {
execute("NestedTypes.pas");
verifyUsages(7, 8, reference(20, 10), reference(21, 5));
verifyUsages(8, 26, reference(23, 4), reference(24, 4));
verifyUsages(29, 20, reference(46, 2));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,26 @@ procedure TFoo.TBaz.Test;
B.DoStuff;
end;

type
TFlimFlam = class
class procedure Flarp;
end;

TFoo = class(TFlimFlam)
type
TBar = class
procedure Baz;
end;
end;

class procedure TFlimFlam.Flarp;
begin
// do nothing
end;

procedure TFoo.TBar.Baz;
begin
Flarp;
end;

end.