diff --git a/src/main/java/com/intellij/plugins/haxe/ide/annotator/semantics/HaxeSemanticsUtil.java b/src/main/java/com/intellij/plugins/haxe/ide/annotator/semantics/HaxeSemanticsUtil.java index 50f0a063d..9e47b4f67 100644 --- a/src/main/java/com/intellij/plugins/haxe/ide/annotator/semantics/HaxeSemanticsUtil.java +++ b/src/main/java/com/intellij/plugins/haxe/ide/annotator/semantics/HaxeSemanticsUtil.java @@ -31,6 +31,7 @@ public static void check( ) { final ResultHolder varType = HaxeTypeResolver.getTypeFromTypeTag(tag, erroredElement); final ResultHolder initType = getTypeFromVarInit(initExpression, varType); + if (initType.isInvalid()) return; if (!varType.canAssign(initType)) { diff --git a/src/main/java/com/intellij/plugins/haxe/model/type/HaxeTypeCompatible.java b/src/main/java/com/intellij/plugins/haxe/model/type/HaxeTypeCompatible.java index 29431f69c..c8b1c8068 100644 --- a/src/main/java/com/intellij/plugins/haxe/model/type/HaxeTypeCompatible.java +++ b/src/main/java/com/intellij/plugins/haxe/model/type/HaxeTypeCompatible.java @@ -481,8 +481,15 @@ private static boolean containsAllMembers(SpecificHaxeClassReference to, Specifi if (to == null || from == null) return false; - List toMembers = to.getHaxeClassModel().getAllMembers(to.getGenericResolver()); - List fromMembers = from.getHaxeClassModel().getAllMembers(to.getGenericResolver()); + HaxeClassModel toClassModel = to.getHaxeClassModel(); + HaxeClassModel fromClassModel = from.getHaxeClassModel(); + + // unable to determine, consider if we should return true or false in this case + if (toClassModel == null || fromClassModel == null) + return false; + + List toMembers = toClassModel.getAllMembers(to.getGenericResolver()); + List fromMembers = fromClassModel.getAllMembers(to.getGenericResolver()); for (HaxeMemberModel member : toMembers) { String name = member.getName(); // TODO type check parameter and return type diff --git a/src/main/java/com/intellij/plugins/haxe/model/type/ResultHolder.java b/src/main/java/com/intellij/plugins/haxe/model/type/ResultHolder.java index 60def2015..8f9b3432d 100644 --- a/src/main/java/com/intellij/plugins/haxe/model/type/ResultHolder.java +++ b/src/main/java/com/intellij/plugins/haxe/model/type/ResultHolder.java @@ -179,4 +179,8 @@ public ResultHolder withOrigin(PsiElement origin) { public PsiElement getOrigin() { return origin; } + + public boolean isInvalid() { + return type.isInvalid(); + } }