Merge: Check operator
authorJean Privat <jean@pryen.org>
Sat, 18 Apr 2015 09:47:00 +0000 (16:47 +0700)
committerJean Privat <jean@pryen.org>
Sat, 18 Apr 2015 09:47:00 +0000 (16:47 +0700)
commitaba22d750b15f3b7a2efc804ee5c7891a9a09add
treec09861f26493ff60404fca66faefa248dd9501a6
parent49e62cf7f6c63b913fcbaa239df27700fab67243
parent50784b425f2ee89a7c49388a340345ad65fcabb9
Merge: Check operator

Previously, no checking was done on the signature of operators.
While this is not an issue for the model nor the tools this could yield to not POLA error messages when the operator is used. eg.

~~~nit
class A
   fun +(other: A) do print "hello"
end
var a = new A
var b = a + a # Error expected expression
a + a # Error unexpected operator +
# no way do invoke `+` in fact.
~~~

With the PR, we have

~~~
Error: mandatory return type for `+`.
fun +(other: A) do print "hello"
    ^
~~~

The following errors are added by the PR:

* mandatory return
* not enough parameters
* too much parameters
* illegal variadic parameter

Pull-Request: #1269
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>