2
0
Эх сурвалжийг харах

use signature display only if we're actually in a related display mode

closes #5969
Simon Krajewski 8 жил өмнө
parent
commit
bba9186627

+ 4 - 2
src/typing/typer.ml

@@ -3572,8 +3572,10 @@ and type_expr ctx (e,p) (with_type:with_type) =
 		let texpr = loop t in
 		mk (TCast (type_expr ctx e Value,Some texpr)) t p
 	| EDisplay (e,iscall) ->
-		if iscall then handle_signature_display ctx e with_type
-		else handle_display ctx e with_type
+		begin match ctx.com.display.dms_kind with
+			| DMField | DMSignature when iscall -> handle_signature_display ctx e with_type
+			| _ -> handle_display ctx e with_type
+		end
 	| EDisplayNew t ->
 		assert false
 		(*let t = Typeload.load_instance ctx t true p in

+ 9 - 0
tests/display/src/cases/Toplevel.hx

@@ -135,6 +135,15 @@ class Toplevel extends DisplayTestCase {
 		eq(true, hasToplevel(typesCompletion, "package", "haxe"));
 	}
 
+	/**
+	Xml.parse({-1-}
+	**/
+	@:funcCode function testIssue5969() {
+		var typesCompletion = toplevel(pos(1));
+		eq(true, hasToplevel(typesCompletion, "type", "Array"));
+		eq(true, hasToplevel(typesCompletion, "package", "haxe"));
+	}
+
 	static function hasToplevel(a:Array<ToplevelElement>, kind:String, name:String):Bool {
 		return a.exists(function(t) return t.kind == kind && t.name == name);
 	}