소스 검색

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

Simon Krajewski 12 년 전
부모
커밋
b3effb3ce8
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  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 ->