fuzion
fuzion copied to clipboard
Poor error message in case of incompatible `e.this` argument in call
This
e : effect is
stop => e.type.abort e.this
results in the following error
> ../clean/fuzion/build/bin/fz test_e_this.fz
/home/fridi/fuzion/work/test_e_this.fz:3:24: error 1: Incompatible types when passing argument in a call
stop => e.type.abort e.this
Actual type for argument #1 'e' does not match expected type.
In call to : 'effect.type.precall abort'
expected formal type: 'e'
actual type found : 'e.this'
assignable to : 'ref e'
for value assigned : 'e.this'
To solve this you could:
• make 'e' a reference by adding the 'ref' keyword, so all its heirs can be used in place of it,
• change the type of the target 'e' to 'e.this', or
• convert the type of the assigned value to 'e'.
one error.
There are a number of issues with this this:
- the error does not suggest the best solution, which would be to add
fixedbeforestop - the
call tomentionseffect.type.precall abort, which is just the name of the result of the precondition syntax sugar, should just beeffect.type.abort assignable tosaysref e, which is syntax that is no longer supported, valuee.thisis only assignable to typee.this- what does
change the type of the target 'e' to 'e.this'mean?