Ver Fonte

allow mixed type arrays in untyped mode (fixed issue #1667)

Simon Krajewski há 12 anos atrás
pai
commit
b3effb3ce8
1 ficheiros alterados com 4 adições e 2 exclusões
  1. 4 2
      typer.ml

+ 4 - 2
typer.ml

@@ -2453,8 +2453,10 @@ and type_expr ctx (e,p) (with_type:with_type) =
 			let t = try
 				unify_min_raise ctx el
 			with Error (Unify l,p) ->
-				display_error ctx "Arrays of mixed types are only allowed if the type is forced to Array<Dynamic>" p;
-				raise (Error (Unify l, p))
+				if ctx.untyped then t_dynamic else begin
+					display_error ctx "Arrays of mixed types are only allowed if the type is forced to Array<Dynamic>" p;
+					raise (Error (Unify l, p))
+				end
 			in
 			mk (TArrayDecl el) (ctx.t.tarray t) p
 		| Some t ->