Skip to content

Commit

Permalink
Fixing type hierarchy / inheritance index not indexing types with gen…
Browse files Browse the repository at this point in the history
…erics correctly
  • Loading branch information
m0rkeulv committed May 19, 2024
1 parent 1225c26 commit c9bd15e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
* Bugfix: import would be displayed as unused if last reference in a file was a fully qualified reference.
* Bugfix: Fixing problem with resolving setter method reference from property.
* Bugfix: Imports would not be added automatically when package statement was missing.
* Bugfix: Constraints and defaults could not be used together in type generics
* Fixed: Constraints and defaults could not be used together in type generics
* Fixed: Type-hierarchy would not include types that contained generics
* Improvement: major rework of completion suggestions
- Added completion for constructors
- Added public static members to completion suggestions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ public HaxeClass fun(PsiElement element) {
final HaxeClassInfo value = new HaxeClassInfo(classString, packageString, HaxeComponentType.typeOf(haxeClass));
for (HaxeType haxeType : haxeClass.getHaxeExtendsList()) {
if (haxeType == null) continue;
final String classNameCandidate = haxeType.getText();
final String classNameCandidate = getClassNameCandidate(haxeType);
final String key = classNameCandidate.indexOf('.') != -1 ?
classNameCandidate :
getQNameAndCache(qNameCache, psiFile, classNameCandidate);
put(result, key, value);
}
for (HaxeType haxeType : haxeClass.getHaxeImplementsList()) {
if (haxeType == null) continue;
final String classNameCandidate = haxeType.getText();
final String classNameCandidate = getClassNameCandidate(haxeType);
final String key = classNameCandidate.indexOf('.') != -1 ?
classNameCandidate :
getQNameAndCache(qNameCache, psiFile, classNameCandidate);
Expand All @@ -134,6 +134,11 @@ public HaxeClass fun(PsiElement element) {
return result;
}

private static String getClassNameCandidate(HaxeType haxeType) {
// we are not using "haxeType.getText();" here because that would include type parameters/ generics
return haxeType.getReferenceExpression().getText();
}

private static String getQNameAndCache(Map<String, String> qNameCache, PsiFile psiFile, String classNameCandidate) {
String result = qNameCache.get(classNameCandidate);
if (result == null) {
Expand Down

0 comments on commit c9bd15e

Please sign in to comment.