瀏覽代碼

[typer] don't die so hard if we cannot locate the length field for iteration

This can happen in some display situations when the type is incomplete.
Simon Krajewski 1 年之前
父節點
當前提交
798e0c0000
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/typing/forLoop.ml

+ 1 - 1
src/typing/forLoop.ml

@@ -267,7 +267,7 @@ module IterationKind = struct
 		let t_void = ctx.t.tvoid in
 		let t_void = ctx.t.tvoid in
 		let t_int = ctx.t.tint in
 		let t_int = ctx.t.tint in
 		let mk_field e n =
 		let mk_field e n =
-			TField (e,try quick_field e.etype n with Not_found -> die "" __LOC__)
+			TField (e,try quick_field e.etype n with Not_found -> Error.raise_msg (Printf.sprintf "Could not find field %s on %s" n (s_type_kind e.etype)) e.epos)
 		in
 		in
 		let get_array_length arr p =
 		let get_array_length arr p =
 			mk (mk_field arr "length") ctx.com.basic.tint p
 			mk (mk_field arr "length") ctx.com.basic.tint p