Skip to content

Commit 67c819e

Browse files
[php] more descriptive error upon a failure on string method call (#9464)
1 parent c6d0332 commit 67c819e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

extra/CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
js/cpp : fixed catch var naming collision (#9413)
1818
interp : fixed throwing `haxe.macro.Error` outside of a macro context (#9390)
1919
lua : fixed lua.PairTools.ipairsMap method
20+
php : fixed an edge case in String methods generation (#9464)
2021

2122
2020-05-13: 4.1.0
2223

src/generators/genphp7.ml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2207,11 +2207,16 @@ class code_writer (ctx:php_generator_context) hx_type_path php_name =
22072207
*)
22082208
method write_expr_call_string expr access args =
22092209
match access with
2210-
| FInstance (_, _, ({ cf_kind = Method _ } as field)) ->
2210+
| FInstance (_, _, ({ cf_kind = Method _ } as field))
2211+
| FClosure (_, ({ cf_kind = Method _ } as field)) ->
22112212
self#write ((self#use hxstring_type_path) ^ "::" ^ (field_name field) ^ "(");
22122213
write_args self#write self#write_expr (expr :: args);
22132214
self#write ")"
2214-
| _ -> fail self#pos __LOC__
2215+
| _ ->
2216+
let msg =
2217+
"Unexpected field access " ^ (s_field_access (s_type (print_context())) access)
2218+
in
2219+
fail ~msg self#pos __LOC__
22152220
(**
22162221
Writes FStatic field access for methods to output buffer
22172222
*)

0 commit comments

Comments
 (0)