Преглед изворни кода

Use whole import position when storing subtype import resolution data (#11732)

* Use whole import position when storing subtype import resolution data

* [tests] add test for 11620
Rudy Ges пре 1 година
родитељ
комит
6ac4f47995

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

@@ -166,7 +166,7 @@ let init_import ctx path mode p =
 							check_alias tsub name pname;
 							check_alias tsub name pname;
 							Some name
 							Some name
 					in
 					in
-					ctx.m.import_resolution#add (module_type_resolution tsub alias p2);
+					ctx.m.import_resolution#add (module_type_resolution tsub alias p);
 				with Not_found ->
 				with Not_found ->
 					(* this might be a static property, wait later to check *)
 					(* this might be a static property, wait later to check *)
 					let find_main_type_static () =
 					let find_main_type_static () =

+ 14 - 0
tests/display/src/cases/Issue11620.hx

@@ -0,0 +1,14 @@
+package cases;
+
+class Issue11620 extends DisplayTestCase {
+	/**
+		import misc.issue11620.Foo.Bar;
+
+		function main() {
+			Bar.bar();
+		}
+	**/
+	function test() {
+		arrayEq([], diagnostics());
+	}
+}

+ 9 - 0
tests/display/src/misc/issue11620/Foo.hx

@@ -0,0 +1,9 @@
+package misc.issue11620;
+
+class Foo {
+    public static function foo() {}
+}
+
+class Bar {
+    public static function bar() {}
+}