Pārlūkot izejas kodu

use Type.unify for rest args after all. +test (#10143)

Aleksandr Kuzmenko 4 gadi atpakaļ
vecāks
revīzija
dbf314abe6

+ 1 - 1
src/typing/callUnification.ml

@@ -126,7 +126,7 @@ let rec unify_call_args ctx el args r callp inline force_inline in_overload =
 							(try
 								let el = type_rest mk_mono in
 								try
-									unify ctx (unify_min ctx el) arg_t callp;
+									Type.unify (unify_min ctx el) arg_t;
 									el
 								with Unify_error _ ->
 									handle_errors (fun() ->

+ 14 - 0
tests/unit/src/unit/issues/Issue10143.hx

@@ -8,6 +8,8 @@ class Issue10143 extends Test {
 		noAssert();
 		eq('String', HelperMacros.typeString(Win.test('hello')));
 		eq('Bool', HelperMacros.typeString(Win.test({field:'world'})));
+		eq('String', HelperMacros.typeString(Win.test(('hello':AString))));
+		eq('Bool', HelperMacros.typeString(Win.test(({field:'world'}:AObj))));
 	}
 }
 
@@ -16,6 +18,18 @@ private extern class Win {
 	overload static function test(items:...String):String;
 }
 
+private abstract AString(String) from String {
+	@:to public function toString():String {
+		return this;
+	}
+}
+
+private abstract AObj({field:String}) from {field:String} {
+	@:to public function toObj():{field:String} {
+		return this;
+	}
+}
+
 #else
 class Issue10143 extends Test {}
 #end