No type checking when a method's body is just a variable name
IsaacOscar opened this issue · 2 comments
IsaacOscar commented
Consideer this code:
method foo(x: interface{foo})->interface{bar} { x }
foo(object{})
Runing this through mgc
causes no runtime errors.
However if I change foo
's body to {done; x}
. I get runtime errors as expected.
Note this happens whenever the method body is a single variable name (even if not a method paramater), and effects both paramater and return type checks.
apblack commented
This is deliberate — its an optimisation to make simple accessors reasonably fast. Maybe this is misguided?