Răsfoiți Sursa

[diagnostics] use correct position for alias imports

closes #11516
Simon Krajewski 1 an în urmă
părinte
comite
395b5eb117
21 a modificat fișierele cu 20 adăugiri și 69 ștergeri
  1. 1 1
      src/context/display/importHandling.ml
  2. 12 0
      tests/server/src/cases/issues/Issue11516.hx
  3. 7 0
      tests/server/test/templates/issues/Issue11516/Importson.hx
  4. 0 5
      tests/server/test/templates/retyper/AbstractWithDependency.hx
  5. 0 3
      tests/server/test/templates/retyper/AbstractWithSignatureDependency.hx
  6. 0 3
      tests/server/test/templates/retyper/DependentEnum.hx
  7. 0 1
      tests/server/test/templates/retyper/DependentTypedef.hx
  8. 0 9
      tests/server/test/templates/retyper/IndependentEnum.hx
  9. 0 7
      tests/server/test/templates/retyper/IndependentTypedef.hx
  10. 0 1
      tests/server/test/templates/retyper/InterfaceDependency.hx
  11. 0 5
      tests/server/test/templates/retyper/MutualDependency.hx
  12. 0 1
      tests/server/test/templates/retyper/WithInterfaceDependency.hx
  13. 0 7
      tests/server/test/templates/retyper/WithMutualDependency.hx
  14. 0 1
      tests/server/test/templates/retyper/WithParentDependency.hx
  15. 0 3
      tests/server/test/templates/retyper/WithSignatureDependency.hx
  16. 0 5
      tests/server/test/templates/retyper/WithSignatureDependencyInferredArg.hx
  17. 0 3
      tests/server/test/templates/retyper/WithSignatureDependencyInferredProperty.hx
  18. 0 5
      tests/server/test/templates/retyper/WithSignatureDependencyInferredRet.hx
  19. 0 3
      tests/server/test/templates/retyper/WithSignatureDependencyInferredVariable.hx
  20. 0 3
      tests/server/test/templates/retyper/WithSignatureDependencyProperty.hx
  21. 0 3
      tests/server/test/templates/retyper/WithSignatureDependencyVariable.hx

+ 1 - 1
src/context/display/importHandling.ml

@@ -152,7 +152,7 @@ let init_import ctx path mode p =
 				| Some(newname,pname) ->
 					let mt = get_type tname in
 					check_alias mt newname pname;
-					ctx.m.import_resolution#add (module_type_resolution mt (Some newname) p2)
+					ctx.m.import_resolution#add (module_type_resolution mt (Some newname) p)
 				end
 			| [tsub,p2] ->
 				let pu = punion p1 p2 in

+ 12 - 0
tests/server/src/cases/issues/Issue11516.hx

@@ -0,0 +1,12 @@
+package cases.issues;
+
+class Issue11516 extends TestCase {
+	function testClass(_) {
+		vfs.putContent("Importson.hx", getTemplate("issues/Issue11516/Importson.hx"));
+		var args = ["Importson", "--interp"];
+		runHaxe(args);
+		runHaxeJsonCb(args, DisplayMethods.Diagnostics, {file: new FsPath("Importson.hx")}, res -> {
+			Assert.equals(0, res.length);
+		});
+	}
+}

+ 7 - 0
tests/server/test/templates/issues/Issue11516/Importson.hx

@@ -0,0 +1,7 @@
+import haxe.Json as Son;
+
+class Importson {
+	static function main() {
+		Son.parse(null);
+	}
+}

+ 0 - 5
tests/server/test/templates/retyper/AbstractWithDependency.hx

@@ -1,5 +0,0 @@
-abstract AbstractWithDependency(String) {
-	public static function notMain() {
-		trace(Dependency.get());
-	}
-}

+ 0 - 3
tests/server/test/templates/retyper/AbstractWithSignatureDependency.hx

@@ -1,3 +0,0 @@
-abstract AbstractWithSignatureDependency(String) {
-	public static function test(d:Dependency) {}
-}

+ 0 - 3
tests/server/test/templates/retyper/DependentEnum.hx

@@ -1,3 +0,0 @@
-enum DependentEnum {
-	Constructor(s:Dependency);
-}

+ 0 - 1
tests/server/test/templates/retyper/DependentTypedef.hx

@@ -1 +0,0 @@
-typedef DependentTypedef = Dependency;

+ 0 - 9
tests/server/test/templates/retyper/IndependentEnum.hx

@@ -1,9 +0,0 @@
-enum IndependentEnum {
-	Constructor(s:String);
-}
-
-class MakeDependency {
-	static function f() {
-		Dependency.get();
-	}
-}

+ 0 - 7
tests/server/test/templates/retyper/IndependentTypedef.hx

@@ -1,7 +0,0 @@
-typedef IndependentTypedef = String;
-
-class MakeDependency {
-	static function f() {
-		Dependency.get();
-	}
-}

+ 0 - 1
tests/server/test/templates/retyper/InterfaceDependency.hx

@@ -1 +0,0 @@
-interface InterfaceDependency {}

+ 0 - 5
tests/server/test/templates/retyper/MutualDependency.hx

@@ -1,5 +0,0 @@
-class MutualDependency {
-	static public function get() {
-		return WithMutualDependency.value;
-	}
-}

+ 0 - 1
tests/server/test/templates/retyper/WithInterfaceDependency.hx

@@ -1 +0,0 @@
-class WithInterfaceDependency implements InterfaceDependency {}

+ 0 - 7
tests/server/test/templates/retyper/WithMutualDependency.hx

@@ -1,7 +0,0 @@
-class WithMutualDependency {
-	static public var value = "Hello World";
-
-	public static function main() {
-		trace(MutualDependency.get());
-	}
-}

+ 0 - 1
tests/server/test/templates/retyper/WithParentDependency.hx

@@ -1 +0,0 @@
-class WithParentDependency extends Dependency {}

+ 0 - 3
tests/server/test/templates/retyper/WithSignatureDependency.hx

@@ -1,3 +0,0 @@
-class WithSignatureDependency {
-	public static function test(d:Dependency) {}
-}

+ 0 - 5
tests/server/test/templates/retyper/WithSignatureDependencyInferredArg.hx

@@ -1,5 +0,0 @@
-class WithSignatureDependency {
-	public static function test(d) {
-		d = new Dependency();
-	}
-}

+ 0 - 3
tests/server/test/templates/retyper/WithSignatureDependencyInferredProperty.hx

@@ -1,3 +0,0 @@
-class WithSignatureDependency {
-	public static var test(default, null) = new Dependency();
-}

+ 0 - 5
tests/server/test/templates/retyper/WithSignatureDependencyInferredRet.hx

@@ -1,5 +0,0 @@
-class WithSignatureDependency {
-	public static function test() {
-		return new Dependency();
-	}
-}

+ 0 - 3
tests/server/test/templates/retyper/WithSignatureDependencyInferredVariable.hx

@@ -1,3 +0,0 @@
-class WithSignatureDependency {
-	public static var test = new Dependency();
-}

+ 0 - 3
tests/server/test/templates/retyper/WithSignatureDependencyProperty.hx

@@ -1,3 +0,0 @@
-class WithSignatureDependency {
-	public static var test(default, null):Dependency;
-}

+ 0 - 3
tests/server/test/templates/retyper/WithSignatureDependencyVariable.hx

@@ -1,3 +0,0 @@
-class WithSignatureDependency {
-	public static var test:Dependency;
-}