瀏覽代碼

catch invalid call to static function on abstract instance (closes #2120)

Simon Krajewski 12 年之前
父節點
當前提交
297be71cf0
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      typer.ml

+ 4 - 0
typer.ml

@@ -1241,6 +1241,10 @@ and type_field ctx e i p mode =
 				AKNo f.cf_name
 			| (MGet | MCall), _ ->
 				let t = field_type f in
+				begin match follow t with
+					| TFun((_,_,t1) :: _,_) -> ()
+					| _ -> error ("Invalid call to static function " ^ i ^ " through abstract instance") p
+				end;
 				let ef = field_expr f t in
 				AKUsing (ef,c,f,e)
 			| MSet, _ ->