From fd5a094983ee3b06116cd72a9e58614785f9028a Mon Sep 17 00:00:00 2001 From: m0rkeulv Date: Fri, 27 Oct 2023 17:26:55 +0200 Subject: [PATCH] avoid check usage when type is known for Literal Array + stackoverflow prevention --- .../plugins/haxe/lang/psi/HaxeGenericSpecialization.java | 2 +- .../plugins/haxe/model/type/HaxeExpressionEvaluator.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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 a7a1b84f5..1fa0cfb8c 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 @@ -139,7 +139,7 @@ public static HaxeGenericSpecialization fromGenericResolver(@Nullable PsiElement specialization.put(element, name, resolved); } else if (classType != null && !holder.isUnknown()) { HaxeClass clazz = classType.getHaxeClass(); - HaxeResolveResult resolved = HaxeResolveResult.create(clazz, fromGenericResolver(null, classType.getGenericResolver())); + HaxeResolveResult resolved = HaxeResolveResult.create(clazz, fromGenericResolver(context, classType.getGenericResolver())); specialization.put(element, name, resolved); } else if (holder.getFunctionType() != null) { SpecificFunctionReference type = holder.getFunctionType(); diff --git a/src/main/java/com/intellij/plugins/haxe/model/type/HaxeExpressionEvaluator.java b/src/main/java/com/intellij/plugins/haxe/model/type/HaxeExpressionEvaluator.java index 7e266bdc9..afe9735c1 100644 --- a/src/main/java/com/intellij/plugins/haxe/model/type/HaxeExpressionEvaluator.java +++ b/src/main/java/com/intellij/plugins/haxe/model/type/HaxeExpressionEvaluator.java @@ -1028,9 +1028,9 @@ else if (subelement instanceof AbstractHaxeNamedComponent namedComponent) { } } } - // empty expression with type tag (var x:Array = []), no need to look for usage + // empty expression with type tag (var x:Array = []), no need to look for usage, use typetag if (references.isEmpty() && suggestedType != null && !suggestedType.isUnknown()) { - return SpecificHaxeClassReference.createArray(suggestedType.createHolder(), element).createHolder(); + return typeTagType; } else { ResultHolder elementTypeHolder = references.isEmpty() ? SpecificTypeReference.getUnknown(element).createHolder()