From: skaller <skaller@users.sourceforge.net>
> method add_nonterminal (s:string) (sr:range_srcref) (toks:
> Flx_parse.token list) (term:ast_term_t) =
>
> ...
> state#add_nonterminal tok (Flx_srcref.slift sr) t;
>
> Method has 4 arguments, but the call applies to only 3.
>
> Woops, no warning!! Bad! This error of mine caused a serious
> bug -- the method call didn't do anything!
Wait a minute, is there anything after the semicolon?
The point is that a trailing semicolon at the end of a method
definition does nothing: it still returns the result of the previous
expression!
I wonder whether this behaviour is good or not, but this also means
that there is no reason to have a warning here.
If there is an expression after the semicolon, and you have no
warning, then file a bug report: the type system is supposed to detect
all partial applications in statements, except for functions whose
result is a polymorphic type variable.
By the way, your other example with classes is wrong:
# class cc = object (self)
method f x y = x + y
method g () = self#f 1;
end;;
class cc :
object method f : int -> int -> int method g : unit -> int -> int end
No warning, for the reason stated above: the semicolon does nothing.
Jacques Garrigue