Simon Krajewski 6 lat temu
rodzic
commit
3fd498f838
2 zmienionych plików z 6 dodań i 3 usunięć
  1. 4 1
      src/core/type.ml
  2. 2 2
      src/typing/fields.ml

+ 4 - 1
src/core/type.ml

@@ -1868,17 +1868,20 @@ module Monomorph = struct
 				bind m t
 			end;
 		| _ ->
+			let hack = ref false in
 			Option.may (fun (cstr,path,p) -> match cstr with
 				| CStructure(tanon,anon) ->
 					if not (PMap.is_empty anon.a_fields) then check_constraint path (fun () ->
 						unify_merge t tanon;
+						hack := true;
+						m.tm_type <- Some tanon; (* HACK *)
 					)
 				| CTypes tl ->
 					check_constraint path (fun () ->
 						List.iter (unify_merge t) tl
 					)
 			) m.tm_constraint;
-			do_bind m t;
+			if not !hack then do_bind m t; (* HACK *)
 		end
 
 	let unbind m =

+ 2 - 2
src/typing/fields.ml

@@ -489,8 +489,8 @@ let rec type_field cfg ctx e i p mode =
 			| None ->
 				let f = spawn_field () in
 				Monomorph.constrain_to_fields r "type_field" p (PMap.add i f PMap.empty);
-				(* Don't bother registering monomorphs if we're in untyped mode - we probably don't want to close them. *)
-				if not ctx.untyped then ctx.monomorphs <- (tmono,r) :: ctx.monomorphs;
+				(* Don't bother registering monomorphs if we're in untyped mode - we probably don't want to close them. TODO: This is stupid. *)
+				if not (ctx.untyped && ctx.com.platform = Neko) then ctx.monomorphs <- (tmono,r) :: ctx.monomorphs;
 				field_access f
 			| Some (cstr,_,_) ->
 				begin match cstr with