From 843ece7f5460b33957a1740ca65a000c073dc91d Mon Sep 17 00:00:00 2001 From: Mark Knol Date: Fri, 17 Mar 2017 12:23:39 +0100 Subject: [PATCH 01/12] Date - Minor API documentation copy fix Remove "the". --- std/Date.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/std/Date.hx b/std/Date.hx index fa833baf70e..adca8aea368 100644 --- a/std/Date.hx +++ b/std/Date.hx @@ -67,7 +67,7 @@ extern class Date function getMinutes() : Int; /** - Returns the seconds of the `this` Date (0-59 range). + Returns the seconds of `this` Date (0-59 range). **/ function getSeconds() : Int; From 2f2632fbfbb774258362a954101332ee0d5cb41e Mon Sep 17 00:00:00 2001 From: Simon Krajewski Date: Fri, 17 Mar 2017 12:24:13 +0100 Subject: [PATCH 02/12] it's 2017 --- extra/installer.nsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/installer.nsi b/extra/installer.nsi index bf41cc6d743..26affb2fa22 100644 --- a/extra/installer.nsi +++ b/extra/installer.nsi @@ -25,7 +25,7 @@ ; Installer details VIAddVersionKey "CompanyName" "Haxe Foundation" VIAddVersionKey "ProductName" "Haxe Installer" -VIAddVersionKey "LegalCopyright" "Haxe Foundation 2005-2016" +VIAddVersionKey "LegalCopyright" "Haxe Foundation 2005-2017" VIAddVersionKey "FileDescription" "Haxe Installer" VIAddVersionKey "ProductVersion" "${VERSION}.0" VIAddVersionKey "FileVersion" "${VERSION}.0" From 952f8f30de3ef79296f8ffdb62d2016503b49156 Mon Sep 17 00:00:00 2001 From: Gama11 Date: Fri, 17 Mar 2017 19:19:19 +0100 Subject: [PATCH 03/12] Fix typo in FileSystem.isDirectory() docs (#6104) --- std/sys/FileSystem.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/std/sys/FileSystem.hx b/std/sys/FileSystem.hx index 54da294d30c..d95e23b76aa 100644 --- a/std/sys/FileSystem.hx +++ b/std/sys/FileSystem.hx @@ -75,7 +75,7 @@ extern class FileSystem { /** Tells if the file or directory specified by `path` is a directory. - If `path` is not a valid file system entry or if its destination is no + If `path` is not a valid file system entry or if its destination is not accessible, an exception is thrown. If `path` is null, the result is unspecified. From f9230fc1437d81f4b9dd6ad94fb9834403690253 Mon Sep 17 00:00:00 2001 From: Dan Korostelev Date: Fri, 17 Mar 2017 22:30:33 +0300 Subject: [PATCH 04/12] [tests] don't assume test methods with optional args will work when called throught Reflect.callMethod with no arguments - we don't specify that. --- tests/unit/src/unit/issues/Issue2607.hx | 6 +++++- tests/unit/src/unit/issues/Issue3577.hx | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/unit/src/unit/issues/Issue2607.hx b/tests/unit/src/unit/issues/Issue2607.hx index 5ac86f70afb..be0f2dc7f62 100644 --- a/tests/unit/src/unit/issues/Issue2607.hx +++ b/tests/unit/src/unit/issues/Issue2607.hx @@ -4,8 +4,12 @@ class Issue2607 extends unit.Test { inline static var CONST:Float = -1; - function test(v = CONST) { + function fun(v = CONST) { eq(v, -1); t((v is Float)); } + + function test() { + fun(); + } } \ No newline at end of file diff --git a/tests/unit/src/unit/issues/Issue3577.hx b/tests/unit/src/unit/issues/Issue3577.hx index 58bea8bc292..e0848c41e8d 100644 --- a/tests/unit/src/unit/issues/Issue3577.hx +++ b/tests/unit/src/unit/issues/Issue3577.hx @@ -2,10 +2,10 @@ package unit.issues; class Issue3577 extends Test { function test() { - eq(testNull(2), 4); + eq(tNull(2), 4); } - function testNull(?x:Int=0) : Int { + function tNull(?x:Int=0) : Int { var y:Int = x; function anon() { y *= 2; From 3ea5b083571761e9e947da5e5edb2862a2b3f7e3 Mon Sep 17 00:00:00 2001 From: Hugh Sanderson Date: Sat, 18 Mar 2017 16:16:41 +0800 Subject: [PATCH 05/12] [cpp] Do not qualify @:native types with global namespace. Closes #6086 --- src/generators/gencpp.ml | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/generators/gencpp.ml b/src/generators/gencpp.ml index 8fd7635b9ce..d387f5d3ef4 100644 --- a/src/generators/gencpp.ml +++ b/src/generators/gencpp.ml @@ -745,7 +745,9 @@ let rec class_string klass suffix params remap = (* Normal class *) | path when klass.cl_extern && (not (is_internal_class path) )-> (join_class_path_remap klass.cl_path "::") ^ suffix - | _ -> "::" ^ (join_class_path_remap klass.cl_path "::") ^ suffix + | _ -> + let globalNamespace = if (get_meta_string klass.cl_meta Meta.Native)<>"" then "" else "::" in + globalNamespace ^ (join_class_path_remap klass.cl_path "::") ^ suffix ) and type_string_suff suffix haxe_type remap = let type_string = type_string_remap remap in @@ -1687,7 +1689,8 @@ and tcpp_to_string tcpp = tcpp_to_string_suffix "" tcpp and cpp_class_path_of klass = - " ::" ^ (join_class_path_remap klass.cl_path "::") + let globalNamespace = if (get_meta_string klass.cl_meta Meta.Native)<>"" then " " else " ::" in + globalNamespace ^ (join_class_path_remap klass.cl_path "::") ;; @@ -1973,7 +1976,8 @@ let cpp_enum_path_of enum = rename else *) - "::" ^ (join_class_path_remap enum.e_path "::") + let globalNamespace = if (get_meta_string enum.e_meta Meta.Native)<>"" then "" else "::" in + globalNamespace ^ (join_class_path_remap enum.e_path "::") ;; @@ -2013,10 +2017,9 @@ let cpp_class_name klass = rename ^ "_obj" else *) - begin - let path = "::" ^ (join_class_path_remap klass.cl_path "::") in - if path="::String" then path else path ^ "_obj" - end + let globalNamespace = if (get_meta_string klass.cl_meta Meta.Native)<>"" then "" else "::" in + let path = globalNamespace ^ (join_class_path_remap klass.cl_path "::") in + if path="::String" then path else path ^ "_obj" ;; @@ -2972,6 +2975,7 @@ let retype_expression ctx request_type function_args expression_tree forInjectio CppTry(cppBlock, cppCatches), TCppVoid | TReturn eo -> + (*CppReturn(match eo with None -> None | Some e -> Some (retype (cpp_type_of expr.etype) e)), TCppVoid*) CppReturn(match eo with None -> None | Some e -> Some (retype (cpp_type_of e.etype) e)), TCppVoid | TCast (base,None) -> (* Use auto-cast rules *) @@ -3030,6 +3034,11 @@ let retype_expression ctx request_type function_args expression_tree forInjectio end else if (cppExpr.cpptype=TCppVariant || cppExpr.cpptype=TCppDynamic) then begin match return_type with | TCppUnchanged -> cppExpr + | TCppInst(t) when (has_meta_key t.cl_meta Meta.StructAccess) -> + let structType = TCppStruct( TCppInst(t) ) in + let structCast = mk_cppexpr (CppCast(cppExpr,structType)) structType in + mk_cppexpr (CppCast(structCast,(TCppInst t))) (TCppInst t) + | TCppObjectArray _ | TCppScalarArray _ | TCppNativePointer _ @@ -3057,6 +3066,11 @@ let retype_expression ctx request_type function_args expression_tree forInjectio | TCppDynamic when cppExpr.cpptype=TCppVariant -> mk_cppexpr (CppCastVariant(cppExpr)) return_type + | TCppStar(t,const) -> + let ptrType = TCppPointer((if const then "ConstPointer" else "Pointer"),t) in + let ptrCast = mk_cppexpr (CppCast(cppExpr,ptrType)) ptrType in + mk_cppexpr (CppCast(ptrCast,TCppStar(t,const))) (TCppStar(t,const)) + | _ -> cppExpr end else match cppExpr.cpptype, return_type with | _, TCppUnchanged -> cppExpr @@ -3105,10 +3119,7 @@ let retype_expression ctx request_type function_args expression_tree forInjectio let ptrType = TCppPointer((if const then "ConstPointer" else "Pointer"),t) in let ptrCast = mk_cppexpr (CppCast(cppExpr,ptrType)) ptrType in mk_cppexpr (CppCast(ptrCast,TCppDynamic)) TCppDynamic - | TCppDynamic, TCppStar(t,const) -> - let ptrType = TCppPointer((if const then "ConstPointer" else "Pointer"),t) in - let ptrCast = mk_cppexpr (CppCast(cppExpr,ptrType)) ptrType in - mk_cppexpr (CppCast(ptrCast,TCppStar(t,const))) (TCppStar(t,const)) + | TCppStar(t,const), TCppInst _ | TCppStar(t,const), TCppStruct _ -> From 49a5ed5ba6db520dbb17618b6595230bfb282007 Mon Sep 17 00:00:00 2001 From: Dan Korostelev Date: Sat, 18 Mar 2017 14:49:42 +0300 Subject: [PATCH 06/12] OCD [skip ci] --- src/typing/type.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/typing/type.ml b/src/typing/type.ml index 658b8da9b8d..fd901e5c3aa 100644 --- a/src/typing/type.ml +++ b/src/typing/type.ml @@ -206,7 +206,7 @@ and tclass = { mutable cl_interface : bool; mutable cl_super : (tclass * tparams) option; mutable cl_implements : (tclass * tparams) list; - mutable cl_fields : (string , tclass_field) PMap.t; + mutable cl_fields : (string, tclass_field) PMap.t; mutable cl_statics : (string, tclass_field) PMap.t; mutable cl_ordered_statics : tclass_field list; mutable cl_ordered_fields : tclass_field list; From 6b58aaa753da575751d54d4effaa82995a5edee7 Mon Sep 17 00:00:00 2001 From: Dan Korostelev Date: Sat, 18 Mar 2017 16:01:59 +0300 Subject: [PATCH 07/12] remove unused version_is_stable value [skip ci] --- src/globals.ml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/globals.ml b/src/globals.ml index 96671ab24b8..33335b13587 100644 --- a/src/globals.ml +++ b/src/globals.ml @@ -24,7 +24,6 @@ let version = 3401 let version_major = version / 1000 let version_minor = (version mod 1000) / 100 let version_revision = (version mod 100) -let version_is_stable = version_minor land 1 = 0 let macro_platform = ref Neko From 433aed43f55a2c9bc80290e78cabd6ea6dd236d7 Mon Sep 17 00:00:00 2001 From: hughsando Date: Sat, 18 Mar 2017 21:24:01 +0800 Subject: [PATCH 08/12] [cpp] Store the expected return type for a function. Closes #6103 --- src/generators/gencpp.ml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/generators/gencpp.ml b/src/generators/gencpp.ml index d387f5d3ef4..b991e491652 100644 --- a/src/generators/gencpp.ml +++ b/src/generators/gencpp.ml @@ -2317,7 +2317,7 @@ let is_gc_element ctx member_type = -let retype_expression ctx request_type function_args expression_tree forInjection = +let retype_expression ctx request_type function_args function_type expression_tree forInjection = let rev_closures = ref [] in let closureId = ref 0 in let declarations = ref (Hashtbl.create 0) in @@ -2975,8 +2975,7 @@ let retype_expression ctx request_type function_args expression_tree forInjectio CppTry(cppBlock, cppCatches), TCppVoid | TReturn eo -> - (*CppReturn(match eo with None -> None | Some e -> Some (retype (cpp_type_of expr.etype) e)), TCppVoid*) - CppReturn(match eo with None -> None | Some e -> Some (retype (cpp_type_of e.etype) e)), TCppVoid + CppReturn(match eo with None -> None | Some e -> Some (retype (cpp_type_of function_type) e)), TCppVoid | TCast (base,None) -> (* Use auto-cast rules *) let return_type = cpp_type_of expr.etype in @@ -3222,7 +3221,7 @@ let gen_type ctx haxe_type = ;; -let gen_cpp_ast_expression_tree ctx class_name func_name function_args injection tree = +let gen_cpp_ast_expression_tree ctx class_name func_name function_args function_type injection tree = let writer = ctx.ctx_writer in let out = ctx.ctx_output in let lastLine = ref (-1) in @@ -3244,7 +3243,7 @@ let gen_cpp_ast_expression_tree ctx class_name func_name function_args injection let forInjection = match injection with Some inject -> inject.inj_setvar<>"" | _ -> false in - let cppTree = retype_expression ctx TCppVoid function_args tree forInjection in + let cppTree = retype_expression ctx TCppVoid function_args function_type tree forInjection in let label_name i = Printf.sprintf "_hx_goto_%i" i in let class_hash = gen_hash_small 0 class_name in @@ -4059,7 +4058,7 @@ let gen_cpp_function_body ctx clazz is_static func_name function_def head_code t let args = List.map fst function_def.tf_args in let injection = mk_injection prologue "" tail_code in - gen_cpp_ast_expression_tree ctx dot_name func_name args injection (mk_block function_def.tf_expr); + gen_cpp_ast_expression_tree ctx dot_name func_name args function_def.tf_type injection (mk_block function_def.tf_expr); ;; let gen_cpp_init ctx dot_name func_name var_name expr = @@ -4070,7 +4069,7 @@ let gen_cpp_init ctx dot_name func_name var_name expr = hx_stack_push ctx output_i dot_name func_name expr.epos gc_stack; in let injection = mk_injection prologue var_name "" in - gen_cpp_ast_expression_tree ctx dot_name func_name [] injection (mk_block expr); + gen_cpp_ast_expression_tree ctx dot_name func_name [] t_dynamic injection (mk_block expr); ;; From d5ecfb142172db224cc9f95fa5e9de06c060571d Mon Sep 17 00:00:00 2001 From: Alexander Kuzmenko Date: Sun, 19 Mar 2017 17:27:56 +0300 Subject: [PATCH 09/12] [php7] wrap empty array declaration in parentheses if used directly with array access (fixes #6090) --- src/generators/genphp7.ml | 12 +++++++++++- tests/unit/src/unit/issues/Issue6090.hx | 7 +++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 tests/unit/src/unit/issues/Issue6090.hx diff --git a/src/generators/genphp7.ml b/src/generators/genphp7.ml index b9685c72cf2..c57c91b330c 100644 --- a/src/generators/genphp7.ml +++ b/src/generators/genphp7.ml @@ -1651,7 +1651,17 @@ class code_writer (ctx:Common.context) hx_type_path php_name = *) method write_expr_array_decl exprs = match exprs with - | [] -> self#write ("new " ^ (self#use array_type_path) ^ "()") + | [] -> + let decl () = self#write ("new " ^ (self#use array_type_path) ^ "()") in + (* Wrap into parentheses if trying to access items of empty array declaration *) + (match self#parent_expr with + | Some { eexpr = TArray _ } -> + self#write "("; + decl(); + self#write ")" + | _ -> + decl() + ) | [expr] -> self#write ((self#use array_type_path) ^ "::wrap(["); self#write_expr expr; diff --git a/tests/unit/src/unit/issues/Issue6090.hx b/tests/unit/src/unit/issues/Issue6090.hx new file mode 100644 index 00000000000..ba2583443bb --- /dev/null +++ b/tests/unit/src/unit/issues/Issue6090.hx @@ -0,0 +1,7 @@ +package unit.issues; + +class Issue6090 extends Test { + public function test() { + eq(null, [][0]); + } +} From 56f18419101417ae4893587d77a44ed0595446c4 Mon Sep 17 00:00:00 2001 From: hughsando Date: Sun, 19 Mar 2017 23:11:44 +0800 Subject: [PATCH 10/12] [cpp] Don't emit a line change on the first line of a function --- src/generators/gencpp.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/generators/gencpp.ml b/src/generators/gencpp.ml index b991e491652..2c7cda7a189 100644 --- a/src/generators/gencpp.ml +++ b/src/generators/gencpp.ml @@ -3254,7 +3254,7 @@ let gen_cpp_ast_expression_tree ctx class_name func_name function_args function_ List.iter gen_closure closures; (match injection with Some inject -> inject.inj_prologue gc_stack | _ -> () ); let remaining = ref (List.length exprs) in - lastLine := -1; + lastLine := Lexer.get_error_line tree.epos; List.iter (fun e -> output_p e ""; if (!remaining=1) then From d0afe5bc983563455cb3a06ce0d9c5467cff8dcb Mon Sep 17 00:00:00 2001 From: Gama11 Date: Sun, 19 Mar 2017 18:38:01 +0100 Subject: [PATCH 11/12] Improved doc wording for Sys.environment() (#6109) --- std/Sys.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/std/Sys.hx b/std/Sys.hx index 46c38585d7d..4d80ba7daa8 100644 --- a/std/Sys.hx +++ b/std/Sys.hx @@ -51,7 +51,7 @@ extern class Sys { static function putEnv( s : String, v : String ) : Void; /** - Returns the whole environment variables. + Returns all environment variables. **/ static function environment() : Map; @@ -145,4 +145,4 @@ extern class Sys { **/ static function stderr() : haxe.io.Output; -} \ No newline at end of file +} From e0330030bcaa46d9e3c56ed6d6440c0b72ffe303 Mon Sep 17 00:00:00 2001 From: Simon Krajewski Date: Mon, 20 Mar 2017 14:41:52 +0100 Subject: [PATCH 12/12] prepare 3.4.2 --- extra/CHANGES.txt | 9 +++++++++ src/globals.ml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/extra/CHANGES.txt b/extra/CHANGES.txt index 289f33f0ff1..9d7a017600f 100644 --- a/extra/CHANGES.txt +++ b/extra/CHANGES.txt @@ -1,3 +1,12 @@ +2017-03-20: 3.4.2 + + Bugfixes: + + cpp : fixed issue with @:native names being prefixed with :: (#6086) + cpp : fixed issue with return type handling (#6103) + cpp : fixed inaccurate line numbers that threw off debugging + php7 : fixed generation of `[][0]` constructs (#6090) + 2017-03-17: 3.4.1 New features: diff --git a/src/globals.ml b/src/globals.ml index 33335b13587..64f47a492b9 100644 --- a/src/globals.ml +++ b/src/globals.ml @@ -20,7 +20,7 @@ type platform = | Python | Hl -let version = 3401 +let version = 3402 let version_major = version / 1000 let version_minor = (version mod 1000) / 100 let version_revision = (version mod 100)