소스 검색

[php7] try harder in generating unique import alias (fixes #6680)

Alexander Kuzmenko 8 년 전
부모
커밋
9b37237e77
2개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 0
      extra/CHANGES.txt
  2. 4 1
      src/generators/genphp7.ml

+ 1 - 0
extra/CHANGES.txt

@@ -35,6 +35,7 @@
 	php/python : fixed some bit operators for Int32 (#5938)
 	php : fixed accessing `static inline var` via reflection (#6630)
 	php : fixed Math.min() and Math.max() for NAN on PHP 7.1.9 and 7.1.10
+	php : don't fail on generating import aliases for classes with the similar names (#6680)
 	js : fixed js syntax error for `value.iterator--` (#6637)
 
 	Standard Library:

+ 4 - 1
src/generators/genphp7.ml

@@ -1308,7 +1308,10 @@ class code_writer (ctx:Common.context) hx_type_path php_name =
 							match !alias_source with
 								| [] ->  failwith ("Failed to find already used type: " ^ get_full_type_name type_path)
 								| name :: rest ->
-									alias_source := rest;
+									alias_source := (match rest with
+										| [] -> [name]
+										| _ -> rest
+									);
 									String.capitalize name
 						and added = ref false
 						and alias = ref (get_type_name type_path) in