diff --git a/src/main/java/com/intellij/plugins/haxe/model/type/HaxeGenericResolver.java b/src/main/java/com/intellij/plugins/haxe/model/type/HaxeGenericResolver.java index 2d4674e6c..fc28b5759 100644 --- a/src/main/java/com/intellij/plugins/haxe/model/type/HaxeGenericResolver.java +++ b/src/main/java/com/intellij/plugins/haxe/model/type/HaxeGenericResolver.java @@ -427,4 +427,13 @@ else if (entry.type().equals(specific)) { } return null; } + + public void addAssignHint(HaxeGenericResolver resolver) { + Optional assign = resolver.findAssignToType(); + if(assign.isPresent()) { + // remove old if present + resolvers.removeIf(entry -> entry.resolveSource() == ResolveSource.ASSIGN_TYPE); + resolvers.add(assign.get().copy()); + } + } } diff --git a/src/main/java/com/intellij/plugins/haxe/model/type/HaxeTypeResolver.java b/src/main/java/com/intellij/plugins/haxe/model/type/HaxeTypeResolver.java index 7deccdcdf..e71fd096c 100644 --- a/src/main/java/com/intellij/plugins/haxe/model/type/HaxeTypeResolver.java +++ b/src/main/java/com/intellij/plugins/haxe/model/type/HaxeTypeResolver.java @@ -274,8 +274,9 @@ static private ResultHolder getFunctionReturnType(HaxeNamedComponent comp, HaxeG if (typeOrAnonymous != null) { HaxeClass aClass = (HaxeClass) method.getContainingClass(); HaxeGenericResolver localResolver = HaxeGenericSpecialization.fromGenericResolver(null, resolver).toGenericResolver(aClass); + localResolver.addAssignHint(resolver); ResultHolder anonymous = HaxeTypeResolver.getTypeFromTypeOrAnonymous(typeOrAnonymous, localResolver, true); - ResultHolder resolve = resolver.resolve(anonymous); + ResultHolder resolve = resolver.resolveReturnType(anonymous); if (resolve != null && !resolve.isUnknown()) { return resolve; }