ソースを参照

recurse into singularly constrained monos for field collection

closes #11918
Simon Krajewski 6 ヶ月 前
コミット
366ad7c776

+ 2 - 0
src/context/display/displayFields.ml

@@ -169,6 +169,8 @@ let collect ctx e_ast e dk with_type p =
 					end
 				end else
 					loop items (mk_anon ~fields (ref Closed))
+			| CTypes [(t,_)] ->
+				loop items t
 			| CTypes tl ->
 				items
 			| CUnknown ->

+ 18 - 0
tests/display/src/cases/Issue11918.hx

@@ -0,0 +1,18 @@
+package cases;
+
+class Issue11918 extends DisplayTestCase {
+	/**
+		function main() {
+			final foo = get();
+			// foo is mono, no completion for String methods
+			foo.{-1-}
+		}
+
+		function get<T:String>():T {
+			return cast "";
+		}
+	**/
+	function test1() {
+		eq(true, hasField(fields(pos(1)), "length", "Int"));
+	}
+}