Consider the following program:
import ballerina/io;
public function main() {
error e = start error("Test");
io:println(e);
}
The above compiles and runs fine and prints the following:
error Test
However, as per the spec, the above should not have been allowed:
start-action := [annots] start (function-call-expr|method-call-expr|remote-method-call-action)
Seems this is fixed. Output with slp6-snapshot
Compiling source
test.bal
ERROR [test.bal:(4:15,4:34)] use of 'start' not allowed with functional constructor 'error()'
error: compilation contains errors
Ah great! But the error message itself is a bit problematic. IINM, we got rid of "functional constructors". In this case, the proper term is "error constructor". Check with @rdhananjaya as well.
Ah great! But the error message itself is a bit problematic. IINM, we got rid of "functional constructors". In this case, the proper term is "error constructor". Check with @rdhananjaya as well.
+1 for error constructor
Most helpful comment
Ah great! But the error message itself is a bit problematic. IINM, we got rid of "functional constructors". In this case, the proper term is "error constructor". Check with @rdhananjaya as well.