Skip to content

Commit

Permalink
Dont infer string on concat (#11318)
Browse files Browse the repository at this point in the history
* [typer] don't infer String when concatenating

see #11284

* dodge neko things very elegantly
  • Loading branch information
Simn authored and kLabz committed Mar 4, 2024
1 parent 1736b95 commit c17e976
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/typing/operators.ml
Original file line number Diff line number Diff line change
Expand Up @@ -237,14 +237,22 @@ 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
if Define.defined ctx.com.defines Define.HaxeNext then
e2.etype
else begin
unify ctx e1.etype e2.etype e1.epos;
e1.etype
end
| 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
if Define.defined ctx.com.defines Define.HaxeNext then
e1.etype
else begin
unify ctx e2.etype e1.etype e2.epos;
e2.etype
end
| _ , KString
| KString , _ ->
tstring
Expand Down
4 changes: 4 additions & 0 deletions std/neko/Boot.hx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ class Boot {
i += 1;
}
e.__string = old;
#if haxe_next
return NativeString.ofString(s + untyped ")".__s);
#else
return s + untyped ")".__s;
#end
}

private static function __interfLoop(cc:Dynamic, cl:Dynamic) {
Expand Down

0 comments on commit c17e976

Please sign in to comment.