Wrong resolution order. Import alias should be resolved before package name.
```haxe
package sample;
class Foo {}
```
```haxe
import something.Bar.instance as sample;

public static function main() {
   sample.doThings();
}
```

`sample` should be resolved as `something.Bar.instance`  not as package `sample`.
diff --git a/src/common/com/intellij/plugins/haxe/lang/psi/HaxeResolver.java b/src/common/com/intellij/plugins/haxe/lang/psi/HaxeResolver.java
index 6b6d5388..604d2395 100644
--- a/src/common/com/intellij/plugins/haxe/lang/psi/HaxeResolver.java
+++ b/src/common/com/intellij/plugins/haxe/lang/psi/HaxeResolver.java
@@ -75,6 +75,21 @@ public class HaxeResolver implements ResolveCache.AbstractResolver<HaxeReference
         return superElements;
       }
 
+      HaxeFileModel fileModel = HaxeFileModel.fromElement(reference);
+      if (fileModel != null) {
+        String className = reference.getText();
+
+        PsiElement target = HaxeResolveUtil.searchInSameFile(fileModel, className);
+        if (target == null) target = HaxeResolveUtil.searchInImports(fileModel, className);
+        if (target == null) target = HaxeResolveUtil.searchInSamePackage(fileModel, className);
+
+        if (target != null) {
+          return asList(target);
+        }
+      }
+
+      LogResolution(reference, "failed after exhausting all options.");
+
       if (PsiNameHelper.getInstance(reference.getProject()).isQualifiedName(reference.getText())) {
         List<HaxeModel> resolvedPackage =
           HaxeProjectModel.fromElement(reference).resolve(new FullyQualifiedInfo(reference.getText()), reference.getResolveScope());
@@ -83,19 +98,6 @@ public class HaxeResolver implements ResolveCache.AbstractResolver<HaxeReference
           return Collections.singletonList(resolvedPackage.get(0).getBasePsi());
         }
       }
-
-      HaxeFileModel fileModel = HaxeFileModel.fromElement(reference);
-      String className = reference.getText();
-
-      PsiElement target = HaxeResolveUtil.searchInSameFile(fileModel, className);
-      if (target == null) target = HaxeResolveUtil.searchInImports(fileModel, className);
-      if (target == null) target = HaxeResolveUtil.searchInSamePackage(fileModel, className);
-
-      if (target != null) {
-        return asList(target);
-      }
-
-      LogResolution(reference, "failed after exhausting all options.");
     }
 
     return result == null ? ContainerUtil.emptyList() : result;
['src/common/com/intellij/plugins/haxe/lang/psi/HaxeResolver.java']