소스 검색

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, _ ->