Преглед изворни кода

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
 		| KUnk , KFloat
 		| KUnk , KString  ->
-			unify ctx e1.etype e2.etype e1.epos;
-			e1.etype
+			e2.etype
 		| KInt , KUnk ->
 			if unify_int ctx e2 KUnk then tint else tfloat
 		| KFloat , KUnk
 		| KString , KUnk ->
-			unify ctx e2.etype e1.etype e2.epos;
-			e2.etype
+			e1.etype
 		| _ , KString
 		| KString , _ ->
 			tstring

+ 1 - 1
std/neko/Boot.hx

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