Browse Source

follow both args of fast_eq on array declaration typing (fixes #8283)

Aleksandr Kuzmenko 6 years ago
parent
commit
bac48ae0e6
1 changed files with 11 additions and 2 deletions
  1. 11 2
      src/typing/typer.ml

+ 11 - 2
src/typing/typer.ml

@@ -2049,8 +2049,17 @@ and type_array_decl ctx el with_type p =
 					Some (get_iterable_param t)
 				with Not_found ->
 					None)
-			| TAbstract (a,pl) as t when not (List.exists (fun t' -> fast_eq t t') seen) ->
-				(match List.fold_left (fun acc t -> match loop (t :: seen) t with None -> acc | Some t -> t :: acc) [] (get_abstract_froms a pl) with
+			| TAbstract (a,pl) as t when not (List.exists (fun t' -> fast_eq t (follow t')) seen) ->
+				let types =
+					List.fold_left
+						(fun acc t -> match loop (t :: seen) t with
+							| None -> acc
+							| Some t -> t :: acc
+						)
+						[]
+						(get_abstract_froms a pl)
+				in
+				(match types with
 				| [t] -> Some t
 				| _ -> None)
 			| t ->