Skip to content

Fix name collision between generic and non-generic forward declarations #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2023

Conversation

fourls
Copy link
Collaborator

@fourls fourls commented Apr 17, 2023

SonarDelphi currently crashes when parsing multiple forward declarations with the same name. This usually occurs when a non-generic type and a generic type share a name and are both forward declared, such as the below:

type
  TFoo = class;
  TFoo<T> = class;

  TFoo = class(TObject)
  // ...
  end;

  TFoo<T> = class(TObject)
  // ...
  end;

This PR modifies the code that identifies forward declarations to take into account the number of generic parameters of a declaration. This resolves the crash and correctly matches a full declaration to its forward declaration.

@cirras cirras merged commit 3cb8e84 into master Apr 17, 2023
@cirras cirras deleted the generic-forward-declarations branch April 17, 2023 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants