diff --git a/src/main/java/com/intellij/plugins/haxe/lang/psi/HaxeGenericSpecialization.java b/src/main/java/com/intellij/plugins/haxe/lang/psi/HaxeGenericSpecialization.java index 1fa0cfb8c..5166347f2 100644 --- a/src/main/java/com/intellij/plugins/haxe/lang/psi/HaxeGenericSpecialization.java +++ b/src/main/java/com/intellij/plugins/haxe/lang/psi/HaxeGenericSpecialization.java @@ -142,11 +142,9 @@ public static HaxeGenericSpecialization fromGenericResolver(@Nullable PsiElement HaxeResolveResult resolved = HaxeResolveResult.create(clazz, fromGenericResolver(context, classType.getGenericResolver())); specialization.put(element, name, resolved); } else if (holder.getFunctionType() != null) { - SpecificFunctionReference type = holder.getFunctionType(); - if (type.getElementContext() instanceof HaxeFunctionType functionType){ - HaxeResolveResult resolved = HaxeResolveResult.create(functionType, fromGenericResolver(context, resolver)); - //HaxeSpecificFunction function = new HaxeSpecificFunction(functionType, specialization); - //HaxeClassResolveResult resolved = HaxeClassResolveResult.create(function, fromGenericResolver(context, resolver)); + if (context instanceof HaxeFunctionType functionType){ + // functions currently do not have specialization + HaxeResolveResult resolved = HaxeResolveResult.create(functionType, new HaxeGenericSpecialization()); specialization.put(element, name, resolved); } } diff --git a/src/main/java/com/intellij/plugins/haxe/model/HaxeParameterModel.java b/src/main/java/com/intellij/plugins/haxe/model/HaxeParameterModel.java index a584beec9..43750e312 100644 --- a/src/main/java/com/intellij/plugins/haxe/model/HaxeParameterModel.java +++ b/src/main/java/com/intellij/plugins/haxe/model/HaxeParameterModel.java @@ -174,7 +174,12 @@ public HaxeClassModel getDeclaringClass() { public ResultHolder getResultType() { final HaxeTypeTag typeTag = getTypeTagPsi(); final HaxeTypeOrAnonymous type = typeTag != null ? typeTag.getTypeOrAnonymous() : null; - return type != null ? HaxeTypeResolver.getTypeFromTypeOrAnonymous(type) : null; + ResultHolder holder = type != null ? HaxeTypeResolver.getTypeFromTypeOrAnonymous(type) : null; + if (holder != null) return holder; + + HaxeVarInit initPsi = getVarInitPsi(); + if (initPsi == null) return SpecificHaxeClassReference.getUnknown(getParameterPsi()).createHolder(); + return HaxeExpressionEvaluator.evaluate(initPsi, new HaxeExpressionEvaluatorContext(initPsi), null).result; } @Override diff --git a/src/main/java/com/intellij/plugins/haxe/model/type/SpecificFunctionReference.java b/src/main/java/com/intellij/plugins/haxe/model/type/SpecificFunctionReference.java index d01f8ff81..15af5709c 100644 --- a/src/main/java/com/intellij/plugins/haxe/model/type/SpecificFunctionReference.java +++ b/src/main/java/com/intellij/plugins/haxe/model/type/SpecificFunctionReference.java @@ -222,7 +222,7 @@ public static class Argument { final private String name; final private ResultHolder type; - public Argument(int index, boolean optional, ResultHolder type, @Nullable String name) { + public Argument(int index, boolean optional, @NotNull ResultHolder type, @Nullable String name) { this.index = index; this.optional = optional; this.name = name;