diff --git a/src/main/java/com/intellij/plugins/haxe/model/HaxeEnumExtractorModel.java b/src/main/java/com/intellij/plugins/haxe/model/HaxeEnumExtractorModel.java index 2baabdbd0..7d8d682ce 100644 --- a/src/main/java/com/intellij/plugins/haxe/model/HaxeEnumExtractorModel.java +++ b/src/main/java/com/intellij/plugins/haxe/model/HaxeEnumExtractorModel.java @@ -158,7 +158,7 @@ public ResultHolder resolveExtractedValueType(@NotNull HaxeEnumExtractedValueRef if (parentExtractors.size() > 1) { ResultHolder switchExpressionType = evaluate(switchStatementExpression, parentResolver).result; - + HaxeGenericResolver pathResolver = switchExpressionType.getClassType().getGenericResolver(); SpecificHaxeClassReference classType = switchExpressionType.getClassType(); if (classType != null) { // LinkedHashMap because order matters @@ -181,10 +181,13 @@ public ResultHolder resolveExtractedValueType(@NotNull HaxeEnumExtractedValueRef } } } - if(classType != null) return classType.createHolder(); - + if(classType != null) { + pathResolver = classType.getGenericResolver(); + } } - + ResultHolder resolve = pathResolver.resolve(parameterType); + if(resolve != null && !resolve.isUnknown()) return resolve; + return parameterType; } ResultHolder result = evaluate(lookupElement, parentResolver).result; diff --git a/src/main/java/com/intellij/plugins/haxe/model/type/HaxeClassReference.java b/src/main/java/com/intellij/plugins/haxe/model/type/HaxeClassReference.java index 608dfc778..6781e5368 100644 --- a/src/main/java/com/intellij/plugins/haxe/model/type/HaxeClassReference.java +++ b/src/main/java/com/intellij/plugins/haxe/model/type/HaxeClassReference.java @@ -70,7 +70,11 @@ public HaxeClassReference(String name, @NotNull PsiElement elementContext, boole } private String getClassName(HaxeClassModel clazz) { - return CachedValuesManager.getProjectPsiDependentCache(clazz.getPsi(), HaxeClassReference::getNameCached).getValue(); + if(clazz.getPsi().getParent() != null) { + return CachedValuesManager.getProjectPsiDependentCache(clazz.getPsi(), HaxeClassReference::getNameCached).getValue(); + }else { + return getClassNameInternal(clazz.getPsi().getModel()); + } } private static CachedValueProvider.Result getNameCached(HaxeClass aClass) {