瀏覽代碼

properly initialize typedef monos

Simon Krajewski 1 年之前
父節點
當前提交
8fa3f0a40c
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8 1
      src/compiler/hxb/hxbReader.ml

+ 8 - 1
src/compiler/hxb/hxbReader.ml

@@ -1326,7 +1326,14 @@ class hxb_reader
 
 	method read_typedef (td : tdef) =
 		self#read_common_module_type (Obj.magic td);
-		td.t_type <- self#read_type_instance;
+		let t = self#read_type_instance in
+		match td.t_type with
+		| TMono r ->
+			(match r.tm_type with
+			| None -> Monomorph.bind r t;
+			| Some t' -> die (Printf.sprintf "typedef %s is already initialized to %s, but new init to %s was attempted" (s_type_path td.t_path) (s_type_kind t') (s_type_kind t)) __LOC__)
+		| _ ->
+			die "" __LOC__
 
 	(* Chunks *)