diff -Nru haxe-4.0.3/debian/changelog haxe-4.0.5/debian/changelog --- haxe-4.0.3/debian/changelog 2019-11-29 15:31:54.000000000 +0000 +++ haxe-4.0.5/debian/changelog 2019-12-17 19:29:59.000000000 +0000 @@ -1,3 +1,9 @@ +haxe (1:4.0.5-1) unstable; urgency=medium + + * New upstream version. + + -- Andy Li Wed, 18 Dec 2019 03:29:59 +0800 + haxe (1:4.0.3-1) unstable; urgency=medium * New upstream version. diff -Nru haxe-4.0.3/extra/CHANGES.txt haxe-4.0.5/extra/CHANGES.txt --- haxe-4.0.3/extra/CHANGES.txt 2019-11-29 15:33:09.000000000 +0000 +++ haxe-4.0.5/extra/CHANGES.txt 2019-12-17 19:31:10.000000000 +0000 @@ -1,4 +1,15 @@ -2019-XX-XX: 4.0.X +2019-12-17: 4.0.5 + + Bugfixes: + + java : fix boolean arguments for `Type.createInstance(cls, args)` (#9025) + jvm : fix static overloads (#9034) + java/cs : fixed `Reflect.makeVarArgs(fn)` for calls of `fn` without arguments (#9037) + js : fix multiple appearances of the first object added to `ObjectMap` is passed to `ObjectMap.set(obj, v)` multiple times (#9026) + js : automatically wrap compound expressions with parentheses when passed to `js.Syntax.code()` (#9024) + windows : fix adding neko to PATH env var running windows installer (#9021) + +2019-11-29: 4.0.3 General improvements: diff -Nru haxe-4.0.3/extra/installer.nsi haxe-4.0.5/extra/installer.nsi --- haxe-4.0.3/extra/installer.nsi 2019-11-29 15:33:10.000000000 +0000 +++ haxe-4.0.5/extra/installer.nsi 2019-12-17 19:31:11.000000000 +0000 @@ -129,8 +129,6 @@ File /r /x .svn /x *.db /x Exceptions.log /x .local /x .multi /x *.pdb /x *.vshost.exe /x *.vshost.exe.config /x *.vshost.exe.manifest "resources\haxe\*.*" ${registerExtension} "$INSTDIR\haxe\haxe.exe --prompt" ".hxml" "Haxe compiler arguments list" - ExecWait '"$INSTDIR\haxe\haxe.exe" --cwd "$INSTDIR\haxe" -x WinSetup.hx' - SendMessage ${HWND_BROADCAST} ${WM_SETTINGCHANGE} 0 "STR:Environment" /TIMEOUT=5000 WriteUninstaller "$INSTDIR\Uninstall.exe" @@ -147,6 +145,12 @@ SectionEnd +Section "-Update PATH" + + ExecWait '"$INSTDIR\haxe\haxe.exe" --cwd "$INSTDIR\haxe" -x WinSetup.hx' + SendMessage ${HWND_BROADCAST} ${WM_SETTINGCHANGE} 0 "STR:Environment" /TIMEOUT=5000 + +SectionEnd diff -Nru haxe-4.0.3/src/core/globals.ml haxe-4.0.5/src/core/globals.ml --- haxe-4.0.3/src/core/globals.ml 2019-11-29 15:33:14.000000000 +0000 +++ haxe-4.0.5/src/core/globals.ml 2019-12-17 19:31:13.000000000 +0000 @@ -24,7 +24,7 @@ | Hl | Eval -let version = 4003 +let version = 4005 let version_major = version / 1000 let version_minor = (version mod 1000) / 100 let version_revision = (version mod 100) diff -Nru haxe-4.0.3/src/generators/genjs.ml haxe-4.0.5/src/generators/genjs.ml --- haxe-4.0.3/src/generators/genjs.ml 2019-11-29 15:33:16.000000000 +0000 +++ haxe-4.0.5/src/generators/genjs.ml 2019-12-17 19:31:14.000000000 +0000 @@ -968,6 +968,19 @@ else spr ctx (String.concat "\n" (ExtString.String.nsplit code "\r\n")) | _ -> + let rec reveal_expr expr = + match expr.eexpr with + | TCast (e, _) | TMeta (_, e) -> reveal_expr e + | _ -> expr + in + let args = List.map + (fun arg -> + match (reveal_expr arg).eexpr with + | TIf _ | TBinop _ | TUnop _ -> { arg with eexpr = TParenthesis arg } + | _ -> arg + ) + args + in Codegen.interpolate_code ctx.com code args (spr ctx) (gen_value ctx) code_pos end | "field" , [eobj;efield] -> diff -Nru haxe-4.0.3/src/generators/genjvm.ml haxe-4.0.5/src/generators/genjvm.ml --- haxe-4.0.3/src/generators/genjvm.ml 2019-11-29 15:33:16.000000000 +0000 +++ haxe-4.0.5/src/generators/genjvm.ml 2019-12-17 19:31:14.000000000 +0000 @@ -82,6 +82,18 @@ in loop (cf :: cf.cf_overloads) +let filter_overloads candidates = + match Overloads.Resolution.reduce_compatible candidates with + | [_,_,(c,cf)] -> Some(c,cf) + | [] -> None + | ((_,_,(c,cf)) :: _) (* as resolved *) -> + (* let st = s_type (print_context()) in + print_endline (Printf.sprintf "Ambiguous overload for %s(%s)" name (String.concat ", " (List.map (fun e -> st e.etype) el))); + List.iter (fun (_,t,(c,cf)) -> + print_endline (Printf.sprintf "\tCandidate: %s.%s(%s)" (s_type_path c.cl_path) cf.cf_name (st t)); + ) resolved; *) + Some(c,cf) + let find_overload_rec' is_ctor map_type c name el = let candidates = ref [] in let has_function t1 (_,t2,_) = @@ -114,16 +126,7 @@ end; in loop map_type c; - match Overloads.Resolution.reduce_compatible (List.rev !candidates) with - | [_,_,(c,cf)] -> Some(c,cf) - | [] -> None - | ((_,_,(c,cf)) :: _) (* as resolved *) -> - (* let st = s_type (print_context()) in - print_endline (Printf.sprintf "Ambiguous overload for %s(%s)" name (String.concat ", " (List.map (fun e -> st e.etype) el))); - List.iter (fun (_,t,(c,cf)) -> - print_endline (Printf.sprintf "\tCandidate: %s.%s(%s)" (s_type_path c.cl_path) cf.cf_name (st t)); - ) resolved; *) - Some(c,cf) + filter_overloads (List.rev !candidates) let find_overload_rec is_ctor map_type c cf el = if Meta.has Meta.Overload cf.cf_meta || cf.cf_overloads <> [] then @@ -1507,6 +1510,14 @@ Error.error (Printf.sprintf "Bad __array__ type: %s" (s_type (print_context()) tr)) e1.epos; end | TField(e1,FStatic(c,({cf_kind = Method (MethNormal | MethInline)} as cf))) -> + let c,cf = match cf.cf_overloads with + | [] -> c,cf + | _ -> match filter_overloads (find_overload (fun t -> t) c cf el) with + | None -> + Error.error "Could not find overload" e1.epos + | Some(c,cf) -> + c,cf + in let tl,tr = self#call_arguments cf.cf_type el in jm#invokestatic c.cl_path cf.cf_name (method_sig tl tr); tr diff -Nru haxe-4.0.3/std/cs/internal/Function.hx haxe-4.0.5/std/cs/internal/Function.hx --- haxe-4.0.3/std/cs/internal/Function.hx 2019-11-29 15:33:31.000000000 +0000 +++ haxe-4.0.5/std/cs/internal/Function.hx 2019-12-17 19:31:19.000000000 +0000 @@ -46,7 +46,7 @@ } override public function __hx_invokeDynamic(dynArgs:cs.NativeArray):Dynamic { - return fun(cs.Lib.array(dynArgs)); + return fun(dynArgs == null ? [] : cs.Lib.array(dynArgs)); } } diff -Nru haxe-4.0.3/std/java/internal/Function.hx haxe-4.0.5/std/java/internal/Function.hx --- haxe-4.0.3/std/java/internal/Function.hx 2019-11-29 15:33:54.000000000 +0000 +++ haxe-4.0.5/std/java/internal/Function.hx 2019-12-17 19:31:32.000000000 +0000 @@ -50,7 +50,7 @@ } override public function __hx_invokeDynamic(dynArgs:java.NativeArray):Dynamic { - return fun(@:privateAccess Array.ofNative(dynArgs)); + return fun(dynArgs == null ? [] : @:privateAccess Array.ofNative(dynArgs)); } } diff -Nru haxe-4.0.3/std/java/_std/Type.hx haxe-4.0.5/std/java/_std/Type.hx --- haxe-4.0.3/std/java/_std/Type.hx 2019-11-29 15:33:53.000000000 +0000 +++ haxe-4.0.5/std/java/_std/Type.hx 2019-12-17 19:31:32.000000000 +0000 @@ -142,6 +142,8 @@ if (arg == null || isDynamic || (argType != null && expectedType.isAssignableFrom(java.Lib.toNativeType(argType)))) { callArguments[argNum] = arg; + } else if(expectedType.getName() == 'boolean' && (cast argType:java.lang.Class).getName() == 'java.lang.Boolean') { + callArguments[argNum] = (cast arg : java.lang.Boolean).booleanValue(); } else if (Std.is(arg, java.lang.Number)) { var name = expectedType.getName(); switch (name) { diff -Nru haxe-4.0.3/std/js/_std/haxe/ds/ObjectMap.hx haxe-4.0.5/std/js/_std/haxe/ds/ObjectMap.hx --- haxe-4.0.3/std/js/_std/haxe/ds/ObjectMap.hx 2019-11-29 15:33:55.000000000 +0000 +++ haxe-4.0.5/std/js/_std/haxe/ds/ObjectMap.hx 2019-12-17 19:31:33.000000000 +0000 @@ -43,18 +43,20 @@ return untyped obj.__id__; } - var h:{}; + var h:{__keys__:{}}; public function new():Void { h = {__keys__: {}}; } - public function set(key:K, value:V):Void - untyped { - var id:Int = getId(key) || assignId(key); - h[id] = value; - h.__keys__[id] = key; + public function set(key:K, value:V):Void { + var id = getId(key); + if(id == null) { + id = assignId(key); } + Syntax.code('{0}[{1}] = {2}', h, id, value); + Syntax.code('{0}[{1}] = {2}', h.__keys__, id, key); + } public inline function get(key:K):Null { return untyped h[getId(key)]; diff -Nru haxe-4.0.3/tests/unit/src/unit/issues/Issue9024.hx haxe-4.0.5/tests/unit/src/unit/issues/Issue9024.hx --- haxe-4.0.3/tests/unit/src/unit/issues/Issue9024.hx 1970-01-01 00:00:00.000000000 +0000 +++ haxe-4.0.5/tests/unit/src/unit/issues/Issue9024.hx 2019-12-17 19:32:42.000000000 +0000 @@ -0,0 +1,13 @@ +package unit.issues; + +class Issue9024 extends unit.Test { +#if js + static var a:String = "a"; + static var b:String = "b"; + + function test() { + eq(2, js.Syntax.code('{0}.length', a + b)); + eq(2, js.Syntax.code('{0}.length', a < b ? "cd" : "efg")); + } +#end +} \ No newline at end of file diff -Nru haxe-4.0.3/tests/unit/src/unit/issues/Issue9025.hx haxe-4.0.5/tests/unit/src/unit/issues/Issue9025.hx --- haxe-4.0.3/tests/unit/src/unit/issues/Issue9025.hx 1970-01-01 00:00:00.000000000 +0000 +++ haxe-4.0.5/tests/unit/src/unit/issues/Issue9025.hx 2019-12-17 19:32:42.000000000 +0000 @@ -0,0 +1,16 @@ +package unit.issues; + +class Issue9025 extends unit.Test { + function test() { + var a:A = Type.createInstance(A, [true]); + t(a.field); + } +} + +@:keep +private class A { + public var field:Bool = false; + public function new(b:Bool) { + field = b; + } +} \ No newline at end of file diff -Nru haxe-4.0.3/tests/unit/src/unit/issues/Issue9026.hx haxe-4.0.5/tests/unit/src/unit/issues/Issue9026.hx --- haxe-4.0.3/tests/unit/src/unit/issues/Issue9026.hx 1970-01-01 00:00:00.000000000 +0000 +++ haxe-4.0.5/tests/unit/src/unit/issues/Issue9026.hx 2019-12-17 19:32:42.000000000 +0000 @@ -0,0 +1,12 @@ +package unit.issues; + +class Issue9026 extends unit.Test { + function test() { + var key = {}; + var map: Map<{}, Int> = new Map(); + map[key] = 10; + map[key] = 20; + eq(20, map.get(key)); + eq(1, Lambda.count(map)); + } +} \ No newline at end of file diff -Nru haxe-4.0.3/tests/unit/src/unit/issues/Issue9034.hx haxe-4.0.5/tests/unit/src/unit/issues/Issue9034.hx --- haxe-4.0.3/tests/unit/src/unit/issues/Issue9034.hx 1970-01-01 00:00:00.000000000 +0000 +++ haxe-4.0.5/tests/unit/src/unit/issues/Issue9034.hx 2019-12-17 19:32:42.000000000 +0000 @@ -0,0 +1,14 @@ +package unit.issues; + +import unit.Test; + +class Issue9034 extends Test{ + #if java + function test() { + bar(java.nio.file.Paths.get('build.hxml', new java.NativeArray(0))); + utest.Assert.pass(); + } + + static public inline function bar(path:java.nio.file.Path):Void { } + #end +} \ No newline at end of file diff -Nru haxe-4.0.3/tests/unit/src/unit/issues/Issue9037.hx haxe-4.0.5/tests/unit/src/unit/issues/Issue9037.hx --- haxe-4.0.3/tests/unit/src/unit/issues/Issue9037.hx 1970-01-01 00:00:00.000000000 +0000 +++ haxe-4.0.5/tests/unit/src/unit/issues/Issue9037.hx 2019-12-17 19:32:42.000000000 +0000 @@ -0,0 +1,10 @@ +package unit.issues; + +class Issue9037 extends unit.Test { + function test() { + var f = function(args:Array) {}; + var f:Dynamic = Reflect.makeVarArgs(f); + f(); + noAssert(); + } +} \ No newline at end of file