Bladeren bron

[display] don't be overly lenient with call args in display mode

closes #8078
Simon Krajewski 6 jaren geleden
bovenliggende
commit
461f4e9245
2 gewijzigde bestanden met toevoegingen van 22 en 1 verwijderingen
  1. 1 1
      src/typing/calls.ml
  2. 21 0
      tests/display/src/cases/Issue8078.hx

+ 1 - 1
src/typing/calls.ml

@@ -169,7 +169,7 @@ let rec unify_call_args' ctx el args r callp inline force_inline =
 		| (e,p) :: el, [] ->
 			begin match List.rev !skipped with
 				| [] ->
-					if ctx.com.display.dms_display then begin
+					if ctx.in_display then begin
 						let e = type_expr ctx (e,p) WithType.value in
 						(e,false) :: loop el []
 					end	else call_error Too_many_arguments p

+ 21 - 0
tests/display/src/cases/Issue8078.hx

@@ -0,0 +1,21 @@
+package cases;
+
+class Issue8078 extends DisplayTestCase {
+	/**
+		extern class StringBuilder {
+			@:overload(function new(s:String) {})
+			public function new() { }
+
+			public function append():Void { }
+		}
+		class Main {
+			static function main() {
+				var b = new StringBuilder("hi");
+				b.{-1-}
+			}
+		}
+	**/
+	function test() {
+		eq(true, hasField(fields(pos(1)), "append", "Void -> Void"));
+	}
+}