Просмотр исходного кода

Merge branch 'development' into kt_coro

Simon Krajewski 6 дней назад
Родитель
Сommit
480f7f79b7

+ 10 - 16
.github/workflows/main.yml

@@ -574,9 +574,9 @@ jobs:
 
       - name: Install dependencies
         env:
-          # For compatibility with macOS 10.13
+          # Build from source for compatibility with macOS 10.13
           ZLIB_VERSION: 1.3.1
-          MBEDTLS_VERSION: 2.28.10
+          MBEDTLS_VERSION: 3.6.4
           PCRE2_VERSION: 10.45
           CMAKE_BUILD_TYPE: Release
           CMAKE_GENERATOR: Ninja
@@ -590,7 +590,7 @@ jobs:
           cmake --build build
           sudo cmake --install build
           cd ..
-          curl -L https://github.com/ARMmbed/mbedtls/archive/v$MBEDTLS_VERSION.tar.gz | tar xz
+          curl -L https://github.com/Mbed-TLS/mbedtls/releases/download/mbedtls-$MBEDTLS_VERSION/mbedtls-$MBEDTLS_VERSION.tar.bz2 | tar xz
           cd mbedtls-$MBEDTLS_VERSION
           cmake -B build -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} \
             -DENABLE_TESTING=OFF
@@ -792,21 +792,16 @@ jobs:
 
   mac-test:
     needs: mac-build-universal
-    runs-on: ${{ matrix.os }}
+    runs-on: macos-latest
     env:
-      PLATFORM: mac${{ matrix.os == 'macos-latest' && '-arm64' || '' }}
+      PLATFORM: mac-arm64
       TEST: ${{matrix.target}}
       HXCPP_COMPILE_CACHE: ~/hxcache
       HAXE_STD_PATH: /usr/local/share/haxe/std
     strategy:
       fail-fast: false
       matrix:
-        os: [macos-latest]
-        target: [macro, js, cpp, jvm, php, python, lua, flash, neko]
-        include:
-          - target: hl
-            os: macos-13
-            BREW_PACKAGES: ninja
+        target: [macro, js, cpp, jvm, php, python, lua, flash, neko, hl]
 
     steps:
       - uses: actions/checkout@main
@@ -814,7 +809,10 @@ jobs:
           submodules: recursive
       - uses: actions/download-artifact@v4
         with:
-          name: macBinaries
+          # install the arm64-only binaries for HL to avoid issues with Rosetta
+          # the sys tests invoke Haxe, which invokes haxelib, which requires neko
+          # invoking the universal version of haxelib from an x86_64 process fails because neko is arm64-only
+          name: ${{ matrix.target == 'hl' && 'macArmBinaries' || 'macBinaries' }}
           path: macBinaries
 
       - name: Install Neko from S3
@@ -858,10 +856,6 @@ jobs:
           mkdir ~/haxelib
           haxelib setup ~/haxelib
 
-      - name: Install homebrew packages
-        if: matrix.BREW_PACKAGES
-        run: brew install ${{matrix.BREW_PACKAGES}}
-
       - name: Test
         run: |
           # disable invalid Unicode filenames on APFS

+ 3 - 3
extra/github-actions/build-mac.yml

@@ -1,8 +1,8 @@
 - name: Install dependencies
   env:
-    # For compatibility with macOS 10.13
+    # Build from source for compatibility with macOS 10.13
     ZLIB_VERSION: 1.3.1
-    MBEDTLS_VERSION: 2.28.10
+    MBEDTLS_VERSION: 3.6.4
     PCRE2_VERSION: 10.45
     CMAKE_BUILD_TYPE: Release
     CMAKE_GENERATOR: Ninja
@@ -16,7 +16,7 @@
     cmake --build build
     sudo cmake --install build
     cd ..
-    curl -L https://github.com/ARMmbed/mbedtls/archive/v$MBEDTLS_VERSION.tar.gz | tar xz
+    curl -L https://github.com/Mbed-TLS/mbedtls/releases/download/mbedtls-$MBEDTLS_VERSION/mbedtls-$MBEDTLS_VERSION.tar.bz2 | tar xz
     cd mbedtls-$MBEDTLS_VERSION
     cmake -B build -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} \
       -DENABLE_TESTING=OFF

+ 0 - 4
extra/github-actions/test-mac.yml

@@ -20,10 +20,6 @@
     mkdir ~/haxelib
     haxelib setup ~/haxelib
 
-- name: Install homebrew packages
-  if: matrix.BREW_PACKAGES
-  run: brew install ${{matrix.BREW_PACKAGES}}
-
 - name: Test
   run: |
     # disable invalid Unicode filenames on APFS

+ 7 - 9
extra/github-actions/workflows/main.yml

@@ -450,21 +450,16 @@ jobs:
 
   mac-test:
     needs: mac-build-universal
-    runs-on: ${{ matrix.os }}
+    runs-on: macos-latest
     env:
-      PLATFORM: mac${{ matrix.os == 'macos-latest' && '-arm64' || '' }}
+      PLATFORM: mac-arm64
       TEST: ${{matrix.target}}
       HXCPP_COMPILE_CACHE: ~/hxcache
       HAXE_STD_PATH: /usr/local/share/haxe/std
     strategy:
       fail-fast: false
       matrix:
-        os: [macos-latest]
-        target: [macro, js, cpp, jvm, php, python, lua, flash, neko]
-        include:
-          - target: hl
-            os: macos-13
-            BREW_PACKAGES: ninja
+        target: [macro, js, cpp, jvm, php, python, lua, flash, neko, hl]
 
     steps:
       - uses: actions/checkout@main
@@ -472,7 +467,10 @@ jobs:
           submodules: recursive
       - uses: actions/download-artifact@v4
         with:
-          name: macBinaries
+          # install the arm64-only binaries for HL to avoid issues with Rosetta
+          # the sys tests invoke Haxe, which invokes haxelib, which requires neko
+          # invoking the universal version of haxelib from an x86_64 process fails because neko is arm64-only
+          name: ${{ matrix.target == 'hl' && 'macArmBinaries' || 'macBinaries' }}
           path: macBinaries
 
       @import install-neko-unix.yml

+ 1 - 1
extra/haxelib_src

@@ -1 +1 @@
-Subproject commit 8c4199b8257e34d59799dfa5086c1008c3124669
+Subproject commit 659d200a08200b8dbed685e7fa0aa5b02fb44a6b

+ 6 - 0
src-json/meta.json

@@ -1139,6 +1139,12 @@
 		"doc": "Internally used for exceptions wrapping in `throw` expressions.",
 		"internal": true
 	},
+	{
+		"name": "ExceptionTypeCheck",
+		"metadata": ":exceptionTypeCheck",
+		"doc": "Internally used for transformed exception type check wrt to `catch`.",
+		"internal": true
+	},
 	{
 		"name": "NativeArrayAccess",
 		"metadata": ":nativeArrayAccess",

+ 3 - 0
src/context/common.ml

@@ -633,6 +633,9 @@ let get_config com =
 			pf_add_final_return = true;
 			pf_supports_threads = true;
 			pf_supports_unicode = (defined Define.Cppia) || not (defined Define.DisableUnicodeStrings);
+			pf_exceptions = { default_config.pf_exceptions with
+				ec_avoid_wrapping = false
+			};
 			pf_scoping = { default_config.pf_scoping with
 				vs_flags = [NoShadowing];
 				vs_scope = FunctionScope;

+ 6 - 2
src/filters/exception/exceptions.ml

@@ -74,6 +74,9 @@ let haxe_exception_instance_call ctx haxe_exception method_name args p =
 		make_call ctx.scom efield args rt p
 	| _ -> raise_typing_error ((s_type (print_context()) haxe_exception.etype) ^ "." ^ method_name ^ " is expected to be an instance method") p
 
+let add_meta_exception_type_check e =
+	mk (TMeta((Meta.ExceptionTypeCheck,[],e.epos),e)) e.etype e.epos
+
 (**
 	Generate `Std.isOfType(e, t)`
 *)
@@ -81,7 +84,8 @@ let std_is ctx e t p =
 	let t = follow t in
 	let type_expr = TyperBase.type_module_type_simple (module_type_of_type t) p in
 	let (std_cls,isOfType_field,return_type) = ctx.is_of_type in
-	make_static_call ctx.scom std_cls isOfType_field [e; type_expr] return_type p
+	let e = make_static_call ctx.scom std_cls isOfType_field [e; type_expr] return_type p in
+	add_meta_exception_type_check e
 
 (**
 	Check if type path of `t` exists in `lst`
@@ -260,7 +264,7 @@ let catches_to_ifs ctx catches t p =
 						let condition =
 							(* catch(e:haxe.Exception) is a wildcard catch *)
 							if fast_eq (haxe_exception_type ctx) current_t then
-								mk (TConst (TBool true)) ctx.basic.tbool v.v_pos
+								add_meta_exception_type_check (mk (TConst (TBool true)) ctx.basic.tbool v.v_pos)
 							else
 								std_is ctx (catch#get_haxe_exception v.v_pos) v.v_type v.v_pos
 						in

+ 54 - 26
src/generators/genhl.ml

@@ -26,6 +26,7 @@ open Type
 open Error
 open Gctx
 open Hlcode
+open Semver
 
 (* compiler *)
 
@@ -121,6 +122,9 @@ type context = {
 	mutable ct_depth : int;
 }
 
+let compare_version v1 v2 =
+	Semver.compare_version (Semver.parse_version v1) (Semver.parse_version v2)
+
 (* --- *)
 
 type access =
@@ -1095,43 +1099,45 @@ let before_break_continue ctx =
 	in
 	loop (ctx.m.mtrys - ctx.m.mloop_trys)
 
-let type_value ctx t p =
+let type_global ctx t p =
 	match t with
 	| TClassDecl c ->
-		let g, t = class_global ctx c in
-		let r = alloc_tmp ctx t in
-		op ctx (OGetGlobal (r, g));
-		r
+		class_global ctx c
 	| TAbstractDecl a ->
-		let r = alloc_tmp ctx (class_type ctx ctx.base_type [] false) in
-		(match a.a_path with
-		| [], "Int" -> op ctx (OGetGlobal (r, alloc_global ctx "$Int" (rtype ctx r)))
-		| [], "Float" -> op ctx (OGetGlobal (r, alloc_global ctx "$Float" (rtype ctx r)))
-		| [], "Bool" -> op ctx (OGetGlobal (r, alloc_global ctx "$Bool" (rtype ctx r)))
-		| [], "Class" -> op ctx (OGetGlobal (r, fst (class_global ctx ctx.base_class)))
-		| [], "Enum" -> op ctx (OGetGlobal (r, fst (class_global ctx ctx.base_enum)))
-		| [], "Dynamic" -> op ctx (OGetGlobal (r, alloc_global ctx "$Dynamic" (rtype ctx r)))
-		| _ -> abort ("Unsupported type value " ^ s_type_path (t_path t)) p);
-		r
+		let rt = class_type ctx ctx.base_type [] false in
+		let g = (match a.a_path with
+		| [], "Int" -> alloc_global ctx "$Int" rt
+		| [], "Float" -> alloc_global ctx "$Float" rt
+		| [], "Bool" -> alloc_global ctx "$Bool" rt
+		| [], "Class" -> fst (class_global ctx ctx.base_class)
+		| [], "Enum" -> fst (class_global ctx ctx.base_enum)
+		| [], "Dynamic" -> alloc_global ctx "$Dynamic" rt
+		| _ -> abort ("Unsupported type value " ^ s_type_path (t_path t)) p) in
+		g, rt
 	| TEnumDecl e ->
-		let r = alloc_tmp ctx (enum_class ctx e) in
-		let rt = rtype ctx r in
-		op ctx (OGetGlobal (r, alloc_global ctx (match rt with HObj o -> o.pname | _ -> die "" __LOC__) rt));
-		r
+		let rt = enum_class ctx e in
+		let g = alloc_global ctx (match rt with HObj o -> o.pname | _ -> die "" __LOC__) rt in
+		g, rt
 	| TTypeDecl _ ->
 		die "" __LOC__
 
+let type_value ctx t p =
+	let g, rt = type_global ctx t p in
+	let r = alloc_tmp ctx rt in
+	op ctx (OGetGlobal (r, g));
+	r
+
 let rec eval_to ctx e (t:ttype) =
 	match e.eexpr, t with
 	| TConst (TInt i), HF64 ->
 		let r = alloc_tmp ctx t in
 		op ctx (OFloat (r,alloc_float ctx (Int32.to_float i)));
 		r
-	| TConst (TInt i), HF32 when ctx.hl_ver >= "1.15" ->
+	| TConst (TInt i), HF32 when compare_version ctx.hl_ver "1.15.0" >= 0 ->
 		let r = alloc_tmp ctx t in
 		op ctx (OFloat (r, alloc_float ctx (Int32.to_float i)));
 		r
-	| TConst (TFloat f), HF32 when ctx.hl_ver >= "1.15" ->
+	| TConst (TFloat f), HF32 when compare_version ctx.hl_ver "1.15.0" >= 0 ->
 		let r = alloc_tmp ctx t in
 		op ctx (OFloat (r, alloc_float ctx (float_of_string f)));
 		r
@@ -2220,9 +2226,9 @@ and eval_expr ctx e =
 			| AInstanceField (f, index, _) -> op ctx (OPrefetch (eval_expr ctx f, index + 1, mode))
 			| _ -> op ctx (OPrefetch (eval_expr ctx value, 0, mode)));
 			alloc_tmp ctx HVoid
-        | "$unsafecast", [value] ->
+		| "$unsafecast", [value] ->
 			let r = alloc_tmp ctx (to_type ctx e.etype) in
-            op ctx (OUnsafeCast (r, eval_expr ctx value));
+			op ctx (OUnsafeCast (r, eval_expr ctx value));
 			r
 		| "$asm", [mode; value] ->
 			let mode = (match get_const mode with
@@ -3050,6 +3056,21 @@ and eval_expr ctx e =
 		let rtrap = alloc_tmp ctx HDyn in
 		op ctx (OTrap (rtrap,-1)); (* loop *)
 		ctx.m.mtrys <- ctx.m.mtrys + 1;
+		if compare_version ctx.hl_ver "1.16.0" >= 0 then begin
+			let catched_types = ref [] in
+			let rec find_meta e =
+				(match e.eexpr with
+				(* Std.isOfType(e, t) *)
+				| TMeta ((Meta.ExceptionTypeCheck,_,_),{eexpr=TCall(_,_::[{eexpr=TTypeExpr(mt)}])}) ->
+					catched_types := fst (type_global ctx mt e.epos) :: !catched_types
+				| TMeta ((Meta.ExceptionTypeCheck,_,_),{eexpr=TConst(TBool(true))}) ->
+					catched_types := alloc_global ctx "$Dynamic" HDyn :: !catched_types
+				| _ -> Type.iter find_meta e
+				)
+			in
+			List.iter (fun (_,texpr) -> Type.iter find_meta texpr) catches;
+			List.iter (fun gt -> op ctx (OCatch gt)) (List.rev !catched_types);
+		end;
 		let tret = to_type ctx e.etype in
 		let result = alloc_tmp ctx tret in
 		let r = eval_expr ctx etry in
@@ -3503,7 +3524,7 @@ let generate_static ctx c f =
 			| (Meta.HlNative,[(EConst(String(lib,_)),_)] ,_ ) :: _ ->
 				add_native lib f.cf_name
 			| (Meta.HlNative,[(EConst(Float(ver,_)),_)] ,_ ) :: _ ->
-				if ctx.hl_ver < ver then
+				if compare_version ctx.hl_ver (ver ^ ".0") < 0 then
 					let gen_content() =
 						op ctx (OThrow (make_string ctx ("Requires compiling with -D hl-ver=" ^ ver ^ ".0 or higher") null_pos));
 					in
@@ -4176,9 +4197,10 @@ let create_context com =
 		| TAbstractDecl a -> a
 		| _ -> die "" __LOC__
 	in
+	let hl_ver = Gctx.defined_value_safe ~default:"" com Define.HlVer in
 	let ctx = {
 		com = com;
-		hl_ver = Gctx.defined_value_safe ~default:"" com Define.HlVer;
+		hl_ver = hl_ver;
 		optimize = not (Gctx.raw_defined com "hl_no_opt");
 		w_null_compare = Gctx.raw_defined com "hl_w_null_compare";
 		num_domains = Domain.recommended_domain_count ();
@@ -4206,7 +4228,13 @@ let create_context com =
 			ai32 = get_class "ArrayBytes_Int";
 			af32 = get_class "ArrayBytes_hl_F32";
 			af64 = get_class "ArrayBytes_Float";
-			ai64 = if Gctx.raw_defined com "hl_legacy32" then None else Some (get_class "ArrayBytes_hl_I64");
+			ai64 =
+				if Gctx.raw_defined com "hl_legacy32"
+					|| hl_ver <> "" && compare_version hl_ver "1.13.0" < 0
+				then
+					None
+				else
+					Some (get_class "ArrayBytes_hl_I64");
 		};
 		base_class = get_class "Class";
 		base_enum = get_class "Enum";

+ 11 - 9
src/generators/hl2c.ml

@@ -1027,15 +1027,15 @@ let generate_function gctx ctx f =
 		| OGetMem (r,b,idx) ->
 			sexpr "%s = *(%s*)(%s + %s)" (reg r) (ctype (rtype r)) (reg b) (reg idx)
 		| OGetArray (r, arr, idx) ->
-            (match rtype arr with
-            | HAbstract _ ->
-                (match rtype r with
-                | HStruct _ | HObj _ ->
-			        sexpr "%s = ((%s)%s) + %s" (reg r) (ctype (rtype r)) (reg arr) (reg idx)
-                | _ ->
-			        sexpr "%s = ((%s*)%s)[%s]" (reg r) (ctype (rtype r)) (reg arr) (reg idx))
-            | _ ->
-			    sexpr "%s = ((%s*)(%s + 1))[%s]" (reg r) (ctype (rtype r)) (reg arr) (reg idx))
+			(match rtype arr with
+			| HAbstract _ ->
+				(match rtype r with
+				| HStruct _ | HObj _ ->
+					sexpr "%s = ((%s)%s) + %s" (reg r) (ctype (rtype r)) (reg arr) (reg idx)
+				| _ ->
+					sexpr "%s = ((%s*)%s)[%s]" (reg r) (ctype (rtype r)) (reg arr) (reg idx))
+			| _ ->
+				sexpr "%s = ((%s*)(%s + 1))[%s]" (reg r) (ctype (rtype r)) (reg arr) (reg idx))
 		| OSetUI8 (b,idx,r) ->
 			sexpr "*(unsigned char*)(%s + %s) = (unsigned char)%s" (reg b) (reg idx) (reg r)
 		| OSetUI16 (b,idx,r) ->
@@ -1149,6 +1149,8 @@ let generate_function gctx ctx f =
 			sexpr "__hl_prefetch_m%d(%s)" mode expr
 		| OAsm _ ->
 			sexpr "UNSUPPORTED ASM OPCODE";
+		| OCatch _ ->
+			()
 	) f.code;
 	flush_options (Array.length f.code);
 	unblock();

+ 5 - 2
src/generators/hlcode.ml

@@ -203,7 +203,8 @@ type opcode =
 	| ORefOffset of reg * reg * reg
 	| ONop of string
 	| OPrefetch of reg * field index * int
-    | OAsm of int * int * reg
+	| OAsm of int * int * reg
+	| OCatch of global
 
 type fundecl = {
 	fpath : string * string;
@@ -602,7 +603,7 @@ let ostr fstr o =
 	| ONop s -> if s = "" then "nop" else "nop " ^ s
 	| OPrefetch (r,f,mode) -> Printf.sprintf "prefetch %d[%d] %d" r f mode
 	| OAsm (mode, value, reg) ->
-		match mode with
+		(match mode with
 		| 0 when reg = 0 ->
 			Printf.sprintf "asm %.2X" value
 		| 1 when reg = 0 ->
@@ -613,6 +614,8 @@ let ostr fstr o =
 			Printf.sprintf "asm %d := R%d" (reg - 1) value
 		| _ ->
 			Printf.sprintf "asm[%d] %d%s" mode value (if reg = 0 then "" else ", " ^ string_of_int (reg-1))
+		)
+	| OCatch g -> Printf.sprintf "catch %d" g
 
 let fundecl_name f = if snd f.fpath = "" then "fun$" ^ (string_of_int f.findex) else (fst f.fpath) ^ "." ^ (snd f.fpath)
 

+ 4 - 2
src/generators/hlinterp.ml

@@ -1156,7 +1156,7 @@ let interp ctx f args =
 			| _ -> Globals.die "" __LOC__)
 		| OAsm _ ->
 			throw_msg ctx "Unsupported ASM"
-		| ONop _ | OPrefetch _ ->
+		| ONop _ | OPrefetch _ | OCatch _ ->
 			()
 		);
 		loop()
@@ -2448,7 +2448,7 @@ let check comerror code =
 				(match rtype a with HAbstract ("hl_carray",_) | HArray _ -> () | _ -> reg a (HArray HDyn));
 				reg i HI32;
 				ignore(rtype v);
-            | OUnsafeCast (a,b) | OSafeCast (a,b) ->
+			| OUnsafeCast (a,b) | OSafeCast (a,b) ->
 				ignore(rtype a);
 				ignore(rtype b);
 			| OArraySize (r,a) ->
@@ -2540,6 +2540,8 @@ let check comerror code =
 				if f = 0 then ignore(rtype r) else ignore(tfield r (f - 1) false)
 			| OAsm (_,_,r) ->
 				if r > 0 then ignore(rtype (r - 1))
+			| OCatch _ ->
+				()
 		) f.code
 		(* TODO : check that all path correctly initialize NULL values and reach a return *)
 	in

+ 10 - 6
src/generators/hlopt.ml

@@ -170,12 +170,14 @@ let opcode_fx frw op =
 		()
 	| OPrefetch (r,_,_) ->
 		read r
-    | OAsm (_,_,r) ->
-        if r > 0 then begin
-            (* assume both *)
-            read (r - 1);
-            write (r - 1);
-        end
+	| OAsm (_,_,r) ->
+		if r > 0 then begin
+			(* assume both *)
+			read (r - 1);
+			write (r - 1);
+		end
+	| OCatch _ ->
+		()
 
 let opcode_eq a b =
 	match a, b with
@@ -452,6 +454,8 @@ let opcode_map read write op =
 	| OAsm (mode, value, r) ->
 		let r2 = read (r - 1) in
 		OAsm (mode, value, (write r2) + 1)
+	| OCatch _ ->
+		op
 
 (* build code graph *)
 

+ 24 - 18
src/optimization/optimizerTexpr.ml

@@ -220,24 +220,30 @@ let optimize_unop e op flag esub =
 		| _ -> false
 	in
 	match op, esub.eexpr with
-		| Not, (TConst (TBool f) | TParenthesis({eexpr = TConst (TBool f)})) -> { e with eexpr = TConst (TBool (not f)) }
-		| Not, (TBinop(op,e1,e2) | TParenthesis({eexpr = TBinop(op,e1,e2)})) ->
-			begin
-				let is_int = is_int e1.etype && is_int e2.etype in
-				try
-					let op = match is_int, op with
-						| true, OpGt -> OpLte
-						| true, OpGte -> OpLt
-						| true, OpLt -> OpGte
-						| true, OpLte -> OpGt
-						| _, OpEq -> OpNotEq
-						| _, OpNotEq -> OpEq
-						| _ -> raise Exit
-					in
-					{e with eexpr = TBinop(op,e1,e2)}
-				with Exit ->
-					e
-			end
+		| Not, _ ->
+			let rec transform e esub = match esub.eexpr with
+				| TConst (TBool f) -> { e with eexpr = TConst (TBool (not f)) }
+				| TBinop(op,e1,e2) ->
+					let is_int = is_int e1.etype && is_int e2.etype in
+					(try
+						let op = match is_int, op with
+							| true, OpGt -> OpLte
+							| true, OpGte -> OpLt
+							| true, OpLt -> OpGte
+							| true, OpLte -> OpGt
+							| _, OpEq -> OpNotEq
+							| _, OpNotEq -> OpEq
+							| _ -> raise Exit
+						in
+						{e with eexpr = TBinop(op,e1,e2)}
+					with Exit ->
+						e
+					)
+				| TParenthesis(e1) -> transform e e1
+				| TMeta(m, e1) -> { e with eexpr = TMeta (m, transform { e1 with eexpr = TUnop(op,flag,e1) } e1 ) }
+				| _ -> e
+			in
+			transform e esub
 		| Neg, TConst (TInt i) -> { e with eexpr = TConst (TInt (Int32.neg i)) }
 		| NegBits, TConst (TInt i) -> { e with eexpr = TConst (TInt (Int32.lognot i)) }
 		| Neg, TConst (TFloat f) ->

+ 1 - 1
src/typing/typer.ml

@@ -1495,7 +1495,7 @@ and type_if ctx e e1 e2 with_type is_ternary p =
 		| TConst TNull -> raise_typing_error "Cannot use null as ternary condition" e.epos
 		| _ -> ()
 	end;
-	let e = AbstractCast.cast_or_unify ctx ctx.t.tbool e p in
+	let e = AbstractCast.cast_or_unify ctx ctx.t.tbool e e.epos in
 	let e1 = type_expr ctx (Expr.ensure_block e1) with_type in
 	match e2 with
 	| None ->

+ 1 - 1
std/hl/types/ArrayBase.hx

@@ -149,7 +149,7 @@ class ArrayBase extends ArrayAccess {
 		return a;
 	}
 
-	#if !hl_legacy32
+	#if (hl_ver >= version("1.13.0") && !hl_legacy32)
 	public static function allocI64(bytes:BytesAccess<I64>, length:Int) @:privateAccess {
 		var a:ArrayBytes.ArrayI64 = untyped $new(ArrayBytes.ArrayI64);
 		a.length = length;

+ 1 - 1
std/hl/types/ArrayBytes.hx

@@ -362,6 +362,6 @@ typedef ArrayI32 = ArrayBytes<Int>;
 typedef ArrayUI16 = ArrayBytes<UI16>;
 typedef ArrayF32 = ArrayBytes<F32>;
 typedef ArrayF64 = ArrayBytes<Float>;
-#if !hl_legacy32
+#if (hl_ver >= version("1.13.0") && !hl_legacy32)
 typedef ArrayI64 = ArrayBytes<I64>;
 #end

+ 5 - 0
tests/misc/projects/Issue12355/Main.hx

@@ -0,0 +1,5 @@
+function main() {
+	if ("") {
+		trace("!");
+	}
+}

+ 2 - 0
tests/misc/projects/Issue12355/compile-fail.hxml

@@ -0,0 +1,2 @@
+--main Main
+--interp

+ 1 - 0
tests/misc/projects/Issue12355/compile-fail.hxml.stderr

@@ -0,0 +1 @@
+Main.hx:2: characters 6-8 : String should be Bool

+ 11 - 5
tests/runci/targets/Hl.hx

@@ -39,15 +39,17 @@ class Hl {
 			case "Linux":
 				Linux.requireAptPackages(["libpng-dev", "libjpeg-turbo8-dev", "libturbojpeg", "zlib1g-dev", "libvorbis-dev", "libsqlite3-dev"]);
 			case "Mac":
-				runNetworkCommand("brew", ["update", '--auto-update']);
-				runNetworkCommand("brew", ["bundle", '--file=${hlSrc}/Brewfile']);
 			case "Windows":
 				//pass
 		}
 
 		FileSystem.createDirectory(hlBuild);
-		final generator = systemName == "Windows" ? ["-DCMAKE_SYSTEM_VERSION=10.0.19041.0"] : ["-GNinja"];
-		runCommand("cmake", generator.concat([
+		final args = systemName == "Windows" ? ["-DCMAKE_SYSTEM_VERSION=10.0.19041.0"] : ["-GNinja"];
+		if (systemName == "Mac") {
+			args.push("-DDOWNLOAD_DEPENDENCIES=ON");
+			args.push("-DCMAKE_OSX_ARCHITECTURES=x86_64");
+		}
+		runCommand("cmake", args.concat([
 			"-DBUILD_TESTING=OFF",
 			"-DWITH_DIRECTX=OFF",
 			"-DWITH_FMT=ON",
@@ -86,7 +88,11 @@ class Hl {
 			return;
 
 		final compiler = if (systemName == "Mac") "clang" else "gcc";
-		final extraCompilerFlags = if (systemName == "Windows") ["-ldbghelp", "-municode"] else [];
+		final extraCompilerFlags = switch (systemName) {
+			case "Windows": ["-ldbghelp", "-municode"];
+			case "Mac": ["-arch", "x86_64"];
+			case _: [];
+		};
 
 		runCommand(compiler, [
 			"-o", '$dir/$filename.exe',

+ 1 - 1
tests/unit/src/unit/issues/Issue12047.hx

@@ -3,7 +3,7 @@ package unit.issues;
 import utest.Assert;
 
 class Issue12047 extends Test {
-	static function test() {
+	function test() {
 		try {
 			throwCatchWrap();
 		} catch (err:Issue12047) {

+ 2 - 1
tests/unit/src/unit/issues/Issue6059.hx

@@ -3,9 +3,10 @@ package unit.issues;
 class Issue6059 extends Test {
 	public static inline function foo (name : B, ?id : B, data : Array<String>) : Void { }
 
-	public static function test () : Void {
+	function test () : Void {
 		Issue6059.foo ("", []); // -> stackoverflow
 		Issue6059.foo ("", null, []); // ok
+		utest.Assert.pass();
 	}
 }