Skip to content

Commit

Permalink
fixing issue where resolver failed to find symbol from result of gene…
Browse files Browse the repository at this point in the history
…ric method
  • Loading branch information
m0rkeulv committed Feb 2, 2024
1 parent dececd5 commit 14a8e3f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,12 @@ else if (implementOrExtendSameClass) {
resolver.addAll(modelResolver);
}
}
ResultHolder holder = HaxeExpressionEvaluator.evaluate(this, resolver).result;
//TODO should not be necessary with both (resolve from parent scope and "manual" from models)
// gets chain generics
HaxeGenericResolver genericResolver = HaxeGenericResolverUtil.generateResolverFromScopeParents(this);
// adds generics from class and method where this reference is in.
genericResolver.addAll(resolver);
ResultHolder holder = HaxeExpressionEvaluator.evaluate(this, genericResolver).result;
if (!holder.isUnknown()){
return holder.getType().asResolveResult();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ private static HaxeResolveResult getHaxeClassResolveResultInternal(@Nullable Psi
}
}else if (psiField.getVarInit() != null) {
HaxeVarInit init = psiField.getVarInit();
HaxeExpressionEvaluatorContext evaluate = evaluate(init, null);
HaxeExpressionEvaluatorContext evaluate = evaluate(init.getExpression(), null);
ResultHolder holder = evaluate.result;
if (!holder.isUnknown()) {
//TODO function literals does not have a HaxeType and will result in null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ class Generics {
var notTypeTag2 = getValue(BaseInterface);
var test2Return = notTypeTag2.testA(1); // correct

// verify that "chained" expressions work
getValue(BaseInterface).testA(1); // correct
getValue(Baseclass).testB("1"); // correct
getValue(BaseInterface).<warning descr="Unresolved symbol">testB</warning>("1"); // Wrong BaseInterface does not ccontain

var test2Return = notTypeTag2.testA(<error descr="Type mismatch (Expected: 'Int' got: 'String')">""</error>); // wrong: incorrect argument
var test2Return = notTypeTag2.<warning descr="Unresolved symbol">testB</warning>(""); // wrong: should not find testB
var test2Return = notTypeTag2.<warning descr="Unresolved symbol">testC</warning>(""); // wrong: does not exsist
Expand Down

0 comments on commit 14a8e3f

Please sign in to comment.