sdk
sdk copied to clipboard
Improve error message in case of function invocation in a constant expression
Object foo(Object o) => o;
const c = foo(1);
Analyzer produces error Methods can't be invoked in constant expressions., CFE Method invocation is not a constant expression..
Why only methods? Functions and getters are also not allowed (except String.length and indentical()) to be a constant expressions.
Please update the error message accordingly.
The analyzer has a separate message for property accesses (ie. getters), but doesn't appear to have a separate message for function invocations. Agreed that it should.