Explorar o código

don't type methods when requesting only fields completion

Nicolas Cannasse %!s(int64=13) %!d(string=hai) anos
pai
achega
848631c763
Modificáronse 1 ficheiros con 8 adicións e 1 borrados
  1. 8 1
      typer.ml

+ 8 - 1
typer.ml

@@ -1701,8 +1701,15 @@ and type_expr ctx ?(need_val=true) (e,p) =
 		let fields = (match follow e.etype with
 			| TInst (c,params) ->
 				let priv = is_parent c ctx.curclass in
+				let opt_field f =
+					match f.cf_type with
+					| TLazy _ ->
+						(* this is not yet typed, let's put a fake method : this will speedup results *)
+						{ f with cf_type = TFun ([],ctx.t.tvoid) }
+					| _ -> f
+				in
 				let merge ?(cond=(fun _ -> true)) a b =
-					PMap.foldi (fun k f m -> if cond f then PMap.add k f m else m) a b
+					PMap.foldi (fun k f m -> if cond f then PMap.add k (opt_field f) m else m) a b
 				in
 				let rec loop c params =
 					let m = List.fold_left (fun m (i,params) ->