Browse Source

Merge branch 'development' into bugfix/8631-eval-statics-reset

Aleksandr Kuzmenko 6 years ago
parent
commit
a64c78074e
53 changed files with 215 additions and 143 deletions
  1. 4 4
      src/codegen/dotnet.ml
  2. 2 2
      src/codegen/genxml.ml
  3. 10 10
      src/codegen/java.ml
  4. 5 5
      src/codegen/swfLoader.ml
  5. 1 1
      src/compiler/server.ml
  6. 1 1
      src/context/display/deprecationCheck.ml
  7. 1 1
      src/context/display/displayFields.ml
  8. 11 2
      src/core/ast.ml
  9. 1 1
      src/core/texpr.ml
  10. 1 1
      src/core/type.ml
  11. 3 3
      src/filters/filters.ml
  12. 4 4
      src/generators/genas3.ml
  13. 3 3
      src/generators/gencpp.ml
  14. 6 6
      src/generators/gencs.ml
  15. 7 7
      src/generators/genhl.ml
  16. 3 3
      src/generators/genhxold.ml
  17. 8 8
      src/generators/genjava.ml
  18. 3 3
      src/generators/genjs.ml
  19. 1 1
      src/generators/genjvm.ml
  20. 6 6
      src/generators/genlua.ml
  21. 9 9
      src/generators/genpy.ml
  22. 7 7
      src/generators/genswf.ml
  23. 5 5
      src/generators/genswf9.ml
  24. 1 1
      src/macro/eval/evalDebugMisc.ml
  25. 1 0
      src/macro/eval/evalEncode.ml
  26. 1 0
      src/macro/eval/evalHash.ml
  27. 1 1
      src/macro/eval/evalMain.ml
  28. 17 2
      src/macro/macroApi.ml
  29. 4 4
      src/syntax/grammar.mly
  30. 2 2
      src/syntax/lexer.ml
  31. 1 1
      src/syntax/parser.ml
  32. 3 3
      src/syntax/parserEntry.ml
  33. 7 5
      src/syntax/reification.ml
  34. 3 3
      src/typing/fields.ml
  35. 1 1
      src/typing/generic.ml
  36. 1 1
      src/typing/macroContext.ml
  37. 2 2
      src/typing/magicTypes.ml
  38. 2 2
      src/typing/typeload.ml
  39. 1 1
      src/typing/typeloadCheck.ml
  40. 3 3
      src/typing/typeloadFields.ml
  41. 3 3
      src/typing/typeloadModule.ml
  42. 3 3
      src/typing/typer.ml
  43. 3 3
      src/typing/typerBase.ml
  44. 3 1
      std/cpp/ConstPointer.hx
  45. 2 0
      std/cpp/Pointer.hx
  46. 6 1
      std/haxe/macro/Expr.hx
  47. 12 0
      tests/server/src/Main.hx
  48. 5 0
      tests/server/test/templates/issues/Issue8368/Main.hx
  49. 8 0
      tests/server/test/templates/issues/Issue8368/MyMacro.hx
  50. 5 0
      tests/server/test/templates/issues/Issue8368/Type1.hx
  51. 5 0
      tests/server/test/templates/issues/Issue8368/Type2.hx
  52. 2 2
      tests/unit/src/unit/TestMatch.hx
  53. 5 5
      tests/unit/src/unitstd/haxe/macro/ExprTools.unit.hx

+ 4 - 4
src/codegen/dotnet.ml

@@ -248,7 +248,7 @@ let enum_is_flag ilcls =
 
 let convert_ilenum ctx p ?(is_flag=false) ilcls =
 	let meta = ref [
-		Meta.Native, [EConst (String (ilpath_s ilcls.cpath) ), p], p;
+		Meta.Native, [EConst (String (ilpath_s ilcls.cpath,SDoubleQuotes) ), p], p;
 		Meta.CsNative, [], p;
 	] in
 
@@ -332,7 +332,7 @@ let convert_ilfield ctx p field =
 		if String.get cff_name 0 = '%' then
 			let name = (String.sub cff_name 1 (String.length cff_name - 1)) in
 			"_" ^ name,
-			(Meta.Native, [EConst (String (name) ), cff_pos], cff_pos) :: !cff_meta
+			(Meta.Native, [EConst (String (name,SDoubleQuotes) ), cff_pos], cff_pos) :: !cff_meta
 		else
 			cff_name, !cff_meta
 	in
@@ -485,7 +485,7 @@ let convert_ilmethod ctx p m is_explicit_impl =
 		if String.get cff_name 0 = '%' then
 			let name = (String.sub cff_name 1 (String.length cff_name - 1)) in
 			"_" ^ name,
-			(Meta.Native, [EConst (String (name) ), cff_pos], cff_pos) :: meta
+			(Meta.Native, [EConst (String (name,SDoubleQuotes) ), cff_pos], cff_pos) :: meta
 		else
 			cff_name, meta
 	in
@@ -719,7 +719,7 @@ let convert_ilclass ctx p ?(delegate=false) ilcls = match ilcls.csuper with
 			let sup = sup @ List.map (fun i -> IlMetaDebug.ilsig_s i.ssig) ilcls.cimplements in
 			print_endline ("converting " ^ ilpath_s ilcls.cpath ^ " : " ^ (String.concat ", " sup))
 		end;
-		let meta = ref [Meta.CsNative, [], p; Meta.Native, [EConst (String (ilpath_s ilcls.cpath) ), p], p] in
+		let meta = ref [Meta.CsNative, [], p; Meta.Native, [EConst (String (ilpath_s ilcls.cpath,SDoubleQuotes) ), p], p] in
 		let force_check = Common.defined ctx.ncom Define.ForceLibCheck in
 		if not force_check then
 			meta := (Meta.LibType,[],p) :: !meta;

+ 2 - 2
src/codegen/genxml.ml

@@ -60,7 +60,7 @@ let gen_arg_name (name,opt,_) =
 let real_path path meta =
 	let rec loop = function
 		| [] -> path
-		| (Meta.RealPath,[(Ast.EConst (Ast.String s),_)],_) :: _ -> parse_path s
+		| (Meta.RealPath,[(Ast.EConst (Ast.String(s,_)),_)],_) :: _ -> parse_path s
 		| _ :: l -> loop l
 	in
 	loop meta
@@ -165,7 +165,7 @@ and gen_field att f =
 	let field_name cf =
 		try
 			begin match Meta.get Meta.RealPath cf.cf_meta with
-				| _,[EConst (String (s)),_],_ -> s
+				| _,[EConst (String (s,_)),_],_ -> s
 				| _ -> raise Not_found
 			end;
 		with Not_found ->

+ 10 - 10
src/codegen/java.ml

@@ -171,7 +171,7 @@ and convert_signature ctx p jsig =
 
 let convert_constant ctx p const =
 	Option.map_default (function
-		| ConstString s -> Some (EConst (String s), p)
+		| ConstString s -> Some (EConst (String(s,SDoubleQuotes)), p)
 		| ConstInt i -> Some (EConst (Int (Printf.sprintf "%ld" i)), p)
 		| ConstFloat f | ConstDouble f -> Some (EConst (Float (Printf.sprintf "%E" f)), p)
 		| _ -> None) None const
@@ -217,7 +217,7 @@ let del_override field =
 	{ field with jf_attributes = List.filter (fun a -> not (is_override_attrib a)) field.jf_attributes }
 
 let get_canonical ctx p pack name =
-	(Meta.JavaCanonical, [EConst (String (String.concat "." pack)), p; EConst (String name), p], p)
+	(Meta.JavaCanonical, [EConst (String (String.concat "." pack,SDoubleQuotes)), p; EConst (String (name,SDoubleQuotes)), p], p)
 
 let show_in_completion ctx jc =
 	if not ctx.is_std then true
@@ -226,7 +226,7 @@ let show_in_completion ctx jc =
 		| _ -> false
 
 let convert_java_enum ctx p pe =
-	let meta = ref (get_canonical ctx p (fst pe.cpath) (snd pe.cpath) :: [Meta.Native, [EConst (String (real_java_path ctx pe.cpath) ), p], p ]) in
+	let meta = ref (get_canonical ctx p (fst pe.cpath) (snd pe.cpath) :: [Meta.Native, [EConst (String (real_java_path ctx pe.cpath,SDoubleQuotes) ), p], p ]) in
 	let data = ref [] in
 	List.iter (fun f ->
 		(* if List.mem JEnum f.jf_flags then *)
@@ -303,7 +303,7 @@ let convert_java_enum ctx p pe =
 		List.iter (fun jsig ->
 			match convert_signature ctx p jsig with
 				| CTPath path ->
-					cff_meta := (Meta.Throws, [Ast.EConst (Ast.String (s_type_path (path.tpackage,path.tname))), p],p) :: !cff_meta
+					cff_meta := (Meta.Throws, [Ast.EConst (Ast.String (s_type_path (path.tpackage,path.tname),SDoubleQuotes)), p],p) :: !cff_meta
 				| _ -> ()
 		) field.jf_throws;
 
@@ -358,17 +358,17 @@ let convert_java_enum ctx p pe =
 					let name = (String.sub cff_name 1 (String.length cff_name - 1)) in
 					if not (is_haxe_keyword name) then
 						cff_meta := (Meta.Deprecated, [EConst(String(
-							"This static field `_" ^ name ^ "` is deprecated and will be removed in later versions. Please use `" ^ name ^ "` instead")
+							"This static field `_" ^ name ^ "` is deprecated and will be removed in later versions. Please use `" ^ name ^ "` instead",SDoubleQuotes)
 						),p], p) :: !cff_meta;
 					"_" ^ name,
-					(Meta.Native, [EConst (String (name) ), cff_pos], cff_pos) :: !cff_meta
+					(Meta.Native, [EConst (String (name,SDoubleQuotes) ), cff_pos], cff_pos) :: !cff_meta
 				| _ ->
 					match String.nsplit cff_name "$" with
 						| [ no_dollar ] ->
 							cff_name, !cff_meta
 						| parts ->
 							String.concat "_" parts,
-							(Meta.Native, [EConst (String (cff_name) ), cff_pos], cff_pos) :: !cff_meta
+							(Meta.Native, [EConst (String (cff_name,SDoubleQuotes) ), cff_pos], cff_pos) :: !cff_meta
 		in
 		if PMap.mem "java_loader_debug" ctx.jcom.defines.Define.values then
 			Printf.printf "\t%s%sfield %s : %s\n" (if List.mem_assoc AStatic !cff_access then "static " else "") (if List.mem_assoc AOverride !cff_access then "override " else "") cff_name (s_sig field.jf_signature);
@@ -417,7 +417,7 @@ let convert_java_enum ctx p pe =
 				print_endline ("converting " ^ (if List.mem JAbstract jc.cflags then "abstract " else "") ^ JData.path_s jc.cpath ^ " : " ^ (String.concat ", " (List.map s_sig sup)));
 			end;
 			(* todo: instead of JavaNative, use more specific definitions *)
-			let meta = ref [Meta.JavaNative, [], p; Meta.Native, [EConst (String (real_java_path ctx jc.cpath) ), p], p; get_canonical ctx p (fst jc.cpath) (snd jc.cpath)] in
+			let meta = ref [Meta.JavaNative, [], p; Meta.Native, [EConst (String (real_java_path ctx jc.cpath,SDoubleQuotes) ), p], p; get_canonical ctx p (fst jc.cpath) (snd jc.cpath)] in
 			let force_check = Common.defined ctx.jcom Define.ForceLibCheck in
 			if not force_check then
 				meta := (Meta.LibType,[],p) :: !meta;
@@ -912,11 +912,11 @@ class virtual java_library com name file_path = object(self)
 		Hashtbl.find hxpack_to_jpack path
 
 	method private replace_canonical_name p pack name_original name_replace decl =
-		let mk_meta name = (Meta.JavaCanonical, [EConst (String (String.concat "." pack)), p; EConst(String name), p], p) in
+		let mk_meta name = (Meta.JavaCanonical, [EConst (String (String.concat "." pack,SDoubleQuotes)), p; EConst(String (name,SDoubleQuotes)), p], p) in
 		let add_meta name metas =
 			if Meta.has Meta.JavaCanonical metas then
 				List.map (function
-					| (Meta.JavaCanonical,[EConst (String cpack), _; EConst(String cname), _],_) ->
+					| (Meta.JavaCanonical,[EConst (String(cpack,_)), _; EConst(String(cname,_)), _],_) ->
 						let did_replace,name = String.replace cname name_original name_replace in
 						if not did_replace then print_endline (cname ^ " -> " ^ name_original ^ " -> " ^ name_replace);
 						mk_meta name

+ 5 - 5
src/codegen/swfLoader.ml

@@ -194,10 +194,10 @@ let build_class com c file =
 				(match ns with
 				| HNPrivate _ | HNNamespace "http://www.adobe.com/2006/flex/mx/internal" -> []
 				| HNNamespace ns ->
-					if not (c.hlc_interface || is_xml) then meta := (Meta.Ns,[String ns]) :: !meta;
+					if not (c.hlc_interface || is_xml) then meta := (Meta.Ns,[String(ns,SDoubleQuotes)]) :: !meta;
 					[APublic,null_pos]
 				| HNInternal (Some ns) ->
-					if not (c.hlc_interface || is_xml) then meta := (Meta.Ns,[String ns; Ident "internal"]) :: !meta;
+					if not (c.hlc_interface || is_xml) then meta := (Meta.Ns,[String(ns,SDoubleQuotes); Ident "internal"]) :: !meta;
 					[APublic,null_pos]
 				| HNExplicit _ | HNInternal _ | HNPublic _ ->
 					[APublic,null_pos]
@@ -274,7 +274,7 @@ let build_class com c file =
 							| None -> None
 							| Some v ->
 								(* add for -D gen-hx-classes generation *)
-								meta := (Meta.DefParam,[String aname;v]) :: !meta;
+								meta := (Meta.DefParam,[String(aname,SDoubleQuotes);v]) :: !meta;
 								Some (EConst v,pos)
 					in
 					((aname,null_pos),!is_opt,[],Some (t,null_pos),def_val)
@@ -419,7 +419,7 @@ let build_class com c file =
 			d_name = path.tname,null_pos;
 			d_doc = None;
 			d_params = [];
-			d_meta = [(Meta.Enum,[],null_pos);(Meta.Native,[(EConst (String native_path),null_pos)],null_pos)];
+			d_meta = [(Meta.Enum,[],null_pos);(Meta.Native,[(EConst (String(native_path,SDoubleQuotes)),null_pos)],null_pos)];
 			d_flags = [AbExtern; AbOver (real_type,pos); AbFrom (real_type,pos)];
 			d_data = constr;
 		} in
@@ -432,7 +432,7 @@ let build_class com c file =
 		match c.hlc_name with
 		| HMPath (pack,name) when (pack <> [] && pack <> path.tpackage) ->
 			let native_path = (String.concat "." pack) ^ "." ^ name in
-			[(Meta.Native,[(EConst (String native_path), pos)],pos)]
+			[(Meta.Native,[(EConst (String(native_path,SDoubleQuotes)), pos)],pos)]
 		| _ ->
 			[]
 	in

+ 1 - 1
src/compiler/server.ml

@@ -433,7 +433,7 @@ let add_modules sctx ctx m p =
 					| TEnumDecl e ->
 						let rec loop acc = function
 							| [] -> ()
-							| (Meta.RealPath,[Ast.EConst (Ast.String path),_],_) :: l ->
+							| (Meta.RealPath,[Ast.EConst (Ast.String(path,_)),_],_) :: l ->
 								e.e_path <- Ast.parse_path path;
 								e.e_meta <- (List.rev acc) @ l;
 							| x :: l -> loop (x::acc) l

+ 1 - 1
src/context/display/deprecationCheck.ml

@@ -17,7 +17,7 @@ let warn_deprecation com s p_usage =
 
 let print_deprecation_message com meta s p_usage =
 	let s = match meta with
-		| _,[EConst(String s),_],_ -> s
+		| _,[EConst(String(s,_)),_],_ -> s
 		| _ -> Printf.sprintf "Usage of this %s is deprecated" s
 	in
 	warn_deprecation com s p_usage

+ 1 - 1
src/context/display/displayFields.ml

@@ -263,7 +263,7 @@ let collect ctx e_ast e dk with_type p =
 	in
 	(* Add special `.code` field if we have a string of length 1 *)
 	let items = match fst e_ast with
-		| EConst(String s) when String.length s = 1 ->
+		| EConst(String(s,_)) when String.length s = 1 ->
 			let cf = mk_field "code" ctx.t.tint e.epos null_pos in
 			cf.cf_doc <- Some "The character code of this character (inlined at compile-time).";
 			cf.cf_kind <- Var { v_read = AccNormal; v_write = AccNever };

+ 11 - 2
src/core/ast.ml

@@ -99,10 +99,15 @@ type unop =
 	| Neg
 	| NegBits
 
+type string_literal_kind =
+	| SDoubleQuotes
+	| SSingleQuotes
+	(* | SMarkup *)
+
 type constant =
 	| Int of string
 	| Float of string
-	| String of string
+	| String of string * string_literal_kind
 	| Ident of string
 	| Regexp of string * string
 
@@ -362,7 +367,11 @@ let parse_path s =
 let s_constant = function
 	| Int s -> s
 	| Float s -> s
-	| String s -> "\"" ^ StringHelper.s_escape s ^ "\""
+	| String(s,qs) ->
+		begin match qs with
+		| SDoubleQuotes -> "\"" ^ StringHelper.s_escape s ^ "\""
+		| SSingleQuotes -> "\"" ^ StringHelper.s_escape s ^ "\""
+		end
 	| Ident s -> s
 	| Regexp (r,o) -> "~/" ^ r ^ "/"
 

+ 1 - 1
src/core/texpr.ml

@@ -314,7 +314,7 @@ let type_constant basic c p =
 		(try mk (TConst (TInt (Int32.of_string s))) basic.tint p
 		with _ -> mk (TConst (TFloat s)) basic.tfloat p)
 	| Float f -> mk (TConst (TFloat f)) basic.tfloat p
-	| String s -> mk (TConst (TString s)) basic.tstring p
+	| String(s,qs) -> mk (TConst (TString s)) basic.tstring p (* STRINGTODO: qs? *)
 	| Ident "true" -> mk (TConst (TBool true)) basic.tbool p
 	| Ident "false" -> mk (TConst (TBool false)) basic.tbool p
 	| Ident "null" -> mk (TConst TNull) (basic.tnull (mk_mono())) p

+ 1 - 1
src/core/type.ml

@@ -906,7 +906,7 @@ let rec module_type_of_type = function
 let tconst_to_const = function
 	| TInt i -> Int (Int32.to_string i)
 	| TFloat s -> Float s
-	| TString s -> String s
+	| TString s -> String(s,SDoubleQuotes)
 	| TBool b -> Ident (if b then "true" else "false")
 	| TNull -> Ident "null"
 	| TThis -> Ident "this"

+ 3 - 3
src/filters/filters.ml

@@ -286,7 +286,7 @@ let rename_local_vars ctx reserved e =
 		reserve !name;
 		Hashtbl.replace count_table v.v_name !count;
 		if not (Meta.has Meta.RealPath v.v_meta) then
-			v.v_meta <- (Meta.RealPath,[EConst (String v.v_name),e.epos],e.epos) :: v.v_meta;
+			v.v_meta <- (Meta.RealPath,[EConst (String(v.v_name,SDoubleQuotes)),e.epos],e.epos) :: v.v_meta;
 		v.v_name <- !name;
 	in
 	List.iter maybe_rename (List.rev !vars);
@@ -487,11 +487,11 @@ let check_private_path ctx t = match t with
 let apply_native_paths ctx t =
 	let get_real_name meta name =
 		let name',p = get_native_name meta in
-		(Meta.RealPath,[Ast.EConst (Ast.String (name)), p], p), name'
+		(Meta.RealPath,[Ast.EConst (Ast.String (name,SDoubleQuotes)), p], p), name'
 	in
 	let get_real_path meta path =
 		let name,p = get_native_name meta in
-		(Meta.RealPath,[Ast.EConst (Ast.String (s_type_path path)), p], p), parse_path name
+		(Meta.RealPath,[Ast.EConst (Ast.String (s_type_path path,SDoubleQuotes)), p], p), parse_path name
 	in
 	try
 		(match t with

+ 4 - 4
src/generators/genas3.ml

@@ -1012,8 +1012,8 @@ let generate_field ctx static f =
 		| Meta.Meta, [Ast.ECall ((Ast.EConst (Ast.Ident n),_),args),_] ->
 			let mk_arg (a,p) =
 				match a with
-				| Ast.EConst (Ast.String s) -> (None, s)
-				| Ast.EBinop (Ast.OpAssign,(Ast.EConst (Ast.Ident n),_),(Ast.EConst (Ast.String s),_)) -> (Some n, s)
+				| Ast.EConst (Ast.String(s,_)) -> (None, s)
+				| Ast.EBinop (Ast.OpAssign,(Ast.EConst (Ast.Ident n),_),(Ast.EConst (Ast.String(s,_)),_)) -> (Some n, s)
 				| _ -> abort "Invalid meta definition" p
 			in
 			print ctx "[%s" n;
@@ -1064,8 +1064,8 @@ let generate_field ctx static f =
 			| TFun (args,r) when (match f.cf_kind with Method MethDynamic | Var _ -> false | _ -> true) ->
 				let rec loop = function
 					| [] -> f.cf_name
-					| (Meta.Getter,[Ast.EConst (Ast.String name),_],_) :: _ -> "get " ^ name
-					| (Meta.Setter,[Ast.EConst (Ast.String name),_],_) :: _ -> "set " ^ name
+					| (Meta.Getter,[Ast.EConst (Ast.String(name,_)),_],_) :: _ -> "get " ^ name
+					| (Meta.Setter,[Ast.EConst (Ast.String(name,_)),_],_) :: _ -> "set " ^ name
 					| _ :: l -> loop l
 				in
 				print ctx "function %s(" (loop f.cf_meta);

+ 3 - 3
src/generators/gencpp.ml

@@ -419,7 +419,7 @@ let join_class_path_remap path separator =
 let get_meta_string meta key =
    let rec loop = function
       | [] -> ""
-      | (k,[Ast.EConst (Ast.String name),_],_) :: _  when k=key-> name
+      | (k,[Ast.EConst (Ast.String(name,_)),_],_) :: _  when k=key-> name
       | _ :: l -> loop l
       in
    loop meta
@@ -430,7 +430,7 @@ let get_meta_string meta key =
 let get_meta_string_path meta key =
    let rec loop = function
       | [] -> ""
-      | (k,[Ast.EConst (Ast.String name),_], pos) :: _  when k=key->
+      | (k,[Ast.EConst (Ast.String(name,_)),_], pos) :: _  when k=key->
            (try
            if (String.sub name 0 2) = "./" then begin
               let base = if (Filename.is_relative pos.pfile) then
@@ -2169,7 +2169,7 @@ let cpp_var_name_of var =
 
 let cpp_var_debug_name_of v =
    let rec loop meta = match meta with
-      | (Meta.RealPath,[EConst (String s),_],_) :: _ -> s
+      | (Meta.RealPath,[EConst (String(s,_)),_],_) :: _ -> s
       | _ :: meta -> loop meta
       | [] -> v.v_name
    in

+ 6 - 6
src/generators/gencs.ml

@@ -1352,7 +1352,7 @@ let generate con =
 							do_call w e [v]
 					| TField (e, ((FStatic(_, cf) | FInstance(_, _, cf)) as f)) when Meta.has Meta.Native cf.cf_meta ->
 						let rec loop meta = match meta with
-							| (Meta.Native, [EConst (String s), _],_) :: _ ->
+							| (Meta.Native, [EConst (String(s,_)), _],_) :: _ ->
 								expr_s w e; write w "."; (get_write_field f) w s
 							| _ :: tl -> loop tl
 							| [] -> expr_s w e; write w "."; (get_write_field f) w (cf.cf_name)
@@ -1844,7 +1844,7 @@ let generate con =
 			| EConst c, p -> (match c with
 				| Int s | Float s | Ident s ->
 					write w s
-				| String s ->
+				| String(s,_) ->
 					write w "\"";
 					write w (escape s);
 					write w "\""
@@ -1880,7 +1880,7 @@ let generate con =
 
 		let gen_attributes w metadata =
 			List.iter (function
-				| Meta.Meta, [EConst(String s), _], _ ->
+				| Meta.Meta, [EConst(String(s,_)), _], _ ->
 					write w "[";
 					write w s;
 					write w "]";
@@ -2332,7 +2332,7 @@ let generate con =
 									end else
 										write_method_expr expr
 									)
-								| (Meta.FunctionCode, [Ast.EConst (Ast.String contents),_],_) :: tl ->
+								| (Meta.FunctionCode, [Ast.EConst (Ast.String(contents,_)),_],_) :: tl ->
 									begin_block w;
 									write w contents;
 									end_block w
@@ -2540,7 +2540,7 @@ let generate con =
 				in
 				let tparams = loop (match m with [(EConst(Int s),_)] -> int_of_string s | _ -> assert false) [] in
 				cl.cl_meta <- (Meta.Meta, [
-					EConst(String("global::haxe.lang.GenericInterface(typeof(global::" ^ module_s (TClassDecl cl) ^ "<" ^ String.concat ", " tparams ^ ">))") ), cl.cl_pos
+					EConst(String("global::haxe.lang.GenericInterface(typeof(global::" ^ module_s (TClassDecl cl) ^ "<" ^ String.concat ", " tparams ^ ">))",SDoubleQuotes) ), cl.cl_pos
 				], cl.cl_pos) :: cl.cl_meta
 			with Not_found ->
 				());
@@ -2595,7 +2595,7 @@ let generate con =
 			let rec loop meta =
 				match meta with
 					| [] -> ()
-					| (Meta.ClassCode, [Ast.EConst (Ast.String contents),_],_) :: tl ->
+					| (Meta.ClassCode, [Ast.EConst (Ast.String(contents,_)),_],_) :: tl ->
 						write w contents
 					| _ :: tl -> loop tl
 			in

+ 7 - 7
src/generators/genhl.ml

@@ -419,7 +419,7 @@ let rec to_type ?tref ctx t =
 		HDyn
 	| TEnum (e,_) ->
 		enum_type ~tref ctx e
-	| TInst ({ cl_path = ["hl"],"Abstract" },[TInst({ cl_kind = KExpr (EConst (String name),_) },_)]) ->
+	| TInst ({ cl_path = ["hl"],"Abstract" },[TInst({ cl_kind = KExpr (EConst (String(name,_)),_) },_)]) ->
 		HAbstract (name, alloc_string ctx name)
 	| TInst (c,pl) ->
 		(match c.cl_kind with
@@ -966,7 +966,7 @@ let captured_index ctx v =
 let real_name v =
 	let rec loop = function
 		| [] -> v.v_name
-		| (Meta.RealPath,[EConst (String name),_],_) :: _ -> name
+		| (Meta.RealPath,[EConst (String(name,_)),_],_) :: _ -> name
 		| _ :: l -> loop l
 	in
 	match loop v.v_meta with
@@ -3286,9 +3286,9 @@ let generate_static ctx c f =
 			));
 		in
 		let rec loop = function
-			| (Meta.HlNative,[(EConst(String(lib)),_);(EConst(String(name)),_)] ,_ ) :: _ ->
+			| (Meta.HlNative,[(EConst(String(lib,_)),_);(EConst(String(name,_)),_)] ,_ ) :: _ ->
 				add_native lib name
-			| (Meta.HlNative,[(EConst(String(lib)),_)] ,_ ) :: _ ->
+			| (Meta.HlNative,[(EConst(String(lib,_)),_)] ,_ ) :: _ ->
 				add_native lib f.cf_name
 			| (Meta.HlNative,[(EConst(Float(ver)),_)] ,_ ) :: _ ->
 				let cur_ver = (try Common.raw_defined_value ctx.com "hl-ver" with Not_found -> "") in
@@ -3985,8 +3985,8 @@ let add_types ctx types =
 			List.iter (fun (m,args,p) ->
 				if m = Meta.HlNative then
 					let lib, prefix = (match args with
-					| [(EConst (String lib),_)] -> lib, ""
-					| [(EConst (String lib),_);(EConst (String p),_)] -> lib, p
+					| [(EConst (String(lib,_)),_)] -> lib, ""
+					| [(EConst (String(lib,_)),_);(EConst (String(p,_)),_)] -> lib, p
 					| _ -> abort "hlNative on class requires library name" p
 					) in
 					(* adds :hlNative for all empty methods *)
@@ -3996,7 +3996,7 @@ let add_types ctx types =
 							(match f.cf_expr with
 							| Some { eexpr = TFunction { tf_expr = { eexpr = TBlock ([] | [{ eexpr = TReturn (Some { eexpr = TConst _ })}]) } } } | None ->
 								let name = prefix ^ String.lowercase (Str.global_replace (Str.regexp "[A-Z]+") "_\\0" f.cf_name) in
-								f.cf_meta <- (Meta.HlNative, [(EConst (String lib),p);(EConst (String name),p)], p) :: f.cf_meta;
+								f.cf_meta <- (Meta.HlNative, [(EConst (String(lib,SDoubleQuotes)),p);(EConst (String(name,SDoubleQuotes)),p)], p) :: f.cf_meta;
 							| _ -> ())
 						| _ -> ()
 					) c.cl_ordered_statics

+ 3 - 3
src/generators/genhxold.ml

@@ -39,7 +39,7 @@ let conv_path p =
 let get_real_path meta path =
 	try
 		let real_path = match Meta.get Meta.RealPath meta with
-			| (_,[(EConst(String s),_)],_) ->
+			| (_,[(EConst(String(s,_)),_)],_) ->
 				s
 			| _ -> raise Not_found
 		in
@@ -156,7 +156,7 @@ let generate_type com t =
 		if not (has_class_field_flag f CfPublic) then p "private ";
 		if stat then p "static ";
 		let name = try (match Meta.get Meta.RealPath f.cf_meta with
-				| (Meta.RealPath, [EConst( String s ), _], _) ->
+				| (Meta.RealPath, [EConst( String(s,_) ), _], _) ->
 					s
 				| _ ->
 					raise Not_found)
@@ -178,7 +178,7 @@ let generate_type com t =
 					List.map (fun (a,o,t) ->
 						let rec loop = function
 							| [] -> Ident "null"
-							| (Meta.DefParam,[(EConst (String p),_);(EConst v,_)],_) :: _ when p = a ->
+							| (Meta.DefParam,[(EConst (String(p,_)),_);(EConst v,_)],_) :: _ when p = a ->
 								(match v with
 								| Float "1.#QNAN" -> Float "0./*NaN*/"
 								| Float "4294967295." -> Int "0xFFFFFFFF"

+ 8 - 8
src/generators/genjava.ml

@@ -861,7 +861,7 @@ let rec handle_throws gen cf =
 	match cf.cf_expr with
 	| Some ({ eexpr = TFunction(tf) } as e)  ->
 		let rec collect_throws acc = function
-			| (Meta.Throws, [Ast.EConst (Ast.String path), _],_) :: meta -> (try
+			| (Meta.Throws, [Ast.EConst (Ast.String(path,_)), _],_) :: meta -> (try
 				collect_throws (get_cl ( get_type gen (parse_path path)) :: acc) meta
 			with | Not_found | TypeNotFound _ ->
 				collect_throws acc meta)
@@ -1093,7 +1093,7 @@ let generate con =
 
 	let path_s path meta = try
 		match Meta.get Meta.JavaCanonical meta with
-			| (Meta.JavaCanonical, [EConst(String pack), _; EConst(String name), _], _) ->
+			| (Meta.JavaCanonical, [EConst(String(pack,_)), _; EConst(String(name,_)), _], _) ->
 				if pack = "" then
 					name
 				else
@@ -1504,7 +1504,7 @@ let generate con =
 					write w " )"
 				| TField (e, FStatic(_, cf)) when Meta.has Meta.Native cf.cf_meta ->
 					let rec loop meta = match meta with
-						| (Meta.Native, [EConst (String s), _],_) :: _ ->
+						| (Meta.Native, [EConst (String(s,_)), _],_) :: _ ->
 							expr_s w e; write w "."; write_field w s
 						| _ :: tl -> loop tl
 						| [] -> expr_s w e; write w "."; write_field w (cf.cf_name)
@@ -1825,7 +1825,7 @@ let generate con =
 		| EConst c, p -> (match c with
 			| Int s | Float s | Ident s ->
 				write w s
-			| String s ->
+			| String(s,_) ->
 				write w "\"";
 				write w (escape s);
 				write w "\""
@@ -2040,10 +2040,10 @@ let generate con =
 								end else begin
 									expr_s w expr;
 								end)
-							| (Meta.Throws, [Ast.EConst (Ast.String t), _], _) :: tl ->
+							| (Meta.Throws, [Ast.EConst (Ast.String(t,_)), _], _) :: tl ->
 								print w " throws %s" t;
 								loop tl
-							| (Meta.FunctionCode, [Ast.EConst (Ast.String contents),_],_) :: tl ->
+							| (Meta.FunctionCode, [Ast.EConst (Ast.String(contents,_)),_],_) :: tl ->
 								begin_block w;
 								write w contents;
 								end_block w
@@ -2071,7 +2071,7 @@ let generate con =
 
 		let rec loop_meta meta acc =
 			match meta with
-				| (Meta.SuppressWarnings, [Ast.EConst (Ast.String w),_],_) :: meta -> loop_meta meta (w :: acc)
+				| (Meta.SuppressWarnings, [Ast.EConst (Ast.String(w,_)),_],_) :: meta -> loop_meta meta (w :: acc)
 				| _ :: meta -> loop_meta meta acc
 				| _ -> acc
 		in
@@ -2145,7 +2145,7 @@ let generate con =
 		let rec loop meta =
 			match meta with
 				| [] -> ()
-				| (Meta.ClassCode, [Ast.EConst (Ast.String contents),_],_) :: tl ->
+				| (Meta.ClassCode, [Ast.EConst (Ast.String(contents,_)),_],_) :: tl ->
 					write w contents
 				| _ :: tl -> loop tl
 		in

+ 3 - 3
src/generators/genjs.ml

@@ -72,7 +72,7 @@ let get_exposed ctx path meta =
 	try
 		let (_, args, pos) = Meta.get Meta.Expose meta in
 		(match args with
-			| [ EConst (String s), _ ] -> [s]
+			| [ EConst (String(s,_)), _ ] -> [s]
 			| [] -> [path]
 			| _ -> abort "Invalid @:expose parameters" pos)
 	with Not_found -> []
@@ -1460,9 +1460,9 @@ let generate_require ctx path meta =
 		generate_package_create ctx path;
 
 	(match args with
-	| [(EConst(String(module_name)),_)] ->
+	| [(EConst(String(module_name,_)),_)] ->
 		print ctx "%s = require(\"%s\")" p module_name
-	| [(EConst(String(module_name)),_) ; (EConst(String(object_path)),_)] ->
+	| [(EConst(String(module_name,_)),_) ; (EConst(String(object_path,_)),_)] ->
 		print ctx "%s = require(\"%s\").%s" p module_name object_path
 	| _ ->
 		abort "Unsupported @:jsRequire format" mp);

+ 1 - 1
src/generators/genjvm.ml

@@ -299,7 +299,7 @@ module AnnotationHandler = struct
 		let rec parse_value e = match fst e with
 			| EConst (Int s) -> AInt (Int32.of_string s)
 			| EConst (Float s) -> ADouble (float_of_string s)
-			| EConst (String s) -> AString s
+			| EConst (String(s,_)) -> AString s
 			| EConst (Ident "true") -> ABool true
 			| EConst (Ident "false") -> ABool false
 			| EArrayDecl el -> AArray (List.map parse_value el)

+ 6 - 6
src/generators/genlua.ml

@@ -74,7 +74,7 @@ let flat_path (p,s) =
 let get_exposed ctx path meta = try
         let (_, args, pos) = Meta.get Meta.Expose meta in
         (match args with
-         | [ EConst (String s), _ ] -> [s]
+         | [ EConst (String(s,_)), _ ] -> [s]
          | [] -> [path]
          | _ -> error "Invalid @:expose parameters" pos)
     with Not_found -> []
@@ -687,7 +687,7 @@ and gen_expr ?(local=true) ctx e = begin
         (* field of a multireturn local var is actually just a local var *)
         let (_, args, pos) =  Meta.get (Meta.Custom ":lua_mr_id") v.v_meta  in
         (match args with
-         | [(EConst(String(id)), _)] ->
+         | [(EConst(String(id,_)), _)] ->
              spr ctx (id ^ "_" ^ (ident v.v_name) ^ "_" ^ (field_name f));
          | _ ->
              assert false);
@@ -772,7 +772,7 @@ and gen_expr ?(local=true) ctx e = begin
                 | _ when Meta.has Meta.MultiReturn v.v_meta ->
                     (* multi-return var is generated as several vars for unpacking *)
                     let id = temp ctx in
-                    let temp_expr = (EConst(String(id)), Globals.null_pos) in
+                    let temp_expr = (EConst(String(id,SDoubleQuotes)), Globals.null_pos) in
                     v.v_meta <- (Meta.Custom ":lua_mr_id", [temp_expr], v.v_pos) :: v.v_meta;
                     let name = ident v.v_name in
                     let names =
@@ -812,7 +812,7 @@ and gen_expr ?(local=true) ctx e = begin
          | Some cf when Meta.has Meta.Native cf.cf_meta ->
              let _, args, mp = Meta.get Meta.Native cf.cf_meta in
              (match args with
-              | [( EConst(String s),_)] ->
+              | [( EConst(String(s,_)),_)] ->
                   print ctx "%s.%s" (ctx.type_accessor (TClassDecl c)) s;
               | _ ->
                   print ctx "%s.new" (ctx.type_accessor (TClassDecl c)));
@@ -1791,9 +1791,9 @@ let generate_require ctx path meta =
     let p = (s_path ctx path) in
 
     (match args with
-     | [(EConst(String(module_name)),_)] ->
+     | [(EConst(String(module_name,_)),_)] ->
          print ctx "%s = _G.require(\"%s\")" p module_name
-     | [(EConst(String(module_name)),_) ; (EConst(String(object_path)),_)] ->
+     | [(EConst(String(module_name,_)),_) ; (EConst(String(object_path,_)),_)] ->
          print ctx "%s = _G.require(\"%s\").%s" p module_name object_path
      | _ ->
          error "Unsupported @:luaRequire format" mp);

+ 9 - 9
src/generators/genpy.ml

@@ -1104,7 +1104,7 @@ module Printer = struct
 	let print_base_type tp =
 		try
 			begin match Meta.get Meta.Native tp.mt_meta with
-				| _,[EConst(String s),_],_ -> s
+				| _,[EConst(String(s,_)),_],_ -> s
 				| _ -> raise Not_found
 			end
 		with Not_found ->
@@ -1648,7 +1648,7 @@ module Printer = struct
 					if Meta.has Meta.Native cf.cf_meta then begin
 						let _, args, mp = Meta.get Meta.Native cf.cf_meta in
 						match args with
-						| [( EConst(String s),_)] -> PMap.add f s acc
+						| [( EConst(String(s,_)),_)] -> PMap.add f s acc
 						| _ -> acc
 					end else acc
 				in
@@ -1880,7 +1880,7 @@ module Generator = struct
 	let gen_py_metas ctx metas indent =
 		List.iter (fun (n,el,_) ->
 			match el with
-				| [EConst(String s),_] ->
+				| [EConst(String(s,_)),_] ->
 					print ctx "%s@%s\n" indent s
 				| _ ->
 					assert false
@@ -2369,18 +2369,18 @@ module Generator = struct
 				in
 
 				let import_type,ignore_error = match args with
-					| [(EConst(String(module_name)), _)]
-					| [(EConst(String(module_name)), _); (EBinop(OpAssign, (EConst(Ident("ignoreError")),_), (EConst(Ident("false")),_)),_)] ->
+					| [(EConst(String(module_name,_)), _)]
+					| [(EConst(String(module_name,_)), _); (EBinop(OpAssign, (EConst(Ident("ignoreError")),_), (EConst(Ident("false")),_)),_)] ->
 						IModule module_name, false
 
-					| [(EConst(String(module_name)), _); (EBinop(OpAssign, (EConst(Ident("ignoreError")),_), (EConst(Ident("true")),_)),_)] ->
+					| [(EConst(String(module_name,_)), _); (EBinop(OpAssign, (EConst(Ident("ignoreError")),_), (EConst(Ident("true")),_)),_)] ->
 						IModule module_name,true
 
-					| [(EConst(String(module_name)), _); (EConst(String(object_name)), _)]
-					| [(EConst(String(module_name)), _); (EConst(String(object_name)), _); (EBinop(OpAssign, (EConst(Ident("ignoreError")),_), (EConst(Ident("false")),_)),_)] ->
+					| [(EConst(String(module_name,_)), _); (EConst(String(object_name,_)), _)]
+					| [(EConst(String(module_name,_)), _); (EConst(String(object_name,_)), _); (EBinop(OpAssign, (EConst(Ident("ignoreError")),_), (EConst(Ident("false")),_)),_)] ->
 						IObject (module_name,object_name), false
 
-					| [(EConst(String(module_name)), _); (EConst(String(object_name)), _); (EBinop(OpAssign, (EConst(Ident("ignoreError")),_), (EConst(Ident("true")),_)),_)] ->
+					| [(EConst(String(module_name,_)), _); (EConst(String(object_name,_)), _); (EBinop(OpAssign, (EConst(Ident("ignoreError")),_), (EConst(Ident("true")),_)),_)] ->
 						IObject (module_name,object_name), true
 					| _ ->
 						abort "Unsupported @:pythonImport format" mp

+ 7 - 7
src/generators/genswf.ml

@@ -271,13 +271,13 @@ let build_swf9 com file swc =
 		| TClassDecl c ->
 			let rec loop = function
 				| [] -> acc
-				| (Meta.Font,(EConst (String file),p) :: args,_) :: l ->
+				| (Meta.Font,(EConst (String(file,_)),p) :: args,_) :: l ->
 					let file = try Common.find_file com file with Not_found -> file in
 					let ch = try open_in_bin file with _ -> abort "File not found" p in
 					let ttf = try TTFParser.parse ch with e -> abort ("Error while parsing font " ^ file ^ " : " ^ Printexc.to_string e) p in
 					close_in ch;
 					let get_string e = match fst e with
-						| EConst (String s) -> s
+						| EConst (String(s,_)) -> s
 						| _ -> raise Not_found
 					in
 					let ttf_config = {
@@ -287,7 +287,7 @@ let build_swf9 com file swc =
 						ttfc_font_posture = TFPNormal;
 					} in
 					begin match args with
-						| (EConst (String str),_) :: _ -> ttf_config.ttfc_range_str <- str;
+						| (EConst (String(str,_)),_) :: _ -> ttf_config.ttfc_range_str <- str;
 						| _ -> ()
 					end;
 					begin match args with
@@ -324,7 +324,7 @@ let build_swf9 com file swc =
 						cd_id = !cid;
 						cd_data = data;
 					}) :: loop l
-				| (Meta.Bitmap,[EConst (String file),p],_) :: l ->
+				| (Meta.Bitmap,[EConst (String(file,_)),p],_) :: l ->
 					let data = load_file_data file p in
 					incr cid;
 					classes := { f9_cid = Some !cid; f9_classname = s_type_path c.cl_path } :: !classes;
@@ -360,7 +360,7 @@ let build_swf9 com file swc =
 						| _ -> raw()
 					) in
 					t :: loop l
-				| (Meta.Bitmap,[EConst (String dfile),p1;EConst (String afile),p2],_) :: l ->
+				| (Meta.Bitmap,[EConst (String(dfile,_)),p1;EConst (String(afile,_)),p2],_) :: l ->
 					let ddata = load_file_data dfile p1 in
 					let adata = load_file_data afile p2 in
 					(match detect_format ddata p1 with
@@ -385,12 +385,12 @@ let build_swf9 com file swc =
 					incr cid;
 					classes := { f9_cid = Some !cid; f9_classname = s_type_path c.cl_path } :: !classes;
 					tag (TBitsJPEG3 { bd_id = !cid; bd_data = ddata; bd_table = None; bd_alpha = Some amask; bd_deblock = Some 0 }) :: loop l
-				| (Meta.File,[EConst (String file),p],_) :: l ->
+				| (Meta.File,[EConst (String(file,_)),p],_) :: l ->
 					let data = load_file_data file p in
 					incr cid;
 					classes := { f9_cid = Some !cid; f9_classname = s_type_path c.cl_path } :: !classes;
 					tag (TBinaryData (!cid,data)) :: loop l
-				| (Meta.Sound,[EConst (String file),p],_) :: l ->
+				| (Meta.Sound,[EConst (String(file,_)),p],_) :: l ->
 					let data = load_file_data file p in
 					let make_flags fmt mono freq bits =
 						let fbits = (match freq with 5512 when fmt <> 2 -> 0 | 11025 -> 1 | 22050 -> 2 | 44100 -> 3 | _ -> failwith ("Unsupported frequency " ^ string_of_int freq)) in

+ 5 - 5
src/generators/genswf9.ml

@@ -313,9 +313,9 @@ let ns_access cf =
 	try
 		let (_,params,_) = Meta.get Meta.Ns cf.cf_meta in
 		match params with
-		| [(EConst (String ns),_)] ->
+		| [(EConst (String(ns,_)),_)] ->
 			Some (HMName (cf.cf_name, HNNamespace ns))
-		| [(EConst (String ns),_); (EConst (Ident "internal"),_)] ->
+		| [(EConst (String(ns,_)),_); (EConst (Ident "internal"),_)] ->
 			Some (HMName (cf.cf_name, HNInternal (Some ns)))
 		| _ -> assert false
 	with Not_found ->
@@ -2036,8 +2036,8 @@ let extract_meta meta =
 		| (Meta.Meta,[ECall ((EConst (Ident n),_),args),_],_) :: l ->
 			let mk_arg (a,p) =
 				match a with
-				| EConst (String s) -> (None, s)
-				| EBinop (OpAssign,(EConst (Ident n),_),(EConst (String s),_)) -> (Some n, s)
+				| EConst (String(s,_)) -> (None, s)
+				| EBinop (OpAssign,(EConst (Ident n),_),(EConst (String(s,_)),_)) -> (Some n, s)
 				| _ -> abort "Invalid meta definition" p
 			in
 			{ hlmeta_name = n; hlmeta_data = Array.of_list (List.map mk_arg args) } :: loop l
@@ -2455,7 +2455,7 @@ let generate_class ctx c =
 			| x :: l ->
 				match x with
 				| ((Meta.Getter | Meta.Setter),[EConst (Ident f),_],_) -> ident f
-				| (Meta.Ns,[EConst (String ns),_],_) -> HMName (f.cf_name,HNNamespace ns)
+				| (Meta.Ns,[EConst (String(ns,_)),_],_) -> HMName (f.cf_name,HNNamespace ns)
 				| (Meta.Protected,[],_) -> protect()
 				| _ -> loop_meta l
 		in

+ 1 - 1
src/macro/eval/evalDebugMisc.ml

@@ -201,7 +201,7 @@ let rec expr_to_value ctx env e =
 	let rec loop e = match fst e with
 		| EConst cst ->
 			begin match cst with
-				| String s -> EvalString.create_unknown s
+				| String(s,_) -> EvalString.create_unknown s
 				| Int s -> VInt32 (Int32.of_string s)
 				| Float s -> VFloat (float_of_string s)
 				| Ident "true" -> VTrue

+ 1 - 0
src/macro/eval/evalEncode.ml

@@ -160,6 +160,7 @@ let encode_enum i pos index pl =
 		| IDisplayKind -> key_haxe_macro_DisplayKind
 		| IMessage -> key_haxe_macro_Message
 		| IFunctionKind -> key_haxe_macro_FunctionKind
+		| IStringLiteralKind -> key_haxe_macro_StringLiteralKind
 	in
 	encode_enum_value key index (Array.of_list pl) pos
 

+ 1 - 0
src/macro/eval/evalHash.ml

@@ -106,6 +106,7 @@ let key_haxe_macro_QuoteStatus = hash "haxe.macro.QuoteStatus"
 let key_haxe_macro_DisplayKind = hash "haxe.macro.DisplayKind"
 let key_haxe_macro_Message = hash "haxe.macro.Message"
 let key_haxe_macro_FunctionKind = hash "haxe.macro.FunctionKind"
+let key_haxe_macro_StringLiteralKind = hash "haxe.macro.StringLiteralKind"
 let key_haxe_CallStack = hash "haxe.CallStack"
 let key___init__ = hash "__init__"
 let key_new = hash "new"

+ 1 - 1
src/macro/eval/evalMain.ml

@@ -414,7 +414,7 @@ let rec value_to_expr v p =
 	| VFalse -> (EConst (Ident "false"),p)
 	| VInt32 i -> (EConst (Int (Int32.to_string i)),p)
 	| VFloat f -> haxe_float f p
-	| VString s -> (EConst (String s.sstring),p)
+	| VString s -> (EConst (String(s.sstring,SDoubleQuotes)),p)
 	| VArray va -> (EArrayDecl (List.map (fun v -> value_to_expr v p) (EvalArray.to_list va)),p)
 	| VObject o -> (EObjectDecl (ExtList.List.filter_map (fun (k,v) ->
 			let n = rev_hash k in

+ 17 - 2
src/macro/macroApi.ml

@@ -78,6 +78,7 @@ type enum_type =
 	| IDisplayKind
 	| IMessage
 	| IFunctionKind
+	| IStringLiteralKind
 
 (**
 	Our access to the interpreter from the macro api
@@ -174,6 +175,7 @@ let enum_name = function
 	| IDisplayKind -> "DisplayKind"
 	| IMessage -> "Message"
 	| IFunctionKind -> "FunctionKind"
+	| IStringLiteralKind -> "StringLiteralKind"
 
 let all_enums =
 	let last = IImportMode in
@@ -216,11 +218,18 @@ let null f = function
 
 let encode_enum ?(pos=None) k tag vl = encode_enum k pos tag vl
 
+let encode_string_literal_kind qs =
+	let tag = match qs with
+		| SDoubleQuotes -> 0
+		| SSingleQuotes -> 1
+	in
+	encode_enum IStringLiteralKind tag []
+
 let encode_const c =
 	let tag, pl = match c with
 	| Int s -> 0, [encode_string s]
 	| Float s -> 1, [encode_string s]
-	| String s -> 2, [encode_string s]
+	| String(s,qs) -> 2, [encode_string s;encode_string_literal_kind qs]
 	| Ident s -> 3, [encode_string s]
 	| Regexp (s,opt) -> 4, [encode_string s;encode_string opt]
 	in
@@ -527,11 +536,17 @@ let opt_list f v =
 let decode_opt_bool v =
 	if v = vnull then false else decode_bool v
 
+let decode_string_literal_kind v =
+	if v = vnull then SDoubleQuotes else match decode_enum v with
+	| 0,[] -> SDoubleQuotes
+	| 1,[] -> SSingleQuotes
+	| _ -> raise Invalid_expr
+
 let decode_const c =
 	match decode_enum c with
 	| 0, [s] -> Int (decode_string s)
 	| 1, [s] -> Float (decode_string s)
-	| 2, [s] -> String (decode_string s)
+	| 2, [s;qs] -> String (decode_string s,decode_string_literal_kind qs)
 	| 3, [s] -> Ident (decode_string s)
 	| 4, [s;opt] -> Regexp (decode_string s, decode_string opt)
 	| 5, [s] -> Ident (decode_string s) (** deprecated CType, keep until 3.0 release **)

+ 4 - 4
src/syntax/grammar.mly

@@ -959,7 +959,7 @@ and parse_class_herit = parser
 
 and block1 = parser
 	| [< name,p = dollar_ident; s >] -> block2 (name,p,NoQuotes) (Ident name) p s
-	| [< '(Const (String name),p); s >] -> block2 (name,p,DoubleQuotes) (String name) p s
+	| [< '(Const (String(name,qs)),p); s >] -> block2 (name,p,DoubleQuotes) (String(name,qs)) p s (* STRINGTODO: qs... hmm *)
 	| [< b = block [] >] -> EBlock b
 
 and block2 name ident p s =
@@ -1035,7 +1035,7 @@ and parse_obj_decl name e p0 s =
 			in
 			begin match s with parser
 				| [< name,p = ident >] -> next (name,p,NoQuotes)
-				| [< '(Const (String name),p) >] -> next (name,p,DoubleQuotes)
+				| [< '(Const (String(name,qs)),p) >] -> next (name,p,DoubleQuotes) (* STRINGTODO: use qs? *)
 				| [< >] -> acc,p_end
 			end
 		| [< >] -> acc,p_end
@@ -1538,8 +1538,8 @@ let rec parse_macro_cond s =
 		let cond = (match s with parser
 			| [< '(Const (Ident t),p) >] ->
 				parse_macro_ident t p s
-			| [< '(Const (String s),p) >] ->
-				None, (EConst (String s),p)
+			| [< '(Const (String(s,qs)),p) >] ->
+				None, (EConst (String(s,qs)),p)
 			| [< '(Const (Int i),p) >] ->
 				None, (EConst (Int i),p)
 			| [< '(Const (Float f),p) >] ->

+ 2 - 2
src/syntax/lexer.ml

@@ -397,13 +397,13 @@ let rec token lexbuf =
 		let pmin = lexeme_start lexbuf in
 		let pmax = (try string lexbuf with Exit -> error Unterminated_string pmin) in
 		let str = (try unescape (contents()) with Invalid_escape_sequence(c,i,msg) -> error (Invalid_escape (c,msg)) (pmin + i)) in
-		mk_tok (Const (String str)) pmin pmax;
+		mk_tok (Const (String(str,SDoubleQuotes))) pmin pmax;
 	| "'" ->
 		reset();
 		let pmin = lexeme_start lexbuf in
 		let pmax = (try string2 lexbuf with Exit -> error Unterminated_string pmin) in
 		let str = (try unescape (contents()) with Invalid_escape_sequence(c,i,msg) -> error (Invalid_escape (c,msg)) (pmin + i)) in
-		let t = mk_tok (Const (String str)) pmin pmax in
+		let t = mk_tok (Const (String(str,SSingleQuotes))) pmin pmax in
 		fast_add_fmt_string (snd t);
 		t
 	| "~/" ->

+ 1 - 1
src/syntax/parser.ml

@@ -272,7 +272,7 @@ let handle_xml_literal p1 =
 	Lexer.reset();
 	let i = Lexer.lex_xml p1.pmin !code_ref in
 	let xml = Lexer.contents() in
-	let e = EConst (String xml),{p1 with pmax = i} in
+	let e = EConst (String(xml,SDoubleQuotes)),{p1 with pmax = i} in (* STRINGTODO: distinct kind? *)
 	let e = make_meta Meta.Markup [] e p1 in
 	e
 

+ 3 - 3
src/syntax/parserEntry.ml

@@ -64,10 +64,10 @@ let rec eval ctx (e,p) =
 	match e with
 	| EConst (Ident i) ->
 		(try TString (Define.raw_defined_value ctx i) with Not_found -> TNull)
-	| EConst (String s) -> TString s
+	| EConst (String(s,_)) -> TString s
 	| EConst (Int i) -> TFloat (float_of_string i)
 	| EConst (Float f) -> TFloat (float_of_string f)
-	| ECall ((EConst (Ident "version"),_),[(EConst (String s), p)]) -> parse_version s p
+	| ECall ((EConst (Ident "version"),_),[(EConst (String(s,_)), p)]) -> parse_version s p
 	| EBinop (OpBoolAnd, e1, e2) -> TBool (is_true (eval ctx e1) && is_true (eval ctx e2))
 	| EBinop (OpBoolOr, e1, e2) -> TBool (is_true (eval ctx e1) || is_true(eval ctx e2))
 	| EUnop (Not, _, e) -> TBool (not (is_true (eval ctx e)))
@@ -196,7 +196,7 @@ let parse ctx code file =
 			process_token (enter_macro (snd tk))
 		| Sharp "error" ->
 			(match Lexer.token code with
-			| (Const (String s),p) -> error (Custom s) p
+			| (Const (String(s,_)),p) -> error (Custom s) p
 			| _ -> error Unimplemented (snd tk))
 		| Sharp "line" ->
 			let line = (match next_token() with

+ 7 - 5
src/syntax/reification.ml

@@ -30,13 +30,15 @@ let reify in_macro =
 		| _ -> (ECall (constr,vl),pmin)
 	in
 	let to_const c p =
-		let cst n v = mk_enum "Constant" n [EConst (String v),p] p in
+		let cst n v = mk_enum "Constant" n [EConst (String(v,SDoubleQuotes)),p] p in
 		match c with
 		| Int i -> cst "CInt" i
-		| String s -> cst "CString" s
+		| String(s,qs) ->
+			let qs = mk_enum "StringLiteralKind" (match qs with SDoubleQuotes -> "DoubleQuotes" | SSingleQuotes -> "SingleQuotes") [] p in
+			mk_enum "Constant" "CString" [(EConst (String(s,SDoubleQuotes)),p);qs] p
 		| Float s -> cst "CFloat" s
 		| Ident s -> cst "CIdent" s
-		| Regexp (r,o) -> mk_enum "Constant" "CRegexp" [(EConst (String r),p);(EConst (String o),p)] p
+		| Regexp (r,o) -> mk_enum "Constant" "CRegexp" [(EConst (String(r,SDoubleQuotes)),p);(EConst (String(o,SDoubleQuotes)),p)] p
 	in
 	let rec to_binop o p =
 		let op n = mk_enum "Binop" n [] p in
@@ -71,7 +73,7 @@ let reify in_macro =
 		if len > 1 && s.[0] = '$' then
 			(EConst (Ident (String.sub s 1 (len - 1))),p)
 		else
-			(EConst (String s),p)
+			(EConst (String(s,SDoubleQuotes)),p)
 	in
 	let to_placed_name (s,p) =
 		to_string s p
@@ -215,7 +217,7 @@ let reify in_macro =
 		| Some p ->
 			p
 		| None ->
-		let file = (EConst (String p.pfile),p) in
+		let file = (EConst (String(p.pfile,SDoubleQuotes)),p) in
 		let pmin = (EConst (Int (string_of_int p.pmin)),p) in
 		let pmax = (EConst (Int (string_of_int p.pmax)),p) in
 		if in_macro then

+ 3 - 3
src/typing/fields.ml

@@ -385,7 +385,7 @@ let rec type_field cfg ctx e i p mode =
 					true
 				| _ ->
 					List.exists (fun e -> match fst e with
-						| EConst(Ident s | String s) -> s = i
+						| EConst(Ident s | String(s,_)) -> s = i
 						| _ -> error "Identifier or string expected as argument to @:forward" (pos e)
 					) el
 		with Not_found ->
@@ -409,7 +409,7 @@ let rec type_field cfg ctx e i p mode =
 					with Unify_error l ->
 						display_error ctx "Field resolve has an invalid type" f.cf_pos;
 						display_error ctx (error_msg (Unify [Cannot_unify(tfield,texpect)])) f.cf_pos);
-					AKExpr (make_call ctx (mk (TField (e,FInstance (c,params,f))) tfield p) [Texpr.type_constant ctx.com.basic (String i) p] t p)
+					AKExpr (make_call ctx (mk (TField (e,FInstance (c,params,f))) tfield p) [Texpr.type_constant ctx.com.basic (String(i,SDoubleQuotes)) p] t p)
 				end else
 					AKExpr (mk (TField (e,FDynamic i)) t p)
 			| None ->
@@ -610,7 +610,7 @@ let rec type_field cfg ctx e i p mode =
 				if is_write then
 					AKFieldSet(e,ef,i,r)
 				else
-					AKExpr ((!build_call_ref) ctx (AKUsing(ef,c,cf,e,false)) [EConst (String i),p] NoValue p)
+					AKExpr ((!build_call_ref) ctx (AKUsing(ef,c,cf,e,false)) [EConst (String(i,SDoubleQuotes)),p] NoValue p)
 			in
 			if not (TypeFieldConfig.allow_resolve cfg) then raise Not_found;
 			get_resolve (mode = MSet)

+ 1 - 1
src/typing/generic.ml

@@ -303,7 +303,7 @@ let rec build_generic ctx c p tl =
 		(* In rare cases the class name can become too long, so let's shorten it (issue #3090). *)
 		if String.length (snd cg.cl_path) > 254 then begin
 			let n = get_short_name () in
-			cg.cl_meta <- (Meta.Native,[EConst(String (n)),p],null_pos) :: cg.cl_meta;
+			cg.cl_meta <- (Meta.Native,[EConst(String (n,SDoubleQuotes)),p],null_pos) :: cg.cl_meta;
 		end;
 		TInst (cg,[])
 	end

+ 1 - 1
src/typing/macroContext.ml

@@ -723,7 +723,7 @@ let type_macro ctx mode cpath f (el:Ast.expr list) p =
 			safe_decode v expected mret p process
 	in
 	let e = if ctx.in_macro then
-		Some (EThrow((EConst(String "macro-in-macro")),p),p)
+		Some (EThrow((EConst(String("macro-in-macro",SDoubleQuotes))),p),p)
 	else
 		call()
 	in

+ 2 - 2
src/typing/magicTypes.ml

@@ -50,7 +50,7 @@ let extend_remoting ctx c t p async prot =
 			else
 				fd.f_args, eargs
 			in
-			let id = (EConst (String (fst f.cff_name)), p) in
+			let id = (EConst (String (fst f.cff_name,SDoubleQuotes)), p) in
 			let id = if prot then id else ECall ((EConst (Ident "__unprotect__"),p),[id]),p in
 			let expr = ECall (
 				(EField (
@@ -138,7 +138,7 @@ let on_inherit ctx c p (is_extends,tp) =
 	| { tpackage = ["haxe";"remoting"]; tname = "AsyncProxy"; tparams = [TPType(CTPath t,null_pos)] } ->
 		extend_remoting ctx c t p true true;
 		false
-	| { tpackage = ["haxe";"xml"]; tname = "Proxy"; tparams = [TPExpr(EConst (String file),p);TPType (t,_)] } ->
+	| { tpackage = ["haxe";"xml"]; tname = "Proxy"; tparams = [TPExpr(EConst (String(file,SDoubleQuotes)),p);TPType (t,_)] } ->
 		extend_xml_proxy ctx c t file p;
 		true
 	| _ ->

+ 2 - 2
src/typing/typeload.ml

@@ -251,7 +251,7 @@ let rec load_instance' ctx (t,p) allow_no_params =
 				if not (Common.defined ctx.com Define.NoDeprecationWarnings) then
 					begin try
 						let msg = match Meta.get Meta.Deprecated td.t_meta with
-							| _,[EConst(String s),_],_ -> s
+							| _,[EConst(String(s,_)),_],_ -> s
 							| _ -> "This typedef is deprecated in favor of " ^ (s_type (print_context()) td.t_type)
 						in
 						DeprecationCheck.warn_deprecation ctx.com msg p
@@ -285,7 +285,7 @@ let rec load_instance' ctx (t,p) allow_no_params =
 				match t with
 				| TPExpr e ->
 					let name = (match fst e with
-						| EConst (String s) -> "S" ^ s
+						| EConst (String(s,_)) -> "S" ^ s
 						| EConst (Int i) -> "I" ^ i
 						| EConst (Float f) -> "F" ^ f
 						| EDisplay _ ->

+ 1 - 1
src/typing/typeloadCheck.ml

@@ -141,7 +141,7 @@ let get_native_name meta =
 	in
 	let (_,e,mp) = get_native meta in
 	match e with
-	| [Ast.EConst (Ast.String name),p] ->
+	| [Ast.EConst (Ast.String(name,_)),p] ->
 		name,p
 	| [] ->
 		raise Not_found

+ 3 - 3
src/typing/typeloadFields.ml

@@ -349,7 +349,7 @@ let build_enum_abstract ctx c a fields p =
 				| None ->
 					if not c.cl_extern then begin match mode with
 						| EAString ->
-							set_field (EConst (String (fst field.cff_name)),null_pos)
+							set_field (EConst (String (fst field.cff_name,SDoubleQuotes)),null_pos)
 						| EAInt i ->
 							set_field (EConst (Int (string_of_int !i)),null_pos);
 							incr i;
@@ -1384,7 +1384,7 @@ let init_class ctx c p context_init herits fields =
 						| _ -> ""
 					in
 					if not (ParserEntry.is_true (ParserEntry.eval ctx.com.defines e)) then
-						Some (sc,(match List.rev l with (EConst (String msg),_) :: _ -> Some msg | _ -> None))
+						Some (sc,(match List.rev l with (EConst (String(msg,_)),_) :: _ -> Some msg | _ -> None))
 					else
 						loop l
 			in
@@ -1394,7 +1394,7 @@ let init_class ctx c p context_init herits fields =
 	in
 	let rec check_if_feature = function
 		| [] -> []
-		| (Meta.IfFeature,el,_) :: _ -> List.map (fun (e,p) -> match e with EConst (String s) -> s | _ -> error "String expected" p) el
+		| (Meta.IfFeature,el,_) :: _ -> List.map (fun (e,p) -> match e with EConst (String(s,_)) -> s | _ -> error "String expected" p) el
 		| _ :: l -> check_if_feature l
 	in
 	let cl_if_feature = check_if_feature c.cl_meta in

+ 3 - 3
src/typing/typeloadModule.ml

@@ -56,9 +56,9 @@ module StrictMeta = struct
 			| TAbstractDecl a -> a.a_path, a.a_meta
 		in
 		let rec loop acc = function
-			| (Meta.JavaCanonical,[EConst(String pack),_; EConst(String name),_],_) :: _ ->
+			| (Meta.JavaCanonical,[EConst(String(pack,_)),_; EConst(String(name,_)),_],_) :: _ ->
 				ExtString.String.nsplit pack ".", name
-			| (Meta.Native,[EConst(String name),_],_) :: meta ->
+			| (Meta.Native,[EConst(String(name,_)),_],_) :: meta ->
 				loop (Ast.parse_path name) meta
 			| _ :: meta ->
 				loop acc meta
@@ -86,7 +86,7 @@ module StrictMeta = struct
 		| TConst(TFloat f) ->
 			(EConst(Float f), expr.epos)
 		| TConst(TString s) ->
-			(EConst(String s), expr.epos)
+			(EConst(String(s,SDoubleQuotes)), expr.epos)
 		| TConst TNull ->
 			(EConst(Ident "null"), expr.epos)
 		| TConst(TBool b) ->

+ 3 - 3
src/typing/typer.ml

@@ -1515,7 +1515,7 @@ and format_string ctx s p =
 	in
 	let add_sub start pos =
 		let len = pos - start in
-		if len > 0 || !e = None then add (EConst (String (String.sub s start len))) len
+		if len > 0 || !e = None then add (EConst (String (String.sub s start len,SDoubleQuotes))) len
 	in
 	let len = String.length s in
 	let rec parse start pos =
@@ -2448,7 +2448,7 @@ and type_call ?(mode=MGet) ctx e el (with_type:WithType.t) inline p =
 
 and type_expr ?(mode=MGet) ctx (e,p) (with_type:WithType.t) =
 	match e with
-	| EField ((EConst (String s),ps),"code") ->
+	| EField ((EConst (String(s,_)),ps),"code") ->
 		if UTF8.length s <> 1 then error "String must be a single UTF8 char" ps;
 		mk (TConst (TInt (Int32.of_int (UChar.code (UTF8.get s 0))))) ctx.t.tint p
 	| EField(_,n) when starts_with n '$' ->
@@ -2465,7 +2465,7 @@ and type_expr ?(mode=MGet) ctx (e,p) (with_type:WithType.t) =
 		let opt = mk (TConst (TString opt)) ctx.t.tstring p in
 		let t = Typeload.load_core_type ctx "EReg" in
 		mk (TNew ((match t with TInst (c,[]) -> c | _ -> assert false),[],[str;opt])) t p
-	| EConst (String s) when s <> "" && Lexer.is_fmt_string p ->
+	| EConst (String(s,_)) when s <> "" && Lexer.is_fmt_string p ->
 		type_expr ctx (format_string ctx s p) with_type
 	| EConst c ->
 		Texpr.type_constant ctx.com.basic c p

+ 3 - 3
src/typing/typerBase.ml

@@ -39,13 +39,13 @@ let relative_path ctx file =
 let mk_infos ctx p params =
 	let file = if ctx.in_macro then p.pfile else if Common.defined ctx.com Define.AbsolutePath then Path.get_full_path p.pfile else relative_path ctx p.pfile in
 	(EObjectDecl (
-		(("fileName",null_pos,NoQuotes) , (EConst (String file) , p)) ::
+		(("fileName",null_pos,NoQuotes) , (EConst (String(file,SDoubleQuotes)) , p)) ::
 		(("lineNumber",null_pos,NoQuotes) , (EConst (Int (string_of_int (Lexer.get_error_line p))),p)) ::
-		(("className",null_pos,NoQuotes) , (EConst (String (s_type_path ctx.curclass.cl_path)),p)) ::
+		(("className",null_pos,NoQuotes) , (EConst (String (s_type_path ctx.curclass.cl_path,SDoubleQuotes)),p)) ::
 		if ctx.curfield.cf_name = "" then
 			params
 		else
-			(("methodName",null_pos,NoQuotes), (EConst (String ctx.curfield.cf_name),p)) :: params
+			(("methodName",null_pos,NoQuotes), (EConst (String (ctx.curfield.cf_name,SDoubleQuotes)),p)) :: params
 	) ,p)
 
 let rec is_pos_infos = function

+ 3 - 1
std/cpp/ConstPointer.hx

@@ -63,7 +63,9 @@ extern class ConstPointer<T> {
 
 	public function inc():ConstPointer<T>;
 	public function dec():ConstPointer<T>;
-	public function postIncVal():Reference<T>;
 	public function incBy(inT:Int):ConstPointer<T>;
+	public function decBy(inT:Int):ConstPointer<T>;
 	public function add(inT:Int):ConstPointer<T>;
+	public function sub(inT:Int):ConstPointer<T>;
+	public function postIncVal():Reference<T>;
 }

+ 2 - 0
std/cpp/Pointer.hx

@@ -75,7 +75,9 @@ extern class Pointer<T> extends ConstPointer<T> implements ArrayAccess<T> {
 	override public function inc():Pointer<T>;
 	override public function dec():Pointer<T>;
 	override public function incBy(inT:Int):Pointer<T>;
+	override public function decBy(inT:Int):Pointer<T>;
 	override public function add(inT:Int):Pointer<T>;
+	override public function sub(inT:Int):Pointer<T>;
 
 	public function postIncRef():Reference<T>;
 

+ 6 - 1
std/haxe/macro/Expr.hx

@@ -47,6 +47,11 @@ typedef Position = {
 }
 #end
 
+enum StringLiteralKind {
+	DoubleQuotes;
+	SingleQuotes;
+}
+
 /**
 	Represents a constant.
 	@see https://haxe.org/manual/expression-constants.html
@@ -65,7 +70,7 @@ enum Constant {
 	/**
 		Represents a string literal.
 	**/
-	CString(s:String);
+	CString(s:String, ?kind:StringLiteralKind);
 
 	/**
 		Represents an identifier.

+ 12 - 0
tests/server/src/Main.hx

@@ -193,6 +193,17 @@ class ServerTests extends HaxeServerTestCase {
 		utest.Assert.equals("function() {_Vector.Vector_Impl_.toIntVector(null);}", moreHack(type.args.statics[0].expr.testHack)); // lmao
 	}
 
+	function testXRedefinedFromX() {
+		vfs.putContent("Main.hx", getTemplate("issues/Issue8368/Main.hx"));
+		vfs.putContent("MyMacro.hx", getTemplate("issues/Issue8368/MyMacro.hx"));
+		vfs.putContent("Type1.hx", getTemplate("issues/Issue8368/Type1.hx"));
+		vfs.putContent("Type2.hx", getTemplate("issues/Issue8368/Type2.hx"));
+		var args = ["-main", "Main", "--macro", "define('whatever')"];
+		runHaxe(args);
+		runHaxe(args);
+		assertSuccess();
+	}
+
 	function testMacroStaticsReset() {
 		vfs.putContent("Main.hx", getTemplate("issues/Issue8631/Main.hx"));
 		vfs.putContent("Init.hx", getTemplate("issues/Issue8631/Init.hx"));
@@ -203,6 +214,7 @@ class ServerTests extends HaxeServerTestCase {
 		var counter = vfs.getContent("counter.txt");
 		utest.Assert.equals('2', counter);
 	}
+
 }
 
 class Main {

+ 5 - 0
tests/server/test/templates/issues/Issue8368/Main.hx

@@ -0,0 +1,5 @@
+class Main {
+	public static function main():Void {
+		MyMacro.foo();
+	}
+}

+ 8 - 0
tests/server/test/templates/issues/Issue8368/MyMacro.hx

@@ -0,0 +1,8 @@
+class MyMacro {
+	#if macro
+	static var issue = haxe.macro.ComplexTypeTools.toType(macro :Type1);
+	// ^ this causes the issue
+	#end
+
+	public static macro function foo() return macro { };
+}

+ 5 - 0
tests/server/test/templates/issues/Issue8368/Type1.hx

@@ -0,0 +1,5 @@
+class Type1 {
+	public function new() {
+		trace(Type2);
+	}
+}

+ 5 - 0
tests/server/test/templates/issues/Issue8368/Type2.hx

@@ -0,0 +1,5 @@
+class Type2 {
+	public function new() {
+		trace(Type1);
+	}
+}

+ 2 - 2
tests/unit/src/unit/TestMatch.hx

@@ -147,7 +147,7 @@ class TestMatch extends Test {
 		eq("[]", switchArray(macro []));
 		eq("_", switchArray(macro 2));
 		eq("[EConst(CInt(22))]", switchArray(macro [22]));
-		eq("[EConst(CInt(22)),EConst(CString(foo))]", switchArray(macro [22,"foo"]));
+		eq("[EConst(CInt(22)),EConst(CString(foo,DoubleQuotes))]", switchArray(macro [22,"foo"]));
 		eq("_", switchArray(macro [22, "foo", "bar"]));
 
 		eq("0", switchArray2(["a", "b"]));
@@ -160,7 +160,7 @@ class TestMatch extends Test {
 		eq("6", switchArray2([]));
 		eq("7", switchArray2(["a", "a", "a", "b"]));
 
-		eq("EConst(CString(foobar)):12", switchCrazy(macro untyped ("foobar"[12])));
+		eq("EConst(CString(foobar,DoubleQuotes)):12", switchCrazy(macro untyped ("foobar"[12])));
 
 		eq("1", switchGuard(macro "foobar"));
 		eq("2", switchGuard(macro "barfoo"));

+ 5 - 5
tests/unit/src/unitstd/haxe/macro/ExprTools.unit.hx

@@ -71,7 +71,7 @@ function check(e, exp, ?pos) {
 iter(econst, fail);
 iter(econtinue, fail);
 iter(ebreak, fail);
-iter(efield, seq.bind("EConst(CString(foo))"));
+iter(efield, seq.bind("EConst(CString(foo,DoubleQuotes))"));
 iter(eparenthesis, seq.bind("EConst(CInt(1))"));
 iter(euntyped, seq.bind("EConst(CInt(1))"));
 iter(ethrow, seq.bind("EConst(CInt(1))"));
@@ -79,13 +79,13 @@ iter(eunop, seq.bind("EConst(CInt(1))"));
 iter(ecast, seq.bind("EConst(CInt(1))"));
 iter(emeta, seq.bind("EConst(CInt(1))"));
 check(earray, ["EConst(CInt(1))", "EConst(CInt(0))"]);
-check(ewhile1, ["EConst(CInt(1))", "EConst(CString(foo))"]);
-check(ewhile2, ["EConst(CInt(1))", "EConst(CString(foo))"]);
+check(ewhile1, ["EConst(CInt(1))", "EConst(CString(foo,DoubleQuotes))"]);
+check(ewhile2, ["EConst(CInt(1))", "EConst(CString(foo,DoubleQuotes))"]);
 check(ebinop, ["EConst(CInt(1))", "EConst(CInt(1))"]);
-check(efor, ["EConst(CInt(1))", "EConst(CString(foo))"]);
+check(efor, ["EConst(CInt(1))", "EConst(CString(foo,DoubleQuotes))"]);
 check(ein, ["EConst(CIdent(i))", "EConst(CInt(1))"]);
 check(evars, ["EConst(CInt(1))", "EConst(CInt(2))"]);
-check(etry, ["EConst(CInt(1))", "EConst(CString(foo))", "EConst(CString(bar))"]);
+check(etry, ["EConst(CInt(1))", "EConst(CString(foo,DoubleQuotes))", "EConst(CString(bar,DoubleQuotes))"]);
 check(eternary, ["EConst(CInt(1))", "EConst(CInt(2))", "EConst(CInt(3))"]);
 check(earraydecl, ["EConst(CInt(1))", "EConst(CInt(2))"]);
 check(enew, ["EConst(CInt(1))", "EConst(CInt(2))"]);