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

Fix remap vs module resolution for sub types (#12305)

* Fix remap vs module resolution for sub types

* Remap: forward typedef position

* [test] add --remap test
Rudy Ges пре 2 недеља
родитељ
комит
613767bf28

+ 2 - 2
src/typing/typeloadParse.ml

@@ -325,9 +325,9 @@ let parse_module com m p =
 										TPType (make_ptp_th_null (mk_type_path ([],fst tp.tp_name)))
 									) d.d_params
 								in
-								mk_type_path ~params (!remap,fst d.d_name)
+								mk_type_path ~params ~sub:(fst d.d_name) (!remap,snd m)
 						in
-						make_ptp_th_null tp
+						make_ptp_th tp (snd d.d_name)
 					end
 				},p) :: acc
 			in

+ 3 - 0
tests/misc/projects/Issue12305/compile.hxml

@@ -0,0 +1,3 @@
+-cp src
+-main Main
+--remap foo:haxe

+ 5 - 0
tests/misc/projects/Issue12305/src/Main.hx

@@ -0,0 +1,5 @@
+import foo.display.Position.Range;
+
+function main() {
+	var loc:Null<Range> = null;
+}

+ 39 - 0
tests/misc/projects/Issue12305/src/foo/display/Position.hx

@@ -0,0 +1,39 @@
+package foo.display;
+
+/**
+	Position in a text document expressed as 1-based line and character offset.
+**/
+typedef Position = {
+	/**
+		Line position in a document (1-based).
+	**/
+	var line:Int;
+
+	/**
+		Character offset on a line in a document (1-based).
+	**/
+	var character:Int;
+}
+
+/**
+	A range in a text document expressed as (1-based) start and end positions.
+**/
+typedef Range = {
+	/**
+		The range's start position
+	**/
+	var start:Position;
+
+	/**
+		The range's end position
+	**/
+	var end:Position;
+}
+
+/**
+	Represents a location inside a resource, such as a line inside a text file.
+**/
+typedef Location = {
+	var file:FsPath;
+	var range:Range;
+}