瀏覽代碼

Dont infer string on concat (#11318)

* [typer] don't infer String when concatenating

see #11284

* dodge neko things very elegantly
Simon Krajewski 1 年之前
父節點
當前提交
46ded5a17d
共有 2 個文件被更改,包括 3 次插入5 次删除
  1. 2 4
      src/typing/operators.ml
  2. 1 1
      std/neko/Boot.hx

+ 2 - 4
src/typing/operators.ml

@@ -239,14 +239,12 @@ let make_binop ctx op e1 e2 is_assign_op with_type p =
 			if unify_int ctx e1 KUnk then tint else tfloat
 			if unify_int ctx e1 KUnk then tint else tfloat
 		| KUnk , KFloat
 		| KUnk , KFloat
 		| KUnk , KString  ->
 		| KUnk , KString  ->
-			unify ctx e1.etype e2.etype e1.epos;
-			e1.etype
+			e2.etype
 		| KInt , KUnk ->
 		| KInt , KUnk ->
 			if unify_int ctx e2 KUnk then tint else tfloat
 			if unify_int ctx e2 KUnk then tint else tfloat
 		| KFloat , KUnk
 		| KFloat , KUnk
 		| KString , KUnk ->
 		| KString , KUnk ->
-			unify ctx e2.etype e1.etype e2.epos;
-			e2.etype
+			e1.etype
 		| _ , KString
 		| _ , KString
 		| KString , _ ->
 		| KString , _ ->
 			tstring
 			tstring

+ 1 - 1
std/neko/Boot.hx

@@ -48,7 +48,7 @@ class Boot {
 			i += 1;
 			i += 1;
 		}
 		}
 		e.__string = old;
 		e.__string = old;
-		return s + untyped ")".__s;
+		return NativeString.ofString(s + untyped ")".__s);
 	}
 	}
 
 
 	private static function __interfLoop(cc:Dynamic, cl:Dynamic) {
 	private static function __interfLoop(cc:Dynamic, cl:Dynamic) {